From be4552b127f09e5e6c98ef95174d947fea045f7f Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Sun, 17 Dec 2023 09:30:59 -0600 Subject: [PATCH] lib: c-ares: upgrade from v1.19.1 to v1.24.0 Signed-off-by: Eduardo Silva --- cmake/libraries.cmake | 2 +- lib/c-ares-1.19.1/LICENSE.md | 15 - lib/c-ares-1.19.1/RELEASE-NOTES | 57 - lib/c-ares-1.19.1/TODO | 23 - lib/c-ares-1.19.1/docs/Makefile.am | 11 - lib/c-ares-1.19.1/docs/Makefile.inc | 59 - lib/c-ares-1.19.1/docs/acountry.1 | 54 - lib/c-ares-1.19.1/docs/ares_free_data.3 | 80 - .../docs/ares_get_servers_ports.3 | 1 - lib/c-ares-1.19.1/docs/ares_init.3 | 81 - lib/c-ares-1.19.1/docs/ares_set_servers_csv.3 | 68 - .../docs/ares_set_servers_ports.3 | 1 - .../docs/ares_set_servers_ports_csv.3 | 1 - lib/c-ares-1.19.1/include/ares.h | 764 - lib/c-ares-1.19.1/include/ares_dns.h | 112 - lib/c-ares-1.19.1/include/ares_nameser.h | 484 - lib/c-ares-1.19.1/include/ares_version.h | 24 - lib/c-ares-1.19.1/src/CMakeLists.txt | 2 - lib/c-ares-1.19.1/src/Makefile.am | 2 - .../src/lib/ares__addrinfo2hostent.c | 266 - .../src/lib/ares__addrinfo_localhost.c | 240 - .../src/lib/ares__close_sockets.c | 61 - lib/c-ares-1.19.1/src/lib/ares__get_hostent.c | 260 - .../src/lib/ares__parse_into_addrinfo.c | 229 - lib/c-ares-1.19.1/src/lib/ares__read_line.c | 73 - .../src/lib/ares__readaddrinfo.c | 258 - .../src/lib/ares__sortaddrinfo.c | 507 - lib/c-ares-1.19.1/src/lib/ares__timeval.c | 111 - lib/c-ares-1.19.1/src/lib/ares_android.h | 27 - lib/c-ares-1.19.1/src/lib/ares_cancel.c | 63 - lib/c-ares-1.19.1/src/lib/ares_create_query.c | 197 - lib/c-ares-1.19.1/src/lib/ares_data.c | 256 - lib/c-ares-1.19.1/src/lib/ares_data.h | 81 - lib/c-ares-1.19.1/src/lib/ares_destroy.c | 121 - lib/c-ares-1.19.1/src/lib/ares_expand_name.c | 311 - .../src/lib/ares_expand_string.c | 67 - lib/c-ares-1.19.1/src/lib/ares_fds.c | 59 - lib/c-ares-1.19.1/src/lib/ares_free_hostent.c | 43 - lib/c-ares-1.19.1/src/lib/ares_free_string.c | 25 - lib/c-ares-1.19.1/src/lib/ares_freeaddrinfo.c | 60 - lib/c-ares-1.19.1/src/lib/ares_getaddrinfo.c | 850 - lib/c-ares-1.19.1/src/lib/ares_getenv.c | 28 - lib/c-ares-1.19.1/src/lib/ares_getenv.h | 26 - .../src/lib/ares_gethostbyaddr.c | 287 - .../src/lib/ares_gethostbyname.c | 338 - lib/c-ares-1.19.1/src/lib/ares_getnameinfo.c | 447 - lib/c-ares-1.19.1/src/lib/ares_getsock.c | 66 - .../src/lib/ares_inet_net_pton.h | 25 - lib/c-ares-1.19.1/src/lib/ares_init.c | 2266 --- lib/c-ares-1.19.1/src/lib/ares_iphlpapi.h | 221 - lib/c-ares-1.19.1/src/lib/ares_ipv6.h | 85 - lib/c-ares-1.19.1/src/lib/ares_library_init.c | 113 - lib/c-ares-1.19.1/src/lib/ares_llist.c | 63 - lib/c-ares-1.19.1/src/lib/ares_llist.h | 39 - lib/c-ares-1.19.1/src/lib/ares_mkquery.c | 24 - lib/c-ares-1.19.1/src/lib/ares_nowarn.c | 260 - lib/c-ares-1.19.1/src/lib/ares_nowarn.h | 61 - lib/c-ares-1.19.1/src/lib/ares_options.c | 406 - .../src/lib/ares_parse_a_reply.c | 90 - .../src/lib/ares_parse_aaaa_reply.c | 92 - .../src/lib/ares_parse_caa_reply.c | 199 - .../src/lib/ares_parse_mx_reply.c | 164 - .../src/lib/ares_parse_naptr_reply.c | 183 - .../src/lib/ares_parse_ns_reply.c | 177 - .../src/lib/ares_parse_ptr_reply.c | 228 - .../src/lib/ares_parse_soa_reply.c | 179 - .../src/lib/ares_parse_srv_reply.c | 168 - .../src/lib/ares_parse_txt_reply.c | 214 - .../src/lib/ares_parse_uri_reply.c | 184 - lib/c-ares-1.19.1/src/lib/ares_platform.c | 11042 ------------ lib/c-ares-1.19.1/src/lib/ares_platform.h | 43 - lib/c-ares-1.19.1/src/lib/ares_private.h | 437 - lib/c-ares-1.19.1/src/lib/ares_process.c | 1587 -- lib/c-ares-1.19.1/src/lib/ares_query.c | 146 - lib/c-ares-1.19.1/src/lib/ares_rand.c | 279 - lib/c-ares-1.19.1/src/lib/ares_search.c | 321 - lib/c-ares-1.19.1/src/lib/ares_send.c | 129 - lib/c-ares-1.19.1/src/lib/ares_strcasecmp.c | 66 - lib/c-ares-1.19.1/src/lib/ares_strcasecmp.h | 30 - lib/c-ares-1.19.1/src/lib/ares_strdup.c | 42 - lib/c-ares-1.19.1/src/lib/ares_strdup.h | 24 - lib/c-ares-1.19.1/src/lib/ares_strerror.c | 56 - lib/c-ares-1.19.1/src/lib/ares_strsplit.c | 94 - lib/c-ares-1.19.1/src/lib/ares_strsplit.h | 42 - lib/c-ares-1.19.1/src/lib/ares_timeout.c | 88 - lib/c-ares-1.19.1/src/lib/ares_version.c | 11 - lib/c-ares-1.19.1/src/lib/ares_writev.c | 79 - lib/c-ares-1.19.1/src/lib/ares_writev.h | 36 - lib/c-ares-1.19.1/src/lib/bitncmp.c | 59 - lib/c-ares-1.19.1/src/lib/bitncmp.h | 26 - lib/c-ares-1.19.1/src/lib/config-dos.h | 115 - lib/c-ares-1.19.1/src/lib/setup_once.h | 554 - lib/c-ares-1.19.1/src/lib/windows_port.c | 22 - lib/c-ares-1.19.1/src/tools/acountry.c | 655 - lib/c-ares-1.19.1/src/tools/adig.c | 988 -- lib/c-ares-1.19.1/src/tools/ahost.c | 228 - lib/c-ares-1.19.1/src/tools/ares_getopt.c | 122 - lib/c-ares-1.19.1/test/Makefile.am | 49 - lib/c-ares-1.19.1/test/Makefile.in | 1636 -- lib/c-ares-1.19.1/test/ares-fuzz.c | 63 - lib/c-ares-1.19.1/test/ares-test-ai.h | 57 - lib/c-ares-1.19.1/test/ares-test-fuzz-name.c | 23 - lib/c-ares-1.19.1/test/ares-test-fuzz.c | 59 - lib/c-ares-1.19.1/test/ares-test-internal.cc | 632 - lib/c-ares-1.19.1/test/ares-test.h | 494 - lib/c-ares-1.19.1/test/buildconf | 2 - lib/c-ares-1.19.1/test/configure.ac | 25 - lib/c-ares-1.19.1/test/dns-dump.cc | 40 - lib/c-ares-1.19.1/test/dns-proto.h | 254 - .../test/gmock-1.11.0/gmock-gtest-all.cc | 14463 ---------------- .../test/gmock-1.11.0/gmock/gmock.h | 11647 ------------- .../test/gmock-1.11.0/gtest/gtest.h | 12377 ------------- lib/{c-ares-1.19.1 => c-ares-1.24.0}/AUTHORS | 0 lib/{c-ares-1.19.1 => c-ares-1.24.0}/CHANGES | 8065 +++++---- .../CMakeLists.txt | 121 +- .../CONTRIBUTING.md | 0 .../INSTALL.md | 27 +- lib/c-ares-1.24.0/LICENSE.md | 27 + .../Makefile.Watcom | 14 +- .../Makefile.am | 25 +- .../Makefile.dj | 5 +- .../Makefile.in | 39 +- .../Makefile.m32 | 17 +- .../Makefile.msvc | 46 +- .../Makefile.netware | 15 +- lib/{c-ares-1.19.1 => c-ares-1.24.0}/NEWS | 0 .../README.cares | 0 .../README.md | 6 +- .../README.msvc | 2 +- lib/c-ares-1.24.0/RELEASE-NOTES | 51 + .../SECURITY.md | 0 lib/c-ares-1.24.0/TODO | 4 + .../acinclude.m4 | 3 +- .../aclocal.m4 | 6 +- .../aminclude_static.am | 2 +- .../buildconf | 2 + .../buildconf.bat | 3 + .../c-ares-config.cmake.in | 3 + lib/c-ares-1.24.0/cmake/EnableWarnings.cmake | 399 + lib/{c-ares-1.19.1 => c-ares-1.24.0}/compile | 0 .../config.guess | 0 .../config.sub | 0 .../configure | 2096 ++- .../configure.ac | 121 +- lib/{c-ares-1.19.1 => c-ares-1.24.0}/depcomp | 0 .../docs/CMakeLists.txt | 2 + lib/c-ares-1.24.0/docs/Makefile.am | 10 + .../docs/Makefile.in | 92 +- lib/c-ares-1.24.0/docs/Makefile.inc | 130 + .../docs/adig.1 | 46 +- .../docs/ahost.1 | 20 +- .../docs/ares_cancel.3 | 4 +- .../docs/ares_create_query.3 | 3 + .../docs/ares_destroy.3 | 10 +- .../docs/ares_destroy_options.3 | 2 + .../docs/ares_dns_class_fromstr.3 | 4 + lib/c-ares-1.24.0/docs/ares_dns_class_t.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_class_tostr.3 | 4 + lib/c-ares-1.24.0/docs/ares_dns_datatype_t.3 | 4 + lib/c-ares-1.24.0/docs/ares_dns_flags_t.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_mapping.3 | 302 + lib/c-ares-1.24.0/docs/ares_dns_opcode_t.3 | 3 + .../docs/ares_dns_opcode_tostr.3 | 4 + .../docs/ares_dns_opt_datatype_t.3 | 4 + .../docs/ares_dns_opt_get_datatype.3 | 4 + .../docs/ares_dns_opt_get_name.3 | 4 + lib/c-ares-1.24.0/docs/ares_dns_parse.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rcode_t.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rcode_tostr.3 | 4 + .../docs/ares_dns_rec_type_fromstr.3 | 4 + lib/c-ares-1.24.0/docs/ares_dns_rec_type_t.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_record.3 | 380 + .../docs/ares_dns_record_create.3 | 3 + .../docs/ares_dns_record_destroy.3 | 3 + .../docs/ares_dns_record_get_flags.3 | 3 + .../docs/ares_dns_record_get_id.3 | 3 + .../docs/ares_dns_record_get_opcode.3 | 3 + .../docs/ares_dns_record_get_rcode.3 | 3 + .../docs/ares_dns_record_query_add.3 | 3 + .../docs/ares_dns_record_query_cnt.3 | 3 + .../docs/ares_dns_record_query_get.3 | 3 + .../docs/ares_dns_record_rr_add.3 | 3 + .../docs/ares_dns_record_rr_cnt.3 | 3 + .../docs/ares_dns_record_rr_del.3 | 3 + .../docs/ares_dns_record_rr_get.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr.3 | 631 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_addr.3 | 3 + .../docs/ares_dns_rr_get_addr6.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_bin.3 | 3 + .../docs/ares_dns_rr_get_class.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_keys.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_name.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_opt.3 | 3 + .../docs/ares_dns_rr_get_opt_byid.3 | 3 + .../docs/ares_dns_rr_get_opt_cnt.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_str.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_ttl.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_type.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_u16.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_u32.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_get_u8.3 | 3 + .../docs/ares_dns_rr_key_datatype.3 | 4 + lib/c-ares-1.24.0/docs/ares_dns_rr_key_t.3 | 3 + .../docs/ares_dns_rr_key_to_rec_type.3 | 4 + .../docs/ares_dns_rr_key_tostr.3 | 4 + lib/c-ares-1.24.0/docs/ares_dns_rr_set_addr.3 | 3 + .../docs/ares_dns_rr_set_addr6.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_set_bin.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_set_opt.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_set_str.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_set_u16.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_set_u32.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_rr_set_u8.3 | 3 + lib/c-ares-1.24.0/docs/ares_dns_section_t.3 | 3 + .../docs/ares_dns_section_tostr.3 | 4 + lib/c-ares-1.24.0/docs/ares_dns_write.3 | 3 + .../docs/ares_dup.3 | 10 +- .../docs/ares_expand_name.3 | 5 +- .../docs/ares_expand_string.3 | 2 + .../docs/ares_fds.3 | 4 +- lib/c-ares-1.24.0/docs/ares_free_data.3 | 81 + .../docs/ares_free_hostent.3 | 2 + .../docs/ares_free_string.3 | 2 + .../docs/ares_freeaddrinfo.3 | 2 + .../docs/ares_get_servers.3 | 11 +- lib/c-ares-1.24.0/docs/ares_get_servers_csv.3 | 4 + .../docs/ares_get_servers_ports.3 | 4 + .../docs/ares_getaddrinfo.3 | 26 +- .../docs/ares_gethostbyaddr.3 | 10 +- .../docs/ares_gethostbyname.3 | 10 +- .../docs/ares_gethostbyname_file.3 | 4 +- .../docs/ares_getnameinfo.3 | 10 +- .../docs/ares_getsock.3 | 17 +- .../docs/ares_inet_ntop.3 | 6 +- .../docs/ares_inet_pton.3 | 6 +- lib/c-ares-1.24.0/docs/ares_init.3 | 3 + .../docs/ares_init_options.3 | 208 +- .../docs/ares_library_cleanup.3 | 13 +- .../docs/ares_library_init.3 | 20 +- .../docs/ares_library_init_android.3 | 10 +- .../docs/ares_library_initialized.3 | 6 +- .../docs/ares_mkquery.3 | 3 + lib/c-ares-1.24.0/docs/ares_opt_param_t.3 | 4 + .../docs/ares_parse_a_reply.3 | 2 + .../docs/ares_parse_aaaa_reply.3 | 2 + .../docs/ares_parse_caa_reply.3 | 6 +- .../docs/ares_parse_mx_reply.3 | 4 +- .../docs/ares_parse_naptr_reply.3 | 4 +- .../docs/ares_parse_ns_reply.3 | 2 + .../docs/ares_parse_ptr_reply.3 | 2 + .../docs/ares_parse_soa_reply.3 | 4 +- .../docs/ares_parse_srv_reply.3 | 4 +- .../docs/ares_parse_txt_reply.3 | 25 +- .../docs/ares_parse_uri_reply.3 | 16 +- .../docs/ares_process.3 | 6 +- .../docs/ares_query.3 | 10 +- lib/c-ares-1.24.0/docs/ares_reinit.3 | 51 + .../docs/ares_save_options.3 | 8 +- .../docs/ares_search.3 | 13 +- .../docs/ares_send.3 | 13 +- .../docs/ares_set_local_dev.3 | 4 +- .../docs/ares_set_local_ip4.3 | 4 +- .../docs/ares_set_local_ip6.3 | 4 +- .../docs/ares_set_servers.3 | 33 +- lib/c-ares-1.24.0/docs/ares_set_servers_csv.3 | 98 + .../docs/ares_set_servers_ports.3 | 4 + .../docs/ares_set_servers_ports_csv.3 | 4 + .../docs/ares_set_socket_callback.3 | 8 +- .../docs/ares_set_socket_configure_callback.3 | 7 +- .../docs/ares_set_socket_functions.3 | 23 +- .../docs/ares_set_sortlist.3 | 9 +- .../docs/ares_strerror.3 | 2 + lib/c-ares-1.24.0/docs/ares_svcb_param_t.3 | 4 + lib/c-ares-1.24.0/docs/ares_threadsafety.3 | 43 + .../docs/ares_timeout.3 | 4 +- lib/c-ares-1.24.0/docs/ares_tlsa_match_t.3 | 3 + lib/c-ares-1.24.0/docs/ares_tlsa_selector_t.3 | 3 + lib/c-ares-1.24.0/docs/ares_tlsa_usage_t.3 | 3 + .../docs/ares_version.3 | 2 + .../get_ver.awk | 2 + .../include/CMakeLists.txt | 4 +- .../include/Makefile.am | 4 +- .../include/Makefile.in | 18 +- lib/c-ares-1.24.0/include/ares.h | 758 + .../include/ares_build.h | 38 +- .../include/ares_build.h.cmake | 9 + .../include/ares_build.h.in | 39 +- lib/c-ares-1.24.0/include/ares_dns.h | 127 + lib/c-ares-1.24.0/include/ares_dns_record.h | 954 + lib/c-ares-1.24.0/include/ares_nameser.h | 510 + .../include/ares_rules.h | 60 +- lib/c-ares-1.24.0/include/ares_version.h | 49 + .../install-sh | 0 .../libcares.pc.cmake | 3 + .../libcares.pc.in | 2 + .../ltmain.sh | 28 +- .../m4/ax_ac_append_to_file.m4 | 0 .../m4/ax_ac_print_to_file.m4 | 0 .../m4/ax_add_am_macro_static.m4 | 0 .../m4/ax_am_macros_static.m4 | 0 .../m4/ax_append_compile_flags.m4 | 65 + lib/c-ares-1.24.0/m4/ax_append_flag.m4 | 69 + lib/c-ares-1.24.0/m4/ax_check_compile_flag.m4 | 72 + .../m4/ax_check_gnu_make.m4 | 0 .../m4/ax_check_user_namespace.m4 | 7 +- .../m4/ax_check_uts_namespace.m4 | 7 +- .../m4/ax_code_coverage.m4 | 0 .../m4/ax_cxx_compile_stdcxx.m4 | 15 +- .../m4/ax_cxx_compile_stdcxx_14.m4} | 17 +- .../m4/ax_file_escapes.m4 | 0 .../m4/ax_pthread.m4 | 0 .../m4/ax_require_defined.m4 | 0 .../m4/cares-compilers.m4 | 67 +- .../m4/cares-confopts.m4 | 12 +- .../m4/cares-functions.m4 | 297 +- .../m4/cares-reentrant.m4 | 5 +- .../m4/libtool.m4 | 0 .../m4/ltoptions.m4 | 0 .../m4/ltsugar.m4 | 0 .../m4/ltversion.m4 | 0 .../m4/lt~obsolete.m4 | 0 lib/c-ares-1.24.0/m4/pkg.m4 | 275 + .../m4/xc-am-iface.m4 | 3 +- .../m4/xc-cc-check.m4 | 3 +- .../m4/xc-lt-iface.m4 | 4 +- .../m4/xc-translit.m4 | 4 +- .../m4/xc-val-flgs.m4 | 4 +- .../m4/zz40-xc-ovr.m4 | 3 +- lib/{c-ares-1.19.1 => c-ares-1.24.0}/maketgz | 4 +- lib/{c-ares-1.19.1 => c-ares-1.24.0}/missing | 0 .../msvc_ver.inc | 2 + lib/c-ares-1.24.0/src/CMakeLists.txt | 4 + lib/c-ares-1.24.0/src/Makefile.am | 4 + .../src/Makefile.in | 20 +- .../src/lib/CMakeLists.txt | 16 +- .../src/lib/Makefile.am | 2 + .../src/lib/Makefile.in | 430 +- .../src/lib/Makefile.inc | 56 +- .../src/lib/ares__addrinfo2hostent.c | 278 + .../src/lib/ares__addrinfo_localhost.c | 236 + lib/c-ares-1.24.0/src/lib/ares__buf.c | 1118 ++ lib/c-ares-1.24.0/src/lib/ares__buf.h | 568 + .../src/lib/ares__close_sockets.c | 111 + lib/c-ares-1.24.0/src/lib/ares__hosts_file.c | 1119 ++ lib/c-ares-1.24.0/src/lib/ares__htable.c | 442 + lib/c-ares-1.24.0/src/lib/ares__htable.h | 163 + lib/c-ares-1.24.0/src/lib/ares__htable_asvp.c | 194 + lib/c-ares-1.24.0/src/lib/ares__htable_asvp.h | 120 + .../src/lib/ares__htable_strvp.c | 198 + .../src/lib/ares__htable_strvp.h | 118 + lib/c-ares-1.24.0/src/lib/ares__htable_szvp.c | 193 + lib/c-ares-1.24.0/src/lib/ares__htable_szvp.h | 117 + lib/c-ares-1.24.0/src/lib/ares__iface_ips.c | 594 + lib/c-ares-1.24.0/src/lib/ares__iface_ips.h | 139 + lib/c-ares-1.24.0/src/lib/ares__llist.c | 360 + lib/c-ares-1.24.0/src/lib/ares__llist.h | 220 + .../src/lib/ares__parse_into_addrinfo.c | 184 + lib/c-ares-1.24.0/src/lib/ares__read_line.c | 82 + lib/c-ares-1.24.0/src/lib/ares__slist.c | 479 + lib/c-ares-1.24.0/src/lib/ares__slist.h | 206 + lib/c-ares-1.24.0/src/lib/ares__socket.c | 465 + .../src/lib/ares__sortaddrinfo.c | 452 + lib/c-ares-1.24.0/src/lib/ares__threads.c | 193 + lib/c-ares-1.24.0/src/lib/ares__timeval.c | 108 + .../src/lib/ares_android.c | 360 +- lib/c-ares-1.24.0/src/lib/ares_android.h | 38 + lib/c-ares-1.24.0/src/lib/ares_cancel.c | 90 + .../src/lib/ares_config.h.cmake | 47 +- .../src/lib/ares_config.h.in | 144 +- lib/c-ares-1.24.0/src/lib/ares_create_query.c | 107 + lib/c-ares-1.24.0/src/lib/ares_data.c | 172 + lib/c-ares-1.24.0/src/lib/ares_data.h | 92 + lib/c-ares-1.24.0/src/lib/ares_destroy.c | 129 + lib/c-ares-1.24.0/src/lib/ares_dns_mapping.c | 885 + lib/c-ares-1.24.0/src/lib/ares_dns_name.c | 676 + lib/c-ares-1.24.0/src/lib/ares_dns_parse.c | 1234 ++ lib/c-ares-1.24.0/src/lib/ares_dns_private.h | 236 + lib/c-ares-1.24.0/src/lib/ares_dns_record.c | 1316 ++ lib/c-ares-1.24.0/src/lib/ares_dns_write.c | 1054 ++ lib/c-ares-1.24.0/src/lib/ares_expand_name.c | 118 + .../src/lib/ares_expand_string.c | 111 + lib/c-ares-1.24.0/src/lib/ares_fds.c | 83 + lib/c-ares-1.24.0/src/lib/ares_free_hostent.c | 57 + lib/c-ares-1.24.0/src/lib/ares_free_string.c | 36 + lib/c-ares-1.24.0/src/lib/ares_freeaddrinfo.c | 70 + lib/c-ares-1.24.0/src/lib/ares_getaddrinfo.c | 776 + lib/c-ares-1.24.0/src/lib/ares_getenv.c | 38 + lib/c-ares-1.24.0/src/lib/ares_getenv.h | 36 + .../src/lib/ares_gethostbyaddr.c | 233 + .../src/lib/ares_gethostbyname.c | 330 + lib/c-ares-1.24.0/src/lib/ares_getnameinfo.c | 438 + lib/c-ares-1.24.0/src/lib/ares_getsock.c | 88 + .../src/lib/ares_inet_net_pton.h | 35 + lib/c-ares-1.24.0/src/lib/ares_init.c | 569 + lib/c-ares-1.24.0/src/lib/ares_ipv6.h | 92 + lib/c-ares-1.24.0/src/lib/ares_library_init.c | 162 + lib/c-ares-1.24.0/src/lib/ares_math.c | 145 + lib/c-ares-1.24.0/src/lib/ares_mkquery.c | 35 + lib/c-ares-1.24.0/src/lib/ares_options.c | 463 + .../src/lib/ares_parse_a_reply.c | 101 + .../src/lib/ares_parse_aaaa_reply.c | 102 + .../src/lib/ares_parse_caa_reply.c | 139 + .../src/lib/ares_parse_mx_reply.c | 112 + .../src/lib/ares_parse_naptr_reply.c | 134 + .../src/lib/ares_parse_ns_reply.c | 157 + .../src/lib/ares_parse_ptr_reply.c | 198 + .../src/lib/ares_parse_soa_reply.c | 117 + .../src/lib/ares_parse_srv_reply.c | 116 + .../src/lib/ares_parse_txt_reply.c | 137 + .../src/lib/ares_parse_uri_reply.c | 115 + lib/c-ares-1.24.0/src/lib/ares_platform.c | 11050 ++++++++++++ lib/c-ares-1.24.0/src/lib/ares_platform.h | 52 + lib/c-ares-1.24.0/src/lib/ares_private.h | 607 + lib/c-ares-1.24.0/src/lib/ares_process.c | 1149 ++ lib/c-ares-1.24.0/src/lib/ares_qcache.c | 455 + lib/c-ares-1.24.0/src/lib/ares_query.c | 139 + lib/c-ares-1.24.0/src/lib/ares_rand.c | 345 + lib/c-ares-1.24.0/src/lib/ares_search.c | 348 + lib/c-ares-1.24.0/src/lib/ares_send.c | 165 + .../src/lib/ares_setup.h | 116 +- lib/c-ares-1.24.0/src/lib/ares_str.c | 111 + lib/c-ares-1.24.0/src/lib/ares_str.h | 51 + lib/c-ares-1.24.0/src/lib/ares_strcasecmp.c | 79 + lib/c-ares-1.24.0/src/lib/ares_strcasecmp.h | 40 + lib/c-ares-1.24.0/src/lib/ares_strerror.c | 91 + lib/c-ares-1.24.0/src/lib/ares_strsplit.c | 142 + lib/c-ares-1.24.0/src/lib/ares_strsplit.h | 53 + lib/c-ares-1.24.0/src/lib/ares_sysconfig.c | 1106 ++ .../src/lib/ares_sysconfig_files.c | 705 + lib/c-ares-1.24.0/src/lib/ares_timeout.c | 97 + .../src/lib/ares_update_servers.c | 1193 ++ lib/c-ares-1.24.0/src/lib/ares_version.c | 37 + .../src/lib/cares.rc | 36 +- lib/c-ares-1.24.0/src/lib/config-dos.h | 117 + .../src/lib/config-win32.h | 135 +- .../src/lib/inet_net_pton.c | 321 +- .../src/lib/inet_ntop.c | 105 +- lib/c-ares-1.24.0/src/lib/setup_once.h | 562 + lib/c-ares-1.24.0/src/lib/windows_port.c | 29 + .../src/tools/CMakeLists.txt | 27 +- .../src/tools/Makefile.am | 8 +- .../src/tools/Makefile.in | 192 +- .../src/tools/Makefile.inc | 4 +- lib/c-ares-1.24.0/src/tools/adig.c | 959 + lib/c-ares-1.24.0/src/tools/ahost.c | 247 + lib/c-ares-1.24.0/src/tools/ares_getopt.c | 137 + .../src/tools/ares_getopt.h | 30 +- .../test/CMakeLists.txt | 25 +- lib/c-ares-1.24.0/test/Makefile.am | 59 + lib/c-ares-1.24.0/test/Makefile.in | 1969 +++ .../test/Makefile.inc | 2 + .../test/Makefile.m32 | 27 +- .../test/Makefile.msvc | 25 +- .../test/README.md | 1 - .../test/aclocal.m4 | 3 +- .../test}/aminclude_static.am | 2 +- lib/c-ares-1.24.0/test/ares-fuzz.c | 86 + lib/c-ares-1.24.0/test/ares-test-ai.h | 80 + lib/c-ares-1.24.0/test/ares-test-fuzz-name.c | 42 + lib/c-ares-1.24.0/test/ares-test-fuzz.c | 100 + .../test/ares-test-init.cc | 237 +- lib/c-ares-1.24.0/test/ares-test-internal.cc | 1025 ++ .../test/ares-test-live.cc | 72 +- .../test/ares-test-main.cc | 21 +- .../test/ares-test-misc.cc | 134 +- .../test/ares-test-mock-ai.cc | 147 +- .../test/ares-test-mock.cc | 407 +- .../test/ares-test-ns.cc | 17 + .../test/ares-test-parse-a.cc | 59 +- .../test/ares-test-parse-aaaa.cc | 45 +- .../test/ares-test-parse-caa.cc | 35 +- .../test/ares-test-parse-mx.cc | 35 +- .../test/ares-test-parse-naptr.cc | 35 +- .../test/ares-test-parse-ns.cc | 35 +- .../test/ares-test-parse-ptr.cc | 47 +- .../test/ares-test-parse-soa-any.cc | 43 +- .../test/ares-test-parse-soa.cc | 43 +- .../test/ares-test-parse-srv.cc | 43 +- .../test/ares-test-parse-txt.cc | 62 +- .../test/ares-test-parse-uri.cc | 43 +- .../test/ares-test-parse.cc | 60 +- .../test/ares-test.cc | 267 +- lib/c-ares-1.24.0/test/ares-test.h | 648 + lib/c-ares-1.24.0/test/buildconf | 4 + .../test/compile | 0 .../test/config.guess | 0 .../test/config.h.in | 7 +- .../test/config.sub | 0 .../test/configure | 418 +- lib/c-ares-1.24.0/test/configure.ac | 56 + .../test/depcomp | 0 lib/c-ares-1.24.0/test/dns-dump.cc | 57 + .../test/dns-proto-test.cc | 17 + .../test/dns-proto.cc | 111 +- lib/c-ares-1.24.0/test/dns-proto.h | 392 + .../test/fuzzcheck.sh | 2 + .../004a216d3cff18b0c5c6b68b807f1529 | Bin .../00539467ca159b36aea95e61f9729115 | Bin .../00e846db8f43f2f507cd1666ed5a753e | Bin .../0177b7566f08c013699eaea9a77abeb3 | Bin .../020a4fa317715bfdb236ed13751e6b65 | Bin .../0310f2e81bea31f4fe3f330872a877dd | Bin .../0449be67df1730b2d0887d412a9b7cc4 | Bin .../0449dd14f7aa94bf0d716bfe09b287a8 | Bin .../04c93cdf7208979aa4df80a3a0d5a2d8 | Bin .../0567e7171e08e75f3f91c4ca74c17adc | Bin .../05ba948578a397e9cbc6a7b3e78622fa | Bin .../060afe5ed25f3e2e86167e545f27edca | Bin .../06d47d3681493f1b1d41236f460d896f | Bin .../0724a810b0e131c2fddb6de9003b9064 | Bin .../0b5279148826f5b962bcf1896bdb4ede | Bin .../114048c0f6b10bdc67ce9166405d195e | Bin .../11b8464a0ef8735d202955c34c36b0c7 | Bin .../11cb626f1668c7b41954ce7d768fe528 | Bin .../14b133bf18125b75a1976fa63a1df6b7 | Bin .../153c6b3afa8faa03c8bc28f936a6d4cf | Bin .../182cad2a342ed7317b7c21a5d17020d1 | Bin .../1c61a61bb7057b52c5b15188345a5238 | Bin .../1dbe2cf62ed2e4fa1c3cb473f08710b5 | Bin .../21199be504fcfece5c7096ee0dbba507 | Bin .../21891480074b5635dbbe7137bdcabccd | Bin .../233aea42e15aa73e131eefabf16088c9 | Bin .../24660d4e7ac7aa21d600ea7a3d198bbb | Bin .../25589deb55c08429345f289d1c9b0254 | Bin .../2573bd823e4da11f727a17f8e1f35c26 | Bin .../276f12da56866273e76059ad0e7be97e | Bin .../29198a2e380cb19babec9e02116d213e | Bin .../2c94ba9434b1a1b9396fc5364f101363 | Bin .../2d578c357dc2f5e02dc55cddb30641d1 | Bin .../2dff6cc5a223e67fde9e5e79af456992 | Bin .../2f103b1f9477f2d8934bd84328d51c75 | Bin .../31cd3a8413de13d9624adbb1613784bf | Bin .../36415bdf1d180098fe6234b4186e69f3 | Bin .../3a04a80f0242e8dff0cd732e7c4767da | Bin .../44d0f973b7b0fb3e4a07770c943dcd5a | Bin .../50bc00daa0ddcd6cfb2b5d9f62c81f47 | Bin .../51ed2d1fb77b3078b54e94e85606b7df | Bin .../5c5e0e899cf2e7d053a9e45fb76f6e5a | Bin .../70152ed033f139443fbfb1b858bb3b1b | Bin .../7030ca2b24e5a7f9dd8f62096a48eb33 | Bin .../71eec1a0ef2d25bb9e2ef17f23be7e9e | Bin .../7a6b0177210ea4ef40b254daf99393c5 | Bin .../7f1567733711ffb61839621af0cbfa33 | Bin .../850c6d57c5bb7be8205fc2438d14d7e5 | Bin .../a5c8cd2784a5792b9e91c2d7895b3b34 | Bin .../a9135cdc7151d023300ff194bad90af9 | Bin .../af2597e8ac7dec1e8b4a47518312912a | Bin .../test/fuzzinput/answer_a | Bin .../test/fuzzinput/answer_aaaa | Bin .../b3f53ef826b831bb09dd25c7f5960249 | Bin .../cda0f8751f5c4993974c2b549d29bcc8 | Bin .../ce6c26c0e469339873d0e7f616ab0945 | Bin .../fuzzinput/clusterfuzz-5637790584012800 | Bin .../fuzzinput/clusterfuzz-5650695891451904 | Bin .../fuzzinput/clusterfuzz-5651369832218624 | Bin .../fuzzinput/clusterfuzz-5674462260756480 | Bin .../fuzzinput/clusterfuzz-5680630672654336 | Bin .../fuzzinput/clusterfuzz-5683497160671232 | Bin .../fuzzinput/clusterfuzz-5687310655422464 | Bin .../fuzzinput/clusterfuzz-5695341573177344 | Bin .../fuzzinput/clusterfuzz-5697835103682560 | Bin .../fuzzinput/clusterfuzz-5728518081609728 | Bin .../fuzzinput/clusterfuzz-5732960017317888 | Bin .../e4dd7e7c2dd4ed7c2e17a6af5d04f9c9 | Bin .../ed50ed8ee36230a5a69746ad830437e5 | Bin .../f1b900d50806021953321c3b604ee497 | Bin .../f6606f624be8c628328cea01d2cd07a9 | Bin .../f89f6c8176b564a7dd646f14305573ce | Bin .../f9ad508d2dbd08d3aaaabc7d1174677d | Bin .../test/fuzzinput/multi-indir | Bin .../test/fuzznames/name01 | 0 .../test/fuzznames/name02 | 0 .../test/fuzznames/name03 | 0 .../test/fuzznames/name04 | 0 .../test/fuzznames/name05 | 0 .../test/fuzznames/name06 | 0 .../test/fuzznames/name07 | 0 .../test/fuzznames/name08 | 0 .../test/fuzznames/name09 | 0 .../test/install-sh | 0 .../test/ltmain.sh | 28 +- .../test/missing | 0 .../test/test-driver | 0 583 files changed, 60373 insertions(+), 77808 deletions(-) delete mode 100644 lib/c-ares-1.19.1/LICENSE.md delete mode 100644 lib/c-ares-1.19.1/RELEASE-NOTES delete mode 100644 lib/c-ares-1.19.1/TODO delete mode 100644 lib/c-ares-1.19.1/docs/Makefile.am delete mode 100644 lib/c-ares-1.19.1/docs/Makefile.inc delete mode 100644 lib/c-ares-1.19.1/docs/acountry.1 delete mode 100644 lib/c-ares-1.19.1/docs/ares_free_data.3 delete mode 100644 lib/c-ares-1.19.1/docs/ares_get_servers_ports.3 delete mode 100644 lib/c-ares-1.19.1/docs/ares_init.3 delete mode 100644 lib/c-ares-1.19.1/docs/ares_set_servers_csv.3 delete mode 100644 lib/c-ares-1.19.1/docs/ares_set_servers_ports.3 delete mode 100644 lib/c-ares-1.19.1/docs/ares_set_servers_ports_csv.3 delete mode 100644 lib/c-ares-1.19.1/include/ares.h delete mode 100644 lib/c-ares-1.19.1/include/ares_dns.h delete mode 100644 lib/c-ares-1.19.1/include/ares_nameser.h delete mode 100644 lib/c-ares-1.19.1/include/ares_version.h delete mode 100644 lib/c-ares-1.19.1/src/CMakeLists.txt delete mode 100644 lib/c-ares-1.19.1/src/Makefile.am delete mode 100644 lib/c-ares-1.19.1/src/lib/ares__addrinfo2hostent.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares__addrinfo_localhost.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares__close_sockets.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares__get_hostent.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares__parse_into_addrinfo.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares__read_line.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares__readaddrinfo.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares__sortaddrinfo.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares__timeval.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_android.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_cancel.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_create_query.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_data.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_data.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_destroy.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_expand_name.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_expand_string.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_fds.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_free_hostent.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_free_string.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_freeaddrinfo.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_getaddrinfo.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_getenv.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_getenv.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_gethostbyaddr.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_gethostbyname.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_getnameinfo.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_getsock.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_inet_net_pton.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_init.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_iphlpapi.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_ipv6.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_library_init.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_llist.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_llist.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_mkquery.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_nowarn.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_nowarn.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_options.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_a_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_aaaa_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_caa_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_mx_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_naptr_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_ns_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_ptr_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_soa_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_srv_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_txt_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_parse_uri_reply.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_platform.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_platform.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_private.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_process.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_query.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_rand.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_search.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_send.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_strcasecmp.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_strcasecmp.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_strdup.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_strdup.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_strerror.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_strsplit.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_strsplit.h delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_timeout.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_version.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_writev.c delete mode 100644 lib/c-ares-1.19.1/src/lib/ares_writev.h delete mode 100644 lib/c-ares-1.19.1/src/lib/bitncmp.c delete mode 100644 lib/c-ares-1.19.1/src/lib/bitncmp.h delete mode 100644 lib/c-ares-1.19.1/src/lib/config-dos.h delete mode 100644 lib/c-ares-1.19.1/src/lib/setup_once.h delete mode 100644 lib/c-ares-1.19.1/src/lib/windows_port.c delete mode 100644 lib/c-ares-1.19.1/src/tools/acountry.c delete mode 100644 lib/c-ares-1.19.1/src/tools/adig.c delete mode 100644 lib/c-ares-1.19.1/src/tools/ahost.c delete mode 100644 lib/c-ares-1.19.1/src/tools/ares_getopt.c delete mode 100644 lib/c-ares-1.19.1/test/Makefile.am delete mode 100644 lib/c-ares-1.19.1/test/Makefile.in delete mode 100644 lib/c-ares-1.19.1/test/ares-fuzz.c delete mode 100644 lib/c-ares-1.19.1/test/ares-test-ai.h delete mode 100644 lib/c-ares-1.19.1/test/ares-test-fuzz-name.c delete mode 100644 lib/c-ares-1.19.1/test/ares-test-fuzz.c delete mode 100644 lib/c-ares-1.19.1/test/ares-test-internal.cc delete mode 100644 lib/c-ares-1.19.1/test/ares-test.h delete mode 100755 lib/c-ares-1.19.1/test/buildconf delete mode 100644 lib/c-ares-1.19.1/test/configure.ac delete mode 100644 lib/c-ares-1.19.1/test/dns-dump.cc delete mode 100644 lib/c-ares-1.19.1/test/dns-proto.h delete mode 100644 lib/c-ares-1.19.1/test/gmock-1.11.0/gmock-gtest-all.cc delete mode 100644 lib/c-ares-1.19.1/test/gmock-1.11.0/gmock/gmock.h delete mode 100644 lib/c-ares-1.19.1/test/gmock-1.11.0/gtest/gtest.h rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/AUTHORS (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/CHANGES (75%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/CMakeLists.txt (86%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/CONTRIBUTING.md (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/INSTALL.md (93%) create mode 100644 lib/c-ares-1.24.0/LICENSE.md rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/Makefile.Watcom (90%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/Makefile.am (53%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/Makefile.dj (94%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/Makefile.in (95%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/Makefile.m32 (82%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/Makefile.msvc (90%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/Makefile.netware (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/NEWS (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/README.cares (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/README.md (91%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/README.msvc (98%) create mode 100644 lib/c-ares-1.24.0/RELEASE-NOTES rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/SECURITY.md (100%) create mode 100644 lib/c-ares-1.24.0/TODO rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/acinclude.m4 (99%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/aclocal.m4 (99%) rename lib/{c-ares-1.19.1/test => c-ares-1.24.0}/aminclude_static.am (99%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/buildconf (58%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/buildconf.bat (85%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/c-ares-config.cmake.in (90%) create mode 100644 lib/c-ares-1.24.0/cmake/EnableWarnings.cmake rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/compile (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/config.guess (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/config.sub (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/configure (95%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/configure.ac (87%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/depcomp (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/CMakeLists.txt (81%) create mode 100644 lib/c-ares-1.24.0/docs/Makefile.am rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/Makefile.in (87%) create mode 100644 lib/c-ares-1.24.0/docs/Makefile.inc rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/adig.1 (64%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ahost.1 (68%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_cancel.3 (94%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_create_query.3 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_destroy.3 (84%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_destroy_options.3 (97%) create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_class_fromstr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_class_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_class_tostr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_datatype_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_flags_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_mapping.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_opcode_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_opcode_tostr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_opt_datatype_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_opt_get_datatype.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_opt_get_name.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_parse.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rcode_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rcode_tostr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rec_type_fromstr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rec_type_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_create.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_destroy.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_get_flags.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_get_id.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_get_opcode.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_get_rcode.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_query_add.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_query_cnt.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_query_get.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_rr_add.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_rr_cnt.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_rr_del.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_record_rr_get.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_addr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_addr6.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_bin.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_class.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_keys.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_name.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_opt.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_opt_byid.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_opt_cnt.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_str.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_ttl.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_type.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_u16.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_u32.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_get_u8.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_key_datatype.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_key_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_key_to_rec_type.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_key_tostr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_set_addr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_set_addr6.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_set_bin.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_set_opt.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_set_str.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_set_u16.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_set_u32.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_rr_set_u8.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_section_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_section_tostr.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_dns_write.3 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_dup.3 (88%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_expand_name.3 (96%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_expand_string.3 (98%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_fds.3 (95%) create mode 100644 lib/c-ares-1.24.0/docs/ares_free_data.3 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_free_hostent.3 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_free_string.3 (96%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_freeaddrinfo.3 (96%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_get_servers.3 (89%) create mode 100644 lib/c-ares-1.24.0/docs/ares_get_servers_csv.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_get_servers_ports.3 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_getaddrinfo.3 (86%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_gethostbyaddr.3 (86%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_gethostbyname.3 (87%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_gethostbyname_file.3 (95%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_getnameinfo.3 (89%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_getsock.3 (75%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_inet_ntop.3 (96%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_inet_pton.3 (95%) create mode 100644 lib/c-ares-1.24.0/docs/ares_init.3 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_init_options.3 (67%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_library_cleanup.3 (92%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_library_init.3 (89%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_library_init_android.3 (96%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_library_initialized.3 (92%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_mkquery.3 (97%) create mode 100644 lib/c-ares-1.24.0/docs/ares_opt_param_t.3 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_a_reply.3 (98%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_aaaa_reply.3 (98%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_caa_reply.3 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_mx_reply.3 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_naptr_reply.3 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_ns_reply.3 (98%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_ptr_reply.3 (98%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_soa_reply.3 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_srv_reply.3 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_txt_reply.3 (93%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_parse_uri_reply.3 (92%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_process.3 (95%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_query.3 (90%) create mode 100644 lib/c-ares-1.24.0/docs/ares_reinit.3 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_save_options.3 (92%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_search.3 (90%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_send.3 (86%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_set_local_dev.3 (92%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_set_local_ip4.3 (91%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_set_local_ip6.3 (90%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_set_servers.3 (76%) create mode 100644 lib/c-ares-1.24.0/docs/ares_set_servers_csv.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_set_servers_ports.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_set_servers_ports_csv.3 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_set_socket_callback.3 (82%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_set_socket_configure_callback.3 (84%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_set_socket_functions.3 (89%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_set_sortlist.3 (88%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_strerror.3 (97%) create mode 100644 lib/c-ares-1.24.0/docs/ares_svcb_param_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_threadsafety.3 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_timeout.3 (95%) create mode 100644 lib/c-ares-1.24.0/docs/ares_tlsa_match_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_tlsa_selector_t.3 create mode 100644 lib/c-ares-1.24.0/docs/ares_tlsa_usage_t.3 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/docs/ares_version.3 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/get_ver.awk (92%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/include/CMakeLists.txt (68%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/include/Makefile.am (71%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/include/Makefile.in (97%) create mode 100644 lib/c-ares-1.24.0/include/ares.h rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/include/ares_build.h (83%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/include/ares_build.h.cmake (84%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/include/ares_build.h.in (72%) create mode 100644 lib/c-ares-1.24.0/include/ares_dns.h create mode 100644 lib/c-ares-1.24.0/include/ares_dns_record.h create mode 100644 lib/c-ares-1.24.0/include/ares_nameser.h rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/include/ares_rules.h (66%) create mode 100644 lib/c-ares-1.24.0/include/ares_version.h rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/install-sh (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/libcares.pc.cmake (84%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/libcares.pc.in (87%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/ltmain.sh (99%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_ac_append_to_file.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_ac_print_to_file.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_add_am_macro_static.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_am_macros_static.m4 (100%) create mode 100644 lib/c-ares-1.24.0/m4/ax_append_compile_flags.m4 create mode 100644 lib/c-ares-1.24.0/m4/ax_append_flag.m4 create mode 100644 lib/c-ares-1.24.0/m4/ax_check_compile_flag.m4 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_check_gnu_make.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_check_user_namespace.m4 (87%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_check_uts_namespace.m4 (91%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_code_coverage.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_cxx_compile_stdcxx.m4 (97%) rename lib/{c-ares-1.19.1/m4/ax_cxx_compile_stdcxx_11.m4 => c-ares-1.24.0/m4/ax_cxx_compile_stdcxx_14.m4} (67%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_file_escapes.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_pthread.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ax_require_defined.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/cares-compilers.m4 (94%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/cares-confopts.m4 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/cares-functions.m4 (93%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/cares-reentrant.m4 (99%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/libtool.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ltoptions.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ltsugar.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/ltversion.m4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/lt~obsolete.m4 (100%) create mode 100644 lib/c-ares-1.24.0/m4/pkg.m4 rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/xc-am-iface.m4 (98%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/xc-cc-check.m4 (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/xc-lt-iface.m4 (99%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/xc-translit.m4 (98%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/xc-val-flgs.m4 (98%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/m4/zz40-xc-ovr.m4 (99%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/maketgz (95%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/missing (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/msvc_ver.inc (88%) create mode 100644 lib/c-ares-1.24.0/src/CMakeLists.txt create mode 100644 lib/c-ares-1.24.0/src/Makefile.am rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/Makefile.in (97%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/CMakeLists.txt (90%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/Makefile.am (95%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/Makefile.in (80%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/Makefile.inc (61%) create mode 100644 lib/c-ares-1.24.0/src/lib/ares__addrinfo2hostent.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__addrinfo_localhost.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__buf.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__buf.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares__close_sockets.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__hosts_file.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__htable.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__htable.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares__htable_asvp.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__htable_asvp.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares__htable_strvp.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__htable_strvp.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares__htable_szvp.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__htable_szvp.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares__iface_ips.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__iface_ips.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares__llist.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__llist.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares__parse_into_addrinfo.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__read_line.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__slist.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__slist.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares__socket.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__sortaddrinfo.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__threads.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares__timeval.c rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/ares_android.c (52%) create mode 100644 lib/c-ares-1.24.0/src/lib/ares_android.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_cancel.c rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/ares_config.h.cmake (91%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/ares_config.h.in (76%) create mode 100644 lib/c-ares-1.24.0/src/lib/ares_create_query.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_data.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_data.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_destroy.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_dns_mapping.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_dns_name.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_dns_parse.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_dns_private.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_dns_record.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_dns_write.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_expand_name.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_expand_string.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_fds.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_free_hostent.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_free_string.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_freeaddrinfo.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_getaddrinfo.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_getenv.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_getenv.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_gethostbyaddr.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_gethostbyname.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_getnameinfo.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_getsock.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_inet_net_pton.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_init.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_ipv6.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_library_init.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_math.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_mkquery.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_options.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_a_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_aaaa_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_caa_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_mx_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_naptr_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_ns_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_ptr_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_soa_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_srv_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_txt_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_parse_uri_reply.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_platform.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_platform.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_private.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_process.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_qcache.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_query.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_rand.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_search.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_send.c rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/ares_setup.h (68%) create mode 100644 lib/c-ares-1.24.0/src/lib/ares_str.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_str.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_strcasecmp.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_strcasecmp.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_strerror.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_strsplit.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_strsplit.h create mode 100644 lib/c-ares-1.24.0/src/lib/ares_sysconfig.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_sysconfig_files.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_timeout.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_update_servers.c create mode 100644 lib/c-ares-1.24.0/src/lib/ares_version.c rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/cares.rc (53%) create mode 100644 lib/c-ares-1.24.0/src/lib/config-dos.h rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/config-win32.h (74%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/inet_net_pton.c (56%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/lib/inet_ntop.c (66%) create mode 100644 lib/c-ares-1.24.0/src/lib/setup_once.h create mode 100644 lib/c-ares-1.24.0/src/lib/windows_port.c rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/tools/CMakeLists.txt (69%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/tools/Makefile.am (87%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/tools/Makefile.in (68%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/tools/Makefile.inc (58%) create mode 100644 lib/c-ares-1.24.0/src/tools/adig.c create mode 100644 lib/c-ares-1.24.0/src/tools/ahost.c create mode 100644 lib/c-ares-1.24.0/src/tools/ares_getopt.c rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/src/tools/ares_getopt.h (75%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/CMakeLists.txt (80%) create mode 100644 lib/c-ares-1.24.0/test/Makefile.am create mode 100644 lib/c-ares-1.24.0/test/Makefile.in rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/Makefile.inc (90%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/Makefile.m32 (67%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/Makefile.msvc (94%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/README.md (99%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/aclocal.m4 (99%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0/test}/aminclude_static.am (99%) create mode 100644 lib/c-ares-1.24.0/test/ares-fuzz.c create mode 100644 lib/c-ares-1.24.0/test/ares-test-ai.h create mode 100644 lib/c-ares-1.24.0/test/ares-test-fuzz-name.c create mode 100644 lib/c-ares-1.24.0/test/ares-test-fuzz.c rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-init.cc (79%) create mode 100644 lib/c-ares-1.24.0/test/ares-test-internal.cc rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-live.cc (93%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-main.cc (56%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-misc.cc (76%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-mock-ai.cc (89%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-mock.cc (77%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-ns.cc (89%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-a.cc (85%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-aaaa.cc (79%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-caa.cc (80%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-mx.cc (72%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-naptr.cc (75%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-ns.cc (69%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-ptr.cc (83%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-soa-any.cc (65%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-soa.cc (63%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-srv.cc (84%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-txt.cc (77%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse-uri.cc (84%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test-parse.cc (78%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ares-test.cc (75%) create mode 100644 lib/c-ares-1.24.0/test/ares-test.h create mode 100755 lib/c-ares-1.24.0/test/buildconf rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/compile (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/config.guess (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/config.h.in (93%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/config.sub (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/configure (98%) create mode 100644 lib/c-ares-1.24.0/test/configure.ac rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/depcomp (100%) create mode 100644 lib/c-ares-1.24.0/test/dns-dump.cc rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/dns-proto-test.cc (84%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/dns-proto.cc (82%) create mode 100644 lib/c-ares-1.24.0/test/dns-proto.h rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzcheck.sh (60%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/004a216d3cff18b0c5c6b68b807f1529 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/00539467ca159b36aea95e61f9729115 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/00e846db8f43f2f507cd1666ed5a753e (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/0177b7566f08c013699eaea9a77abeb3 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/020a4fa317715bfdb236ed13751e6b65 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/0310f2e81bea31f4fe3f330872a877dd (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/0449be67df1730b2d0887d412a9b7cc4 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/0449dd14f7aa94bf0d716bfe09b287a8 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/04c93cdf7208979aa4df80a3a0d5a2d8 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/0567e7171e08e75f3f91c4ca74c17adc (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/05ba948578a397e9cbc6a7b3e78622fa (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/060afe5ed25f3e2e86167e545f27edca (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/06d47d3681493f1b1d41236f460d896f (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/0724a810b0e131c2fddb6de9003b9064 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/0b5279148826f5b962bcf1896bdb4ede (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/114048c0f6b10bdc67ce9166405d195e (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/11b8464a0ef8735d202955c34c36b0c7 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/11cb626f1668c7b41954ce7d768fe528 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/14b133bf18125b75a1976fa63a1df6b7 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/153c6b3afa8faa03c8bc28f936a6d4cf (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/182cad2a342ed7317b7c21a5d17020d1 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/1c61a61bb7057b52c5b15188345a5238 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/1dbe2cf62ed2e4fa1c3cb473f08710b5 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/21199be504fcfece5c7096ee0dbba507 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/21891480074b5635dbbe7137bdcabccd (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/233aea42e15aa73e131eefabf16088c9 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/24660d4e7ac7aa21d600ea7a3d198bbb (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/25589deb55c08429345f289d1c9b0254 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/2573bd823e4da11f727a17f8e1f35c26 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/276f12da56866273e76059ad0e7be97e (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/29198a2e380cb19babec9e02116d213e (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/2c94ba9434b1a1b9396fc5364f101363 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/2d578c357dc2f5e02dc55cddb30641d1 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/2dff6cc5a223e67fde9e5e79af456992 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/2f103b1f9477f2d8934bd84328d51c75 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/31cd3a8413de13d9624adbb1613784bf (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/36415bdf1d180098fe6234b4186e69f3 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/3a04a80f0242e8dff0cd732e7c4767da (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/44d0f973b7b0fb3e4a07770c943dcd5a (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/50bc00daa0ddcd6cfb2b5d9f62c81f47 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/51ed2d1fb77b3078b54e94e85606b7df (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/5c5e0e899cf2e7d053a9e45fb76f6e5a (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/70152ed033f139443fbfb1b858bb3b1b (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/7030ca2b24e5a7f9dd8f62096a48eb33 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/71eec1a0ef2d25bb9e2ef17f23be7e9e (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/7a6b0177210ea4ef40b254daf99393c5 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/7f1567733711ffb61839621af0cbfa33 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/850c6d57c5bb7be8205fc2438d14d7e5 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/a5c8cd2784a5792b9e91c2d7895b3b34 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/a9135cdc7151d023300ff194bad90af9 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/af2597e8ac7dec1e8b4a47518312912a (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/answer_a (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/answer_aaaa (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/b3f53ef826b831bb09dd25c7f5960249 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/cda0f8751f5c4993974c2b549d29bcc8 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/ce6c26c0e469339873d0e7f616ab0945 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5637790584012800 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5650695891451904 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5651369832218624 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5674462260756480 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5680630672654336 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5683497160671232 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5687310655422464 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5695341573177344 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5697835103682560 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5728518081609728 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/clusterfuzz-5732960017317888 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/e4dd7e7c2dd4ed7c2e17a6af5d04f9c9 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/ed50ed8ee36230a5a69746ad830437e5 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/f1b900d50806021953321c3b604ee497 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/f6606f624be8c628328cea01d2cd07a9 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/f89f6c8176b564a7dd646f14305573ce (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/f9ad508d2dbd08d3aaaabc7d1174677d (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzzinput/multi-indir (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzznames/name01 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzznames/name02 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzznames/name03 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzznames/name04 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzznames/name05 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzznames/name06 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzznames/name07 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzznames/name08 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/fuzznames/name09 (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/install-sh (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/ltmain.sh (99%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/missing (100%) rename lib/{c-ares-1.19.1 => c-ares-1.24.0}/test/test-driver (100%) diff --git a/cmake/libraries.cmake b/cmake/libraries.cmake index 832d2da6e4a..1b43d523bfa 100644 --- a/cmake/libraries.cmake +++ b/cmake/libraries.cmake @@ -19,7 +19,7 @@ set(FLB_PATH_LIB_ONIGMO "lib/onigmo") set(FLB_PATH_LIB_MPACK "lib/mpack-amalgamation-1.1") set(FLB_PATH_LIB_MINIZ "lib/miniz") set(FLB_PATH_LIB_TUTF8E "lib/tutf8e") -set(FLB_PATH_LIB_CARES "lib/c-ares-1.19.1") +set(FLB_PATH_LIB_CARES "lib/c-ares-1.24.0") set(FLB_PATH_LIB_SNAPPY "lib/snappy-fef67ac") set(FLB_PATH_LIB_RDKAFKA "lib/librdkafka-2.1.0") set(FLB_PATH_LIB_RING_BUFFER "lib/lwrb") diff --git a/lib/c-ares-1.19.1/LICENSE.md b/lib/c-ares-1.19.1/LICENSE.md deleted file mode 100644 index ad6bb52b729..00000000000 --- a/lib/c-ares-1.19.1/LICENSE.md +++ /dev/null @@ -1,15 +0,0 @@ -# c-ares license - -Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS -file. - -Copyright 1998 by the Massachusetts Institute of Technology. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, provided that -the above copyright notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting documentation, and that -the name of M.I.T. not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior permission. -M.I.T. makes no representations about the suitability of this software for any -purpose. It is provided "as is" without express or implied warranty. diff --git a/lib/c-ares-1.19.1/RELEASE-NOTES b/lib/c-ares-1.19.1/RELEASE-NOTES deleted file mode 100644 index 2524f3ccf41..00000000000 --- a/lib/c-ares-1.19.1/RELEASE-NOTES +++ /dev/null @@ -1,57 +0,0 @@ -c-ares version 1.19.1 - -This is a security and bugfix release. - -A special thanks goes out to the Open Source Technology Improvement Fund -(https://ostif.org) for sponsoring a security audit of c-ares performed by X41 -(https://x41-dsec.de). - -Security: - o CVE-2023-32067. High. 0-byte UDP payload causes Denial of Service [12] - o CVE-2023-31147. Moderate. Insufficient randomness in generation of DNS - query IDs [13] - o CVE-2023-31130. Moderate. Buffer Underwrite in ares_inet_net_pton() [14] - o CVE-2023-31124. Low. AutoTools does not set CARES_RANDOM_FILE during cross - compilation [15] - -Bug fixes: - o Fix uninitialized memory warning in test [1] - o Turn off IPV6_V6ONLY on Windows to allow IPv4-mapped IPv6 addresses [2] - o ares_getaddrinfo() should allow a port of 0 [3] - o Fix memory leak in ares_send() on error [4] - o Fix comment style in ares_data.h [5] - o Remove unneeded ifdef for Windows [6] - o Fix typo in ares_init_options.3 [7] - o Re-add support for Watcom compiler [8] - o Sync ax_pthread.m4 with upstream [9] - o Windows: Invalid stack variable used out of scope for HOSTS path [10] - o Sync ax_cxx_compile_stdcxx_11.m4 with upstream to fix uclibc support [11] - -Thanks go to these friendly people for their efforts and contributions: - Brad House (@bradh352) - @Chilledheart - Daniel Stenberg (@bagder) - Douglas R. Reno (@renodr) - Gregor Jasny (@gjasny) - Jay Freeman (@saurik) - @lifenjoiner - Nikolaos Chatzikonstantinou (@createyourpersonalaccount) - Yijie Ma (@yijiem) -(9 contributors) - -References to bug reports and discussions on issues: - [1] = https://github.com/c-ares/c-ares/pull/515 - [2] = https://github.com/c-ares/c-ares/pull/520 - [3] = https://github.com/c-ares/c-ares/issues/517 - [4] = https://github.com/c-ares/c-ares/pull/511 - [5] = https://github.com/c-ares/c-ares/pull/513 - [6] = https://github.com/c-ares/c-ares/pull/512 - [7] = https://github.com/c-ares/c-ares/pull/510 - [8] = https://github.com/c-ares/c-ares/pull/509 - [9] = https://github.com/c-ares/c-ares/pull/507 - [10] = https://github.com/c-ares/c-ares/pull/502 - [11] = https://github.com/c-ares/c-ares/pull/505 - [12] = https://github.com/c-ares/c-ares/security/advisories/GHSA-9g78-jv2r-p7vc - [13] = https://github.com/c-ares/c-ares/security/advisories/GHSA-8r8p-23f3-64c2 - [14] = https://github.com/c-ares/c-ares/security/advisories/GHSA-x6mf-cxr9-8q6v - [15] = https://github.com/c-ares/c-ares/security/advisories/GHSA-54xr-f67r-4pc4 diff --git a/lib/c-ares-1.19.1/TODO b/lib/c-ares-1.19.1/TODO deleted file mode 100644 index fa31cea6fb7..00000000000 --- a/lib/c-ares-1.19.1/TODO +++ /dev/null @@ -1,23 +0,0 @@ -TODO -==== - -ares_reinit() - -- To allow an app to force a re-read of /etc/resolv.conf etc, pretty much - like the res_init() resolver function offers - -ares_gethostbyname - -- When built to support IPv6, it needs to also support PF_UNSPEC or similar, - so that an application can ask for any protocol and then c-ares would return - all known resolves and not just explicitly IPv4 _or_ IPv6 resolves. - -ares_process - -- Upon next ABI breakage ares_process() should be changed to return 'int' - and return ARES_ENOTINITIALIZED if ares_library_init() has not been called. - -ares_process_fd - -- Upon next ABI breakage ares_process_fd() should be changed to return - 'int' and return ARES_ENOTINITIALIZED if library has not been initialized. diff --git a/lib/c-ares-1.19.1/docs/Makefile.am b/lib/c-ares-1.19.1/docs/Makefile.am deleted file mode 100644 index 289445ce49b..00000000000 --- a/lib/c-ares-1.19.1/docs/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -#*************************************************************************** - -########################################################################### - -AUTOMAKE_OPTIONS = foreign subdir-objects no-dependencies - -include Makefile.inc - -man_MANS = $(MANPAGES) - -EXTRA_DIST = $(MANPAGES) ahost.1 adig.1 acountry.1 Makefile.inc CMakeLists.txt diff --git a/lib/c-ares-1.19.1/docs/Makefile.inc b/lib/c-ares-1.19.1/docs/Makefile.inc deleted file mode 100644 index 3aa62aa43b3..00000000000 --- a/lib/c-ares-1.19.1/docs/Makefile.inc +++ /dev/null @@ -1,59 +0,0 @@ -MANPAGES = ares_cancel.3 \ - ares_create_query.3 \ - ares_destroy.3 \ - ares_destroy_options.3 \ - ares_dup.3 \ - ares_expand_name.3 \ - ares_expand_string.3 \ - ares_fds.3 \ - ares_free_data.3 \ - ares_free_hostent.3 \ - ares_free_string.3 \ - ares_freeaddrinfo.3 \ - ares_get_servers.3 \ - ares_get_servers_ports.3 \ - ares_getaddrinfo.3 \ - ares_gethostbyaddr.3 \ - ares_gethostbyname.3 \ - ares_gethostbyname_file.3 \ - ares_getnameinfo.3 \ - ares_getsock.3 \ - ares_inet_ntop.3 \ - ares_inet_pton.3 \ - ares_init.3 \ - ares_init_options.3 \ - ares_library_cleanup.3 \ - ares_library_init.3 \ - ares_library_init_android.3 \ - ares_library_initialized.3 \ - ares_mkquery.3 \ - ares_parse_a_reply.3 \ - ares_parse_aaaa_reply.3 \ - ares_parse_caa_reply.3 \ - ares_parse_mx_reply.3 \ - ares_parse_naptr_reply.3 \ - ares_parse_ns_reply.3 \ - ares_parse_ptr_reply.3 \ - ares_parse_soa_reply.3 \ - ares_parse_srv_reply.3 \ - ares_parse_txt_reply.3 \ - ares_parse_uri_reply.3 \ - ares_process.3 \ - ares_query.3 \ - ares_save_options.3 \ - ares_search.3 \ - ares_send.3 \ - ares_set_local_dev.3 \ - ares_set_local_ip4.3 \ - ares_set_local_ip6.3 \ - ares_set_servers.3 \ - ares_set_servers_csv.3 \ - ares_set_servers_ports.3 \ - ares_set_servers_ports_csv.3 \ - ares_set_socket_callback.3 \ - ares_set_socket_configure_callback.3 \ - ares_set_socket_functions.3 \ - ares_set_sortlist.3 \ - ares_strerror.3 \ - ares_timeout.3 \ - ares_version.3 diff --git a/lib/c-ares-1.19.1/docs/acountry.1 b/lib/c-ares-1.19.1/docs/acountry.1 deleted file mode 100644 index ab5ab3d0223..00000000000 --- a/lib/c-ares-1.19.1/docs/acountry.1 +++ /dev/null @@ -1,54 +0,0 @@ -.TH ACOUNTRY "1" "April 2011" "c-ares utilities" -.SH NAME -acountry \- print the country where an IPv4 address or host is located -.SH SYNOPSIS -.B acountry -[\fIOPTION\fR]... \fIHOST\fR... -.SH DESCRIPTION -.PP -.\" Add any additional description here -.PP -Print the country where HOST (an IPv4 address or hostname) is located, -using the countries.nerd.dk DNS domain to identify the country. -.PP -This utility comes with the \fBc\-ares\fR asynchronous resolver library. -.SH OPTIONS -.TP -\fB\-d\fR -Print some extra debugging output. -.TP -\fB\-h\fR, \fB\-?\fR -Display this help and exit. -.TP -\fB\-v\fR -Be more verbose. Print extra information. -.SH "REPORTING BUGS" -Report bugs to the c-ares mailing list: -.br -\fBhttps://lists.haxx.se/listinfo/c-ares\fR -.SH "SEE ALSO" -.PP -adig(1), ahost(1). -.PP -The DNSBL countries.nerd.dk -.br -\fBhttp://countries.nerd.dk/\fR -.SH COPYRIGHT -This utility is based on code/ideas contained in sofware written by Greg Hudson (ares) -carrying the following notice: -.br -Copyright 1998 by the Massachusetts Institute of Technology. -.br -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of M.I.T. not be used in -advertising or publicity pertaining to distribution of the software -without specific, written prior permission. M.I.T. makes no -representations about the suitability of this software for any -purpose. It is provided "as is" without express or implied warranty. -.br -No further copyright claims are being made by the author(s) of this utility. -.SH AUTHOR -Gisle Vanem diff --git a/lib/c-ares-1.19.1/docs/ares_free_data.3 b/lib/c-ares-1.19.1/docs/ares_free_data.3 deleted file mode 100644 index a6f3938be5c..00000000000 --- a/lib/c-ares-1.19.1/docs/ares_free_data.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" -.\" Copyright 1998 by the Massachusetts Institute of Technology. -.\" Copyright (C) 2004-2010 by Daniel Stenberg -.\" -.\" Permission to use, copy, modify, and distribute this -.\" software and its documentation for any purpose and without -.\" fee is hereby granted, provided that the above copyright -.\" notice appear in all copies and that both that copyright -.\" notice and this permission notice appear in supporting -.\" documentation, and that the name of M.I.T. not be used in -.\" advertising or publicity pertaining to distribution of the -.\" software without specific, written prior permission. -.\" M.I.T. makes no representations about the suitability of -.\" this software for any purpose. It is provided "as is" -.\" without express or implied warranty. -.\" -.TH ARES_FREE_DATA 3 "5 March 2010" -.SH NAME -ares_free_data \- Free data allocated by several c-ares functions -.SH SYNOPSIS -.nf -#include - -void ares_free_data(void *\fIdataptr\fP) -.fi -.SH DESCRIPTION -.PP -The -.B ares_free_data(3) -function frees one or more data structures allocated and returned -by several c-ares functions. Specifically the data returned by the -following list of functions must be deallocated using this function. -.TP 5 -.B ares_get_servers(3) -When used to free the data returned by ares_get_servers(3) this -will free the whole linked list of ares_addr_node structures returned -by ares_get_servers(3). -.TP -.B ares_parse_srv_reply(3) -When used to free the data returned by ares_parse_srv_reply(3) this -will free the whole linked list of ares_srv_reply structures returned -by ares_parse_srv_reply(3), along with any additional storage -associated with those structures. -.TP -.B ares_parse_mx_reply(3) -When used to free the data returned by ares_parse_mx_reply(3) this -will free the whole linked list of ares_mx_reply structures returned -by ares_parse_mx_reply(3), along with any additional storage -associated with those structures. -.TP -.B ares_parse_txt_reply(3) -When used to free the data returned by ares_parse_txt_reply(3) this -will free the whole linked list of ares_txt_reply structures returned -by ares_parse_txt_reply(3), along with any additional storage -associated with those structures. -.TP -.B ares_parse_soa_reply(3) -When used to free the data returned by ares_parse_soa_reply(3) this -will free the ares_soa_reply structure, along with any additional storage -associated with those structure. -.B ares_parse_uri_reply(3) -When used to free the data returned by ares_parse_uri_reply(3) this -will free list of ares_uri_reply structures, along with any additional -storage associated with those structure. -.SH RETURN VALUE -The ares_free_data() function does not return a value. -.SH AVAILABILITY -This function was first introduced in c-ares version 1.7.0. -.SH SEE ALSO -.BR ares_get_servers(3), -.BR ares_parse_srv_reply(3), -.BR ares_parse_mx_reply(3), -.BR ares_parse_txt_reply(3), -.BR ares_parse_soa_reply(3) -.SH AUTHOR -Yang Tse -.PP -Copyright 1998 by the Massachusetts Institute of Technology. -.br -Copyright (C) 2004-2010 by Daniel Stenberg. diff --git a/lib/c-ares-1.19.1/docs/ares_get_servers_ports.3 b/lib/c-ares-1.19.1/docs/ares_get_servers_ports.3 deleted file mode 100644 index 1f5d1f708b7..00000000000 --- a/lib/c-ares-1.19.1/docs/ares_get_servers_ports.3 +++ /dev/null @@ -1 +0,0 @@ -.so man3/ares_get_servers.3 diff --git a/lib/c-ares-1.19.1/docs/ares_init.3 b/lib/c-ares-1.19.1/docs/ares_init.3 deleted file mode 100644 index 0baf4b76fea..00000000000 --- a/lib/c-ares-1.19.1/docs/ares_init.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" -.\" Copyright 1998 by the Massachusetts Institute of Technology. -.\" Copyright (C) 2004-2010 by Daniel Stenberg -.\" -.\" Permission to use, copy, modify, and distribute this -.\" software and its documentation for any purpose and without -.\" fee is hereby granted, provided that the above copyright -.\" notice appear in all copies and that both that copyright -.\" notice and this permission notice appear in supporting -.\" documentation, and that the name of M.I.T. not be used in -.\" advertising or publicity pertaining to distribution of the -.\" software without specific, written prior permission. -.\" M.I.T. makes no representations about the suitability of -.\" this software for any purpose. It is provided "as is" -.\" without express or implied warranty. -.\" -.TH ARES_INIT 3 "5 March 2010" -.SH NAME -ares_init \- Initialize a resolver channel -.SH SYNOPSIS -.nf -#include - -int ares_init(ares_channel *\fIchannelptr\fP) -.fi -.SH DESCRIPTION -The \fBares_init(3)\fP function initializes a communications channel for name -service lookups. If it returns successfully, \fBares_init(3)\fP will set the -variable pointed to by \fIchannelptr\fP to a handle used to identify the name -service channel. The caller should invoke \fIares_destroy(3)\fP on the handle -when the channel is no longer needed. - -The \fIares_init_options(3)\fP function is provide to offer more init -alternatives. -.SH RETURN VALUES -\fIares_init(3)\fP can return any of the following values: -.TP 14 -.B ARES_SUCCESS -Initialization succeeded. -.TP 14 -.B ARES_EFILE -A configuration file could not be read. -.TP 14 -.B ARES_ENOMEM -The process's available memory was exhausted. -.TP 14 -.B ARES_ENOTINITIALIZED -c-ares library initialization not yet performed. -.SH NOTES -When initializing from -.B /etc/resolv.conf, -.BR ares_init (3) -reads the -.I domain -and -.I search -directives to allow lookups of short names relative to the domains -specified. The -.I domain -and -.I search -directives override one another. If more that one instance of either -.I domain -or -.I search -directives is specified, the last occurrence wins. For more information, -please see the -.BR resolv.conf (5) -manual page. -.SH SEE ALSO -.BR ares_init_options(3), -.BR ares_destroy(3), -.BR ares_dup(3), -.BR ares_library_init(3), -.BR ares_set_servers(3) -.SH AUTHOR -Greg Hudson, MIT Information Systems -.br -Copyright 1998 by the Massachusetts Institute of Technology. -.br -Copyright (C) 2004-2010 by Daniel Stenberg. diff --git a/lib/c-ares-1.19.1/docs/ares_set_servers_csv.3 b/lib/c-ares-1.19.1/docs/ares_set_servers_csv.3 deleted file mode 100644 index a729281b978..00000000000 --- a/lib/c-ares-1.19.1/docs/ares_set_servers_csv.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" -.\" Copyright 2010 by Ben Greear -.\" -.\" Permission to use, copy, modify, and distribute this -.\" software and its documentation for any purpose and without -.\" fee is hereby granted, provided that the above copyright -.\" notice appear in all copies and that both that copyright -.\" notice and this permission notice appear in supporting -.\" documentation, and that the name of M.I.T. not be used in -.\" advertising or publicity pertaining to distribution of the -.\" software without specific, written prior permission. -.\" M.I.T. makes no representations about the suitability of -.\" this software for any purpose. It is provided "as is" -.\" without express or implied warranty. -.\" -.TH ARES_SET_SERVERS_CSV 3 "30 June 2010" -.SH NAME -ares_set_servers_csv, ares_set_servers_ports_csv \- Set list of DNS servers to be used. -.SH SYNOPSIS -.nf -#include - -int ares_set_servers_csv(ares_channel \fIchannel\fP, const char* \fIservers\fP) - -int ares_set_servers_ports_csv(ares_channel \fIchannel\fP, const char* \fIservers\fP) -.fi -.SH DESCRIPTION -The \fBares_set_servers_csv\fP and \fBares_set_servers_ports_csv\fPfunctions set -the list of DNS servers that ARES will query. The format of the servers option is: - -host[:port][,host[:port]]... - -For example: - -192.168.1.100,192.168.1.101,3.4.5.6 -.PP -The \fBares_set_servers_csv\fP function will ignore any port values specified in -the input string, whereare the \fBares_set_servers_ports_csv\fP function will -apply any specified port values as the UDP and TCP port to be used for that -particular nameserver. - -.SH RETURN VALUES -.B ares_set_servers_csv(3) -This function may return any of the following values: -.TP 15 -.B ARES_SUCCESS -The name servers configuration was successfully initialized. -.TP 15 -.B ARES_ENOMEM -The process's available memory was exhausted. -.TP 15 -.B ARES_ENODATA -The channel data identified by -.IR channel -was invalid. -.TP 15 -.B ARES_ENOTINITIALIZED -c-ares library initialization not yet performed. -.TP 15 -.B ARES_ENOTIMP -Changing name servers configuration while queries are outstanding is not implemented. -.SH SEE ALSO -.BR ares_set_servers (3) -.SH AVAILABILITY -\fBares_set_servers_csv\fP was added in c-ares 1.7.2; -\fBares_set_servers_ports_csv\fP was added in c-ares 1.11.0. -.SH AUTHOR -Ben Greear diff --git a/lib/c-ares-1.19.1/docs/ares_set_servers_ports.3 b/lib/c-ares-1.19.1/docs/ares_set_servers_ports.3 deleted file mode 100644 index a3be18938e6..00000000000 --- a/lib/c-ares-1.19.1/docs/ares_set_servers_ports.3 +++ /dev/null @@ -1 +0,0 @@ -.so man3/ares_set_servers.3 diff --git a/lib/c-ares-1.19.1/docs/ares_set_servers_ports_csv.3 b/lib/c-ares-1.19.1/docs/ares_set_servers_ports_csv.3 deleted file mode 100644 index 30535c69f10..00000000000 --- a/lib/c-ares-1.19.1/docs/ares_set_servers_ports_csv.3 +++ /dev/null @@ -1 +0,0 @@ -.so man3/ares_set_servers_csv.3 diff --git a/lib/c-ares-1.19.1/include/ares.h b/lib/c-ares-1.19.1/include/ares.h deleted file mode 100644 index 8c7520eec65..00000000000 --- a/lib/c-ares-1.19.1/include/ares.h +++ /dev/null @@ -1,764 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2007-2013 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#ifndef ARES__H -#define ARES__H - -#include "ares_version.h" /* c-ares version defines */ -#include "ares_build.h" /* c-ares build definitions */ -#include "ares_rules.h" /* c-ares rules enforcement */ - -/* - * Define WIN32 when build target is Win32 API - */ - -#if (defined(_WIN32) || defined(__WIN32__)) && \ - !defined(WIN32) && !defined(__SYMBIAN32__) -# define WIN32 -#endif - -#include - -/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish - libc5-based Linux systems. Only include it on system that are known to - require it! */ -#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ - defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ - defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ - defined(__QNXNTO__) || defined(__MVS__) || defined(__HAIKU__) -#include -#endif -#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) -#include -#endif - -#if defined(WATT32) -# include -# include -# include -#elif defined(_WIN32_WCE) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include -# include -#elif defined(WIN32) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include -# include -# include -/* To aid with linking against a static c-ares build, lets tell the microsoft - * compiler to pull in needed dependencies */ -# ifdef _MSC_VER -# pragma comment(lib, "ws2_32") -# pragma comment(lib, "advapi32") -# pragma comment(lib, "iphlpapi") -# endif -#else -# include -# include -#endif - -#if defined(ANDROID) || defined(__ANDROID__) -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** c-ares external API function linkage decorations. -*/ - -#ifdef CARES_STATICLIB -# define CARES_EXTERN -#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) -# if defined(CARES_BUILDING_LIBRARY) -# define CARES_EXTERN __declspec(dllexport) -# else -# define CARES_EXTERN __declspec(dllimport) -# endif -#elif defined(CARES_BUILDING_LIBRARY) && defined(CARES_SYMBOL_HIDING) -# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN -#else -# define CARES_EXTERN -#endif - - -#define ARES_SUCCESS 0 - -/* Server error codes (ARES_ENODATA indicates no relevant answer) */ -#define ARES_ENODATA 1 -#define ARES_EFORMERR 2 -#define ARES_ESERVFAIL 3 -#define ARES_ENOTFOUND 4 -#define ARES_ENOTIMP 5 -#define ARES_EREFUSED 6 - -/* Locally generated error codes */ -#define ARES_EBADQUERY 7 -#define ARES_EBADNAME 8 -#define ARES_EBADFAMILY 9 -#define ARES_EBADRESP 10 -#define ARES_ECONNREFUSED 11 -#define ARES_ETIMEOUT 12 -#define ARES_EOF 13 -#define ARES_EFILE 14 -#define ARES_ENOMEM 15 -#define ARES_EDESTRUCTION 16 -#define ARES_EBADSTR 17 - -/* ares_getnameinfo error codes */ -#define ARES_EBADFLAGS 18 - -/* ares_getaddrinfo error codes */ -#define ARES_ENONAME 19 -#define ARES_EBADHINTS 20 - -/* Uninitialized library error code */ -#define ARES_ENOTINITIALIZED 21 /* introduced in 1.7.0 */ - -/* ares_library_init error codes */ -#define ARES_ELOADIPHLPAPI 22 /* introduced in 1.7.0 */ -#define ARES_EADDRGETNETWORKPARAMS 23 /* introduced in 1.7.0 */ - -/* More error codes */ -#define ARES_ECANCELLED 24 /* introduced in 1.7.0 */ - -/* More ares_getaddrinfo error codes */ -#define ARES_ESERVICE 25 /* introduced in 1.?.0 */ - -/* Flag values */ -#define ARES_FLAG_USEVC (1 << 0) -#define ARES_FLAG_PRIMARY (1 << 1) -#define ARES_FLAG_IGNTC (1 << 2) -#define ARES_FLAG_NORECURSE (1 << 3) -#define ARES_FLAG_STAYOPEN (1 << 4) -#define ARES_FLAG_NOSEARCH (1 << 5) -#define ARES_FLAG_NOALIASES (1 << 6) -#define ARES_FLAG_NOCHECKRESP (1 << 7) -#define ARES_FLAG_EDNS (1 << 8) - -/* Option mask values */ -#define ARES_OPT_FLAGS (1 << 0) -#define ARES_OPT_TIMEOUT (1 << 1) -#define ARES_OPT_TRIES (1 << 2) -#define ARES_OPT_NDOTS (1 << 3) -#define ARES_OPT_UDP_PORT (1 << 4) -#define ARES_OPT_TCP_PORT (1 << 5) -#define ARES_OPT_SERVERS (1 << 6) -#define ARES_OPT_DOMAINS (1 << 7) -#define ARES_OPT_LOOKUPS (1 << 8) -#define ARES_OPT_SOCK_STATE_CB (1 << 9) -#define ARES_OPT_SORTLIST (1 << 10) -#define ARES_OPT_SOCK_SNDBUF (1 << 11) -#define ARES_OPT_SOCK_RCVBUF (1 << 12) -#define ARES_OPT_TIMEOUTMS (1 << 13) -#define ARES_OPT_ROTATE (1 << 14) -#define ARES_OPT_EDNSPSZ (1 << 15) -#define ARES_OPT_NOROTATE (1 << 16) -#define ARES_OPT_RESOLVCONF (1 << 17) -#define ARES_OPT_HOSTS_FILE (1 << 18) - -/* Nameinfo flag values */ -#define ARES_NI_NOFQDN (1 << 0) -#define ARES_NI_NUMERICHOST (1 << 1) -#define ARES_NI_NAMEREQD (1 << 2) -#define ARES_NI_NUMERICSERV (1 << 3) -#define ARES_NI_DGRAM (1 << 4) -#define ARES_NI_TCP 0 -#define ARES_NI_UDP ARES_NI_DGRAM -#define ARES_NI_SCTP (1 << 5) -#define ARES_NI_DCCP (1 << 6) -#define ARES_NI_NUMERICSCOPE (1 << 7) -#define ARES_NI_LOOKUPHOST (1 << 8) -#define ARES_NI_LOOKUPSERVICE (1 << 9) -/* Reserved for future use */ -#define ARES_NI_IDN (1 << 10) -#define ARES_NI_IDN_ALLOW_UNASSIGNED (1 << 11) -#define ARES_NI_IDN_USE_STD3_ASCII_RULES (1 << 12) - -/* Addrinfo flag values */ -#define ARES_AI_CANONNAME (1 << 0) -#define ARES_AI_NUMERICHOST (1 << 1) -#define ARES_AI_PASSIVE (1 << 2) -#define ARES_AI_NUMERICSERV (1 << 3) -#define ARES_AI_V4MAPPED (1 << 4) -#define ARES_AI_ALL (1 << 5) -#define ARES_AI_ADDRCONFIG (1 << 6) -#define ARES_AI_NOSORT (1 << 7) -#define ARES_AI_ENVHOSTS (1 << 8) -/* Reserved for future use */ -#define ARES_AI_IDN (1 << 10) -#define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11) -#define ARES_AI_IDN_USE_STD3_ASCII_RULES (1 << 12) -#define ARES_AI_CANONIDN (1 << 13) - -#define ARES_AI_MASK (ARES_AI_CANONNAME|ARES_AI_NUMERICHOST|ARES_AI_PASSIVE| \ - ARES_AI_NUMERICSERV|ARES_AI_V4MAPPED|ARES_AI_ALL| \ - ARES_AI_ADDRCONFIG) -#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about this - many sockets */ -#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num))) -#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \ - ARES_GETSOCK_MAXNUM))) - -/* c-ares library initialization flag values */ -#define ARES_LIB_INIT_NONE (0) -#define ARES_LIB_INIT_WIN32 (1 << 0) -#define ARES_LIB_INIT_ALL (ARES_LIB_INIT_WIN32) - - -/* - * Typedef our socket type - */ - -#ifndef ares_socket_typedef -#ifdef WIN32 -typedef SOCKET ares_socket_t; -#define ARES_SOCKET_BAD INVALID_SOCKET -#else -typedef int ares_socket_t; -#define ARES_SOCKET_BAD -1 -#endif -#define ares_socket_typedef -#endif /* ares_socket_typedef */ - -typedef void (*ares_sock_state_cb)(void *data, - ares_socket_t socket_fd, - int readable, - int writable); - -struct apattern; - -/* NOTE about the ares_options struct to users and developers. - - This struct will remain looking like this. It will not be extended nor - shrunk in future releases, but all new options will be set by ares_set_*() - options instead of with the ares_init_options() function. - - Eventually (in a galaxy far far away), all options will be settable by - ares_set_*() options and the ares_init_options() function will become - deprecated. - - When new options are added to c-ares, they are not added to this - struct. And they are not "saved" with the ares_save_options() function but - instead we encourage the use of the ares_dup() function. Needless to say, - if you add config options to c-ares you need to make sure ares_dup() - duplicates this new option. - - */ -struct ares_options { - int flags; - int timeout; /* in seconds or milliseconds, depending on options */ - int tries; - int ndots; - unsigned short udp_port; - unsigned short tcp_port; - int socket_send_buffer_size; - int socket_receive_buffer_size; - struct in_addr *servers; - int nservers; - char **domains; - int ndomains; - char *lookups; - ares_sock_state_cb sock_state_cb; - void *sock_state_cb_data; - struct apattern *sortlist; - int nsort; - int ednspsz; - char *resolvconf_path; - char *hosts_path; -}; - -struct hostent; -struct timeval; -struct sockaddr; -struct ares_channeldata; -struct ares_addrinfo; -struct ares_addrinfo_hints; - -typedef struct ares_channeldata *ares_channel; - -typedef void (*ares_callback)(void *arg, - int status, - int timeouts, - unsigned char *abuf, - int alen); - -typedef void (*ares_host_callback)(void *arg, - int status, - int timeouts, - struct hostent *hostent); - -typedef void (*ares_nameinfo_callback)(void *arg, - int status, - int timeouts, - char *node, - char *service); - -typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd, - int type, - void *data); - -typedef int (*ares_sock_config_callback)(ares_socket_t socket_fd, - int type, - void *data); - -typedef void (*ares_addrinfo_callback)(void *arg, - int status, - int timeouts, - struct ares_addrinfo *res); - -CARES_EXTERN int ares_library_init(int flags); - -CARES_EXTERN int ares_library_init_mem(int flags, - void *(*amalloc)(size_t size), - void (*afree)(void *ptr), - void *(*arealloc)(void *ptr, size_t size)); - -#if defined(ANDROID) || defined(__ANDROID__) -CARES_EXTERN void ares_library_init_jvm(JavaVM *jvm); -CARES_EXTERN int ares_library_init_android(jobject connectivity_manager); -CARES_EXTERN int ares_library_android_initialized(void); -#endif - -CARES_EXTERN int ares_library_initialized(void); - -CARES_EXTERN void ares_library_cleanup(void); - -CARES_EXTERN const char *ares_version(int *version); - -CARES_EXTERN int ares_init(ares_channel *channelptr); - -CARES_EXTERN int ares_init_options(ares_channel *channelptr, - struct ares_options *options, - int optmask); - -CARES_EXTERN int ares_save_options(ares_channel channel, - struct ares_options *options, - int *optmask); - -CARES_EXTERN void ares_destroy_options(struct ares_options *options); - -CARES_EXTERN int ares_dup(ares_channel *dest, - ares_channel src); - -CARES_EXTERN void ares_destroy(ares_channel channel); - -CARES_EXTERN void ares_cancel(ares_channel channel); - -/* These next 3 configure local binding for the out-going socket - * connection. Use these to specify source IP and/or network device - * on multi-homed systems. - */ -CARES_EXTERN void ares_set_local_ip4(ares_channel channel, unsigned int local_ip); - -/* local_ip6 should be 16 bytes in length */ -CARES_EXTERN void ares_set_local_ip6(ares_channel channel, - const unsigned char* local_ip6); - -/* local_dev_name should be null terminated. */ -CARES_EXTERN void ares_set_local_dev(ares_channel channel, - const char* local_dev_name); - -CARES_EXTERN void ares_set_socket_callback(ares_channel channel, - ares_sock_create_callback callback, - void *user_data); - -CARES_EXTERN void ares_set_socket_configure_callback(ares_channel channel, - ares_sock_config_callback callback, - void *user_data); - -CARES_EXTERN int ares_set_sortlist(ares_channel channel, - const char *sortstr); - -CARES_EXTERN void ares_getaddrinfo(ares_channel channel, - const char* node, - const char* service, - const struct ares_addrinfo_hints* hints, - ares_addrinfo_callback callback, - void* arg); - -CARES_EXTERN void ares_freeaddrinfo(struct ares_addrinfo* ai); - -/* - * Virtual function set to have user-managed socket IO. - * Note that all functions need to be defined, and when - * set, the library will not do any bind nor set any - * socket options, assuming the client handles these - * through either socket creation or the - * ares_sock_config_callback call. - */ -struct iovec; -struct ares_socket_functions { - ares_socket_t(*asocket)(int, int, int, void *); - int(*aclose)(ares_socket_t, void *); - int(*aconnect)(ares_socket_t, const struct sockaddr *, ares_socklen_t, void *); - ares_ssize_t(*arecvfrom)(ares_socket_t, void *, size_t, int, struct sockaddr *, ares_socklen_t *, void *); - ares_ssize_t(*asendv)(ares_socket_t, const struct iovec *, int, void *); -}; - -CARES_EXTERN void ares_set_socket_functions(ares_channel channel, - const struct ares_socket_functions * funcs, - void *user_data); - -CARES_EXTERN void ares_send(ares_channel channel, - const unsigned char *qbuf, - int qlen, - ares_callback callback, - void *arg); - -CARES_EXTERN void ares_query(ares_channel channel, - const char *name, - int dnsclass, - int type, - ares_callback callback, - void *arg); - -CARES_EXTERN void ares_search(ares_channel channel, - const char *name, - int dnsclass, - int type, - ares_callback callback, - void *arg); - -CARES_EXTERN void ares_gethostbyname(ares_channel channel, - const char *name, - int family, - ares_host_callback callback, - void *arg); - -CARES_EXTERN int ares_gethostbyname_file(ares_channel channel, - const char *name, - int family, - struct hostent **host); - -CARES_EXTERN void ares_gethostbyaddr(ares_channel channel, - const void *addr, - int addrlen, - int family, - ares_host_callback callback, - void *arg); - -CARES_EXTERN void ares_getnameinfo(ares_channel channel, - const struct sockaddr *sa, - ares_socklen_t salen, - int flags, - ares_nameinfo_callback callback, - void *arg); - -CARES_EXTERN int ares_fds(ares_channel channel, - fd_set *read_fds, - fd_set *write_fds); - -CARES_EXTERN int ares_getsock(ares_channel channel, - ares_socket_t *socks, - int numsocks); - -CARES_EXTERN struct timeval *ares_timeout(ares_channel channel, - struct timeval *maxtv, - struct timeval *tv); - -CARES_EXTERN void ares_process(ares_channel channel, - fd_set *read_fds, - fd_set *write_fds); - -CARES_EXTERN void ares_process_fd(ares_channel channel, - ares_socket_t read_fd, - ares_socket_t write_fd); - -CARES_EXTERN int ares_create_query(const char *name, - int dnsclass, - int type, - unsigned short id, - int rd, - unsigned char **buf, - int *buflen, - int max_udp_size); - -CARES_EXTERN int ares_mkquery(const char *name, - int dnsclass, - int type, - unsigned short id, - int rd, - unsigned char **buf, - int *buflen); - -CARES_EXTERN int ares_expand_name(const unsigned char *encoded, - const unsigned char *abuf, - int alen, - char **s, - long *enclen); - -CARES_EXTERN int ares_expand_string(const unsigned char *encoded, - const unsigned char *abuf, - int alen, - unsigned char **s, - long *enclen); - -/* - * NOTE: before c-ares 1.7.0 we would most often use the system in6_addr - * struct below when ares itself was built, but many apps would use this - * private version since the header checked a HAVE_* define for it. Starting - * with 1.7.0 we always declare and use our own to stop relying on the - * system's one. - */ -struct ares_in6_addr { - union { - unsigned char _S6_u8[16]; - } _S6_un; -}; - -struct ares_addrttl { - struct in_addr ipaddr; - int ttl; -}; - -struct ares_addr6ttl { - struct ares_in6_addr ip6addr; - int ttl; -}; - -struct ares_caa_reply { - struct ares_caa_reply *next; - int critical; - unsigned char *property; - size_t plength; /* plength excludes null termination */ - unsigned char *value; - size_t length; /* length excludes null termination */ -}; - -struct ares_srv_reply { - struct ares_srv_reply *next; - char *host; - unsigned short priority; - unsigned short weight; - unsigned short port; -}; - -struct ares_mx_reply { - struct ares_mx_reply *next; - char *host; - unsigned short priority; -}; - -struct ares_txt_reply { - struct ares_txt_reply *next; - unsigned char *txt; - size_t length; /* length excludes null termination */ -}; - -/* NOTE: This structure is a superset of ares_txt_reply - */ -struct ares_txt_ext { - struct ares_txt_ext *next; - unsigned char *txt; - size_t length; - /* 1 - if start of new record - * 0 - if a chunk in the same record */ - unsigned char record_start; -}; - -struct ares_naptr_reply { - struct ares_naptr_reply *next; - unsigned char *flags; - unsigned char *service; - unsigned char *regexp; - char *replacement; - unsigned short order; - unsigned short preference; -}; - -struct ares_soa_reply { - char *nsname; - char *hostmaster; - unsigned int serial; - unsigned int refresh; - unsigned int retry; - unsigned int expire; - unsigned int minttl; -}; - -struct ares_uri_reply { - struct ares_uri_reply *next; - unsigned short priority; - unsigned short weight; - char *uri; - int ttl; -}; - -/* - * Similar to addrinfo, but with extra ttl and missing canonname. - */ -struct ares_addrinfo_node { - int ai_ttl; - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - ares_socklen_t ai_addrlen; - struct sockaddr *ai_addr; - struct ares_addrinfo_node *ai_next; -}; - -/* - * alias - label of the resource record. - * name - value (canonical name) of the resource record. - * See RFC2181 10.1.1. CNAME terminology. - */ -struct ares_addrinfo_cname { - int ttl; - char *alias; - char *name; - struct ares_addrinfo_cname *next; -}; - -struct ares_addrinfo { - struct ares_addrinfo_cname *cnames; - struct ares_addrinfo_node *nodes; - char *name; -}; - -struct ares_addrinfo_hints { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; -}; - -/* -** Parse the buffer, starting at *abuf and of length alen bytes, previously -** obtained from an ares_search call. Put the results in *host, if nonnull. -** Also, if addrttls is nonnull, put up to *naddrttls IPv4 addresses along with -** their TTLs in that array, and set *naddrttls to the number of addresses -** so written. -*/ - -CARES_EXTERN int ares_parse_a_reply(const unsigned char *abuf, - int alen, - struct hostent **host, - struct ares_addrttl *addrttls, - int *naddrttls); - -CARES_EXTERN int ares_parse_aaaa_reply(const unsigned char *abuf, - int alen, - struct hostent **host, - struct ares_addr6ttl *addrttls, - int *naddrttls); - -CARES_EXTERN int ares_parse_caa_reply(const unsigned char* abuf, - int alen, - struct ares_caa_reply** caa_out); - -CARES_EXTERN int ares_parse_ptr_reply(const unsigned char *abuf, - int alen, - const void *addr, - int addrlen, - int family, - struct hostent **host); - -CARES_EXTERN int ares_parse_ns_reply(const unsigned char *abuf, - int alen, - struct hostent **host); - -CARES_EXTERN int ares_parse_srv_reply(const unsigned char* abuf, - int alen, - struct ares_srv_reply** srv_out); - -CARES_EXTERN int ares_parse_mx_reply(const unsigned char* abuf, - int alen, - struct ares_mx_reply** mx_out); - -CARES_EXTERN int ares_parse_txt_reply(const unsigned char* abuf, - int alen, - struct ares_txt_reply** txt_out); - -CARES_EXTERN int ares_parse_txt_reply_ext(const unsigned char* abuf, - int alen, - struct ares_txt_ext** txt_out); - -CARES_EXTERN int ares_parse_naptr_reply(const unsigned char* abuf, - int alen, - struct ares_naptr_reply** naptr_out); - -CARES_EXTERN int ares_parse_soa_reply(const unsigned char* abuf, - int alen, - struct ares_soa_reply** soa_out); - -CARES_EXTERN int ares_parse_uri_reply(const unsigned char* abuf, - int alen, - struct ares_uri_reply** uri_out); - -CARES_EXTERN void ares_free_string(void *str); - -CARES_EXTERN void ares_free_hostent(struct hostent *host); - -CARES_EXTERN void ares_free_data(void *dataptr); - -CARES_EXTERN const char *ares_strerror(int code); - -struct ares_addr_node { - struct ares_addr_node *next; - int family; - union { - struct in_addr addr4; - struct ares_in6_addr addr6; - } addr; -}; - -struct ares_addr_port_node { - struct ares_addr_port_node *next; - int family; - union { - struct in_addr addr4; - struct ares_in6_addr addr6; - } addr; - int udp_port; - int tcp_port; -}; - -CARES_EXTERN int ares_set_servers(ares_channel channel, - struct ares_addr_node *servers); -CARES_EXTERN int ares_set_servers_ports(ares_channel channel, - struct ares_addr_port_node *servers); - -/* Incomming string format: host[:port][,host[:port]]... */ -CARES_EXTERN int ares_set_servers_csv(ares_channel channel, - const char* servers); -CARES_EXTERN int ares_set_servers_ports_csv(ares_channel channel, - const char* servers); - -CARES_EXTERN int ares_get_servers(ares_channel channel, - struct ares_addr_node **servers); -CARES_EXTERN int ares_get_servers_ports(ares_channel channel, - struct ares_addr_port_node **servers); - -CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst, - ares_socklen_t size); - -CARES_EXTERN int ares_inet_pton(int af, const char *src, void *dst); - - -#ifdef __cplusplus -} -#endif - -#endif /* ARES__H */ diff --git a/lib/c-ares-1.19.1/include/ares_dns.h b/lib/c-ares-1.19.1/include/ares_dns.h deleted file mode 100644 index bc8aa7b1091..00000000000 --- a/lib/c-ares-1.19.1/include/ares_dns.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef HEADER_CARES_DNS_H -#define HEADER_CARES_DNS_H - -/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -/* - * NOTE TO INTEGRATORS: - * - * This header is made public due to legacy projects relying on it. - * Please do not use the macros within this header, or include this - * header in your project as it may be removed in the future. - */ - - -/* - * Macro DNS__16BIT reads a network short (16 bit) given in network - * byte order, and returns its value as an unsigned short. - */ -#define DNS__16BIT(p) ((unsigned short)((unsigned int) 0xffff & \ - (((unsigned int)((unsigned char)(p)[0]) << 8U) | \ - ((unsigned int)((unsigned char)(p)[1]))))) - -/* - * Macro DNS__32BIT reads a network long (32 bit) given in network - * byte order, and returns its value as an unsigned int. - */ -#define DNS__32BIT(p) ((unsigned int) \ - (((unsigned int)((unsigned char)(p)[0]) << 24U) | \ - ((unsigned int)((unsigned char)(p)[1]) << 16U) | \ - ((unsigned int)((unsigned char)(p)[2]) << 8U) | \ - ((unsigned int)((unsigned char)(p)[3])))) - -#define DNS__SET16BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 8) & 0xff)), \ - ((p)[1] = (unsigned char)((v) & 0xff))) -#define DNS__SET32BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 24) & 0xff)), \ - ((p)[1] = (unsigned char)(((v) >> 16) & 0xff)), \ - ((p)[2] = (unsigned char)(((v) >> 8) & 0xff)), \ - ((p)[3] = (unsigned char)((v) & 0xff))) - -#if 0 -/* we cannot use this approach on systems where we can't access 16/32 bit - data on un-aligned addresses */ -#define DNS__16BIT(p) ntohs(*(unsigned short*)(p)) -#define DNS__32BIT(p) ntohl(*(unsigned long*)(p)) -#define DNS__SET16BIT(p, v) *(unsigned short*)(p) = htons(v) -#define DNS__SET32BIT(p, v) *(unsigned long*)(p) = htonl(v) -#endif - -/* Macros for parsing a DNS header */ -#define DNS_HEADER_QID(h) DNS__16BIT(h) -#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1) -#define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf) -#define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1) -#define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1) -#define DNS_HEADER_RD(h) ((h)[2] & 0x1) -#define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1) -#define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7) -#define DNS_HEADER_RCODE(h) ((h)[3] & 0xf) -#define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4) -#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6) -#define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8) -#define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10) - -/* Macros for constructing a DNS header */ -#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v) -#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 7)) -#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (unsigned char)(((v) & 0xf) << 3)) -#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 2)) -#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 1)) -#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (unsigned char)((v) & 0x1)) -#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (unsigned char)(((v) & 0x1) << 7)) -#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (unsigned char)(((v) & 0x7) << 4)) -#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (unsigned char)((v) & 0xf)) -#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v) -#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v) -#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v) -#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v) - -/* Macros for parsing the fixed part of a DNS question */ -#define DNS_QUESTION_TYPE(q) DNS__16BIT(q) -#define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2) - -/* Macros for constructing the fixed part of a DNS question */ -#define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v) -#define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v) - -/* Macros for parsing the fixed part of a DNS resource record */ -#define DNS_RR_TYPE(r) DNS__16BIT(r) -#define DNS_RR_CLASS(r) DNS__16BIT((r) + 2) -#define DNS_RR_TTL(r) DNS__32BIT((r) + 4) -#define DNS_RR_LEN(r) DNS__16BIT((r) + 8) - -/* Macros for constructing the fixed part of a DNS resource record */ -#define DNS_RR_SET_TYPE(r, v) DNS__SET16BIT(r, v) -#define DNS_RR_SET_CLASS(r, v) DNS__SET16BIT((r) + 2, v) -#define DNS_RR_SET_TTL(r, v) DNS__SET32BIT((r) + 4, v) -#define DNS_RR_SET_LEN(r, v) DNS__SET16BIT((r) + 8, v) - -#endif /* HEADER_CARES_DNS_H */ diff --git a/lib/c-ares-1.19.1/include/ares_nameser.h b/lib/c-ares-1.19.1/include/ares_nameser.h deleted file mode 100644 index 18a9e5ac0e2..00000000000 --- a/lib/c-ares-1.19.1/include/ares_nameser.h +++ /dev/null @@ -1,484 +0,0 @@ - -#ifndef ARES_NAMESER_H -#define ARES_NAMESER_H - -#include "ares_build.h" - -#ifdef CARES_HAVE_ARPA_NAMESER_H -# include -#endif -#ifdef CARES_HAVE_ARPA_NAMESER_COMPAT_H -# include -#endif - -/* ============================================================================ - * arpa/nameser.h may or may not provide ALL of the below defines, so check - * each one individually and set if not - * ============================================================================ - */ - -#ifndef NS_PACKETSZ -# define NS_PACKETSZ 512 /* maximum packet size */ -#endif - -#ifndef NS_MAXDNAME -# define NS_MAXDNAME 256 /* maximum domain name */ -#endif - -#ifndef NS_MAXCDNAME -# define NS_MAXCDNAME 255 /* maximum compressed domain name */ -#endif - -#ifndef NS_MAXLABEL -# define NS_MAXLABEL 63 -#endif - -#ifndef NS_HFIXEDSZ -# define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ -#endif - -#ifndef NS_QFIXEDSZ -# define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ -#endif - -#ifndef NS_RRFIXEDSZ -# define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ -#endif - -#ifndef NS_INT16SZ -# define NS_INT16SZ 2 -#endif - -#ifndef NS_INADDRSZ -# define NS_INADDRSZ 4 -#endif - -#ifndef NS_IN6ADDRSZ -# define NS_IN6ADDRSZ 16 -#endif - -#ifndef NS_CMPRSFLGS -# define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ -#endif - -#ifndef NS_DEFAULTPORT -# define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ -#endif - -/* ============================================================================ - * arpa/nameser.h should provide these enumerations always, so if not found, - * provide them - * ============================================================================ - */ -#ifndef CARES_HAVE_ARPA_NAMESER_H - -typedef enum __ns_class { - ns_c_invalid = 0, /* Cookie. */ - ns_c_in = 1, /* Internet. */ - ns_c_2 = 2, /* unallocated/unsupported. */ - ns_c_chaos = 3, /* MIT Chaos-net. */ - ns_c_hs = 4, /* MIT Hesiod. */ - /* Query class values which do not appear in resource records */ - ns_c_none = 254, /* for prereq. sections in update requests */ - ns_c_any = 255, /* Wildcard match. */ - ns_c_max = 65536 -} ns_class; - -typedef enum __ns_type { - ns_t_invalid = 0, /* Cookie. */ - ns_t_a = 1, /* Host address. */ - ns_t_ns = 2, /* Authoritative server. */ - ns_t_md = 3, /* Mail destination. */ - ns_t_mf = 4, /* Mail forwarder. */ - ns_t_cname = 5, /* Canonical name. */ - ns_t_soa = 6, /* Start of authority zone. */ - ns_t_mb = 7, /* Mailbox domain name. */ - ns_t_mg = 8, /* Mail group member. */ - ns_t_mr = 9, /* Mail rename name. */ - ns_t_null = 10, /* Null resource record. */ - ns_t_wks = 11, /* Well known service. */ - ns_t_ptr = 12, /* Domain name pointer. */ - ns_t_hinfo = 13, /* Host information. */ - ns_t_minfo = 14, /* Mailbox information. */ - ns_t_mx = 15, /* Mail routing information. */ - ns_t_txt = 16, /* Text strings. */ - ns_t_rp = 17, /* Responsible person. */ - ns_t_afsdb = 18, /* AFS cell database. */ - ns_t_x25 = 19, /* X_25 calling address. */ - ns_t_isdn = 20, /* ISDN calling address. */ - ns_t_rt = 21, /* Router. */ - ns_t_nsap = 22, /* NSAP address. */ - ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ - ns_t_sig = 24, /* Security signature. */ - ns_t_key = 25, /* Security key. */ - ns_t_px = 26, /* X.400 mail mapping. */ - ns_t_gpos = 27, /* Geographical position (withdrawn). */ - ns_t_aaaa = 28, /* Ip6 Address. */ - ns_t_loc = 29, /* Location Information. */ - ns_t_nxt = 30, /* Next domain (security). */ - ns_t_eid = 31, /* Endpoint identifier. */ - ns_t_nimloc = 32, /* Nimrod Locator. */ - ns_t_srv = 33, /* Server Selection. */ - ns_t_atma = 34, /* ATM Address */ - ns_t_naptr = 35, /* Naming Authority PoinTeR */ - ns_t_kx = 36, /* Key Exchange */ - ns_t_cert = 37, /* Certification record */ - ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ - ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ - ns_t_sink = 40, /* Kitchen sink (experimentatl) */ - ns_t_opt = 41, /* EDNS0 option (meta-RR) */ - ns_t_apl = 42, /* Address prefix list (RFC3123) */ - ns_t_ds = 43, /* Delegation Signer (RFC4034) */ - ns_t_sshfp = 44, /* SSH Key Fingerprint (RFC4255) */ - ns_t_rrsig = 46, /* Resource Record Signature (RFC4034) */ - ns_t_nsec = 47, /* Next Secure (RFC4034) */ - ns_t_dnskey = 48, /* DNS Public Key (RFC4034) */ - ns_t_tkey = 249, /* Transaction key */ - ns_t_tsig = 250, /* Transaction signature. */ - ns_t_ixfr = 251, /* Incremental zone transfer. */ - ns_t_axfr = 252, /* Transfer zone of authority. */ - ns_t_mailb = 253, /* Transfer mailbox records. */ - ns_t_maila = 254, /* Transfer mail agent records. */ - ns_t_any = 255, /* Wildcard match. */ - ns_t_uri = 256, /* Uniform Resource Identifier (RFC7553) */ - ns_t_caa = 257, /* Certification Authority Authorization. */ - ns_t_max = 65536 -} ns_type; - -typedef enum __ns_opcode { - ns_o_query = 0, /* Standard query. */ - ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ - ns_o_status = 2, /* Name server status query (unsupported). */ - /* Opcode 3 is undefined/reserved. */ - ns_o_notify = 4, /* Zone change notification. */ - ns_o_update = 5, /* Zone update message. */ - ns_o_max = 6 -} ns_opcode; - -typedef enum __ns_rcode { - ns_r_noerror = 0, /* No error occurred. */ - ns_r_formerr = 1, /* Format error. */ - ns_r_servfail = 2, /* Server failure. */ - ns_r_nxdomain = 3, /* Name error. */ - ns_r_notimpl = 4, /* Unimplemented. */ - ns_r_refused = 5, /* Operation refused. */ - /* these are for BIND_UPDATE */ - ns_r_yxdomain = 6, /* Name exists */ - ns_r_yxrrset = 7, /* RRset exists */ - ns_r_nxrrset = 8, /* RRset does not exist */ - ns_r_notauth = 9, /* Not authoritative for zone */ - ns_r_notzone = 10, /* Zone of record different from zone section */ - ns_r_max = 11, - /* The following are TSIG extended errors */ - ns_r_badsig = 16, - ns_r_badkey = 17, - ns_r_badtime = 18 -} ns_rcode; - -#endif /* CARES_HAVE_ARPA_NAMESER_H */ - - -/* ============================================================================ - * arpa/nameser_compat.h typically sets these. However on some systems - * arpa/nameser.h does, but may not set all of them. Lets conditionally - * define each - * ============================================================================ - */ - -#ifndef PACKETSZ -# define PACKETSZ NS_PACKETSZ -#endif - -#ifndef MAXDNAME -# define MAXDNAME NS_MAXDNAME -#endif - -#ifndef MAXCDNAME -# define MAXCDNAME NS_MAXCDNAME -#endif - -#ifndef MAXLABEL -# define MAXLABEL NS_MAXLABEL -#endif - -#ifndef HFIXEDSZ -# define HFIXEDSZ NS_HFIXEDSZ -#endif - -#ifndef QFIXEDSZ -# define QFIXEDSZ NS_QFIXEDSZ -#endif - -#ifndef RRFIXEDSZ -# define RRFIXEDSZ NS_RRFIXEDSZ -#endif - -#ifndef INDIR_MASK -# define INDIR_MASK NS_CMPRSFLGS -#endif - -#ifndef NAMESERVER_PORT -# define NAMESERVER_PORT NS_DEFAULTPORT -#endif - - -/* opcodes */ -#ifndef O_QUERY -# define O_QUERY 0 /* ns_o_query */ -#endif -#ifndef O_IQUERY -# define O_IQUERY 1 /* ns_o_iquery */ -#endif -#ifndef O_STATUS -# define O_STATUS 2 /* ns_o_status */ -#endif -#ifndef O_NOTIFY -# define O_NOTIFY 4 /* ns_o_notify */ -#endif -#ifndef O_UPDATE -# define O_UPDATE 5 /* ns_o_update */ -#endif - - -/* response codes */ -#ifndef SERVFAIL -# define SERVFAIL ns_r_servfail -#endif -#ifndef NOTIMP -# define NOTIMP ns_r_notimpl -#endif -#ifndef REFUSED -# define REFUSED ns_r_refused -#endif -#if defined(_WIN32) && !defined(HAVE_ARPA_NAMESER_COMPAT_H) && defined(NOERROR) -# undef NOERROR /* it seems this is already defined in winerror.h */ -#endif -#ifndef NOERROR -# define NOERROR ns_r_noerror -#endif -#ifndef FORMERR -# define FORMERR ns_r_formerr -#endif -#ifndef NXDOMAIN -# define NXDOMAIN ns_r_nxdomain -#endif -/* Non-standard response codes, use numeric values */ -#ifndef YXDOMAIN -# define YXDOMAIN 6 /* ns_r_yxdomain */ -#endif -#ifndef YXRRSET -# define YXRRSET 7 /* ns_r_yxrrset */ -#endif -#ifndef NXRRSET -# define NXRRSET 8 /* ns_r_nxrrset */ -#endif -#ifndef NOTAUTH -# define NOTAUTH 9 /* ns_r_notauth */ -#endif -#ifndef NOTZONE -# define NOTZONE 10 /* ns_r_notzone */ -#endif -#ifndef TSIG_BADSIG -# define TSIG_BADSIG 16 /* ns_r_badsig */ -#endif -#ifndef TSIG_BADKEY -# define TSIG_BADKEY 17 /* ns_r_badkey */ -#endif -#ifndef TSIG_BADTIME -# define TSIG_BADTIME 18 /* ns_r_badtime */ -#endif - - -/* classes */ -#ifndef C_IN -# define C_IN 1 /* ns_c_in */ -#endif -#ifndef C_CHAOS -# define C_CHAOS 3 /* ns_c_chaos */ -#endif -#ifndef C_HS -# define C_HS 4 /* ns_c_hs */ -#endif -#ifndef C_NONE -# define C_NONE 254 /* ns_c_none */ -#endif -#ifndef C_ANY -# define C_ANY 255 /* ns_c_any */ -#endif - - -/* types */ -#ifndef T_A -# define T_A 1 /* ns_t_a */ -#endif -#ifndef T_NS -# define T_NS 2 /* ns_t_ns */ -#endif -#ifndef T_MD -# define T_MD 3 /* ns_t_md */ -#endif -#ifndef T_MF -# define T_MF 4 /* ns_t_mf */ -#endif -#ifndef T_CNAME -# define T_CNAME 5 /* ns_t_cname */ -#endif -#ifndef T_SOA -# define T_SOA 6 /* ns_t_soa */ -#endif -#ifndef T_MB -# define T_MB 7 /* ns_t_mb */ -#endif -#ifndef T_MG -# define T_MG 8 /* ns_t_mg */ -#endif -#ifndef T_MR -# define T_MR 9 /* ns_t_mr */ -#endif -#ifndef T_NULL -# define T_NULL 10 /* ns_t_null */ -#endif -#ifndef T_WKS -# define T_WKS 11 /* ns_t_wks */ -#endif -#ifndef T_PTR -# define T_PTR 12 /* ns_t_ptr */ -#endif -#ifndef T_HINFO -# define T_HINFO 13 /* ns_t_hinfo */ -#endif -#ifndef T_MINFO -# define T_MINFO 14 /* ns_t_minfo */ -#endif -#ifndef T_MX -# define T_MX 15 /* ns_t_mx */ -#endif -#ifndef T_TXT -# define T_TXT 16 /* ns_t_txt */ -#endif -#ifndef T_RP -# define T_RP 17 /* ns_t_rp */ -#endif -#ifndef T_AFSDB -# define T_AFSDB 18 /* ns_t_afsdb */ -#endif -#ifndef T_X25 -# define T_X25 19 /* ns_t_x25 */ -#endif -#ifndef T_ISDN -# define T_ISDN 20 /* ns_t_isdn */ -#endif -#ifndef T_RT -# define T_RT 21 /* ns_t_rt */ -#endif -#ifndef T_NSAP -# define T_NSAP 22 /* ns_t_nsap */ -#endif -#ifndef T_NSAP_PTR -# define T_NSAP_PTR 23 /* ns_t_nsap_ptr */ -#endif -#ifndef T_SIG -# define T_SIG 24 /* ns_t_sig */ -#endif -#ifndef T_KEY -# define T_KEY 25 /* ns_t_key */ -#endif -#ifndef T_PX -# define T_PX 26 /* ns_t_px */ -#endif -#ifndef T_GPOS -# define T_GPOS 27 /* ns_t_gpos */ -#endif -#ifndef T_AAAA -# define T_AAAA 28 /* ns_t_aaaa */ -#endif -#ifndef T_LOC -# define T_LOC 29 /* ns_t_loc */ -#endif -#ifndef T_NXT -# define T_NXT 30 /* ns_t_nxt */ -#endif -#ifndef T_EID -# define T_EID 31 /* ns_t_eid */ -#endif -#ifndef T_NIMLOC -# define T_NIMLOC 32 /* ns_t_nimloc */ -#endif -#ifndef T_SRV -# define T_SRV 33 /* ns_t_srv */ -#endif -#ifndef T_ATMA -# define T_ATMA 34 /* ns_t_atma */ -#endif -#ifndef T_NAPTR -# define T_NAPTR 35 /* ns_t_naptr */ -#endif -#ifndef T_KX -# define T_KX 36 /* ns_t_kx */ -#endif -#ifndef T_CERT -# define T_CERT 37 /* ns_t_cert */ -#endif -#ifndef T_A6 -# define T_A6 38 /* ns_t_a6 */ -#endif -#ifndef T_DNAME -# define T_DNAME 39 /* ns_t_dname */ -#endif -#ifndef T_SINK -# define T_SINK 40 /* ns_t_sink */ -#endif -#ifndef T_OPT -# define T_OPT 41 /* ns_t_opt */ -#endif -#ifndef T_APL -# define T_APL 42 /* ns_t_apl */ -#endif -#ifndef T_DS -# define T_DS 43 /* ns_t_ds */ -#endif -#ifndef T_SSHFP -# define T_SSHFP 44 /* ns_t_sshfp */ -#endif -#ifndef T_RRSIG -# define T_RRSIG 46 /* ns_t_rrsig */ -#endif -#ifndef T_NSEC -# define T_NSEC 47 /* ns_t_nsec */ -#endif -#ifndef T_DNSKEY -# define T_DNSKEY 48 /* ns_t_dnskey */ -#endif -#ifndef T_TKEY -# define T_TKEY 249 /* ns_t_tkey */ -#endif -#ifndef T_TSIG -# define T_TSIG 250 /* ns_t_tsig */ -#endif -#ifndef T_IXFR -# define T_IXFR 251 /* ns_t_ixfr */ -#endif -#ifndef T_AXFR -# define T_AXFR 252 /* ns_t_axfr */ -#endif -#ifndef T_MAILB -# define T_MAILB 253 /* ns_t_mailb */ -#endif -#ifndef T_MAILA -# define T_MAILA 254 /* ns_t_maila */ -#endif -#ifndef T_ANY -# define T_ANY 255 /* ns_t_any */ -#endif -#ifndef T_URI -# define T_URI 256 /* ns_t_uri */ -#endif -#ifndef T_CAA -# define T_CAA 257 /* ns_t_caa */ -#endif -#ifndef T_MAX -# define T_MAX 65536 /* ns_t_max */ -#endif - - -#endif /* ARES_NAMESER_H */ diff --git a/lib/c-ares-1.19.1/include/ares_version.h b/lib/c-ares-1.19.1/include/ares_version.h deleted file mode 100644 index 35a1ed1a3d3..00000000000 --- a/lib/c-ares-1.19.1/include/ares_version.h +++ /dev/null @@ -1,24 +0,0 @@ - -#ifndef ARES__VERSION_H -#define ARES__VERSION_H - -/* This is the global package copyright */ -#define ARES_COPYRIGHT "2004 - 2021 Daniel Stenberg, ." - -#define ARES_VERSION_MAJOR 1 -#define ARES_VERSION_MINOR 19 -#define ARES_VERSION_PATCH 1 -#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ - (ARES_VERSION_MINOR<<8)|\ - (ARES_VERSION_PATCH)) -#define ARES_VERSION_STR "1.19.1" - -#if (ARES_VERSION >= 0x010700) -# define CARES_HAVE_ARES_LIBRARY_INIT 1 -# define CARES_HAVE_ARES_LIBRARY_CLEANUP 1 -#else -# undef CARES_HAVE_ARES_LIBRARY_INIT -# undef CARES_HAVE_ARES_LIBRARY_CLEANUP -#endif - -#endif diff --git a/lib/c-ares-1.19.1/src/CMakeLists.txt b/lib/c-ares-1.19.1/src/CMakeLists.txt deleted file mode 100644 index 6750c1780f6..00000000000 --- a/lib/c-ares-1.19.1/src/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -ADD_SUBDIRECTORY (lib) -ADD_SUBDIRECTORY (tools) diff --git a/lib/c-ares-1.19.1/src/Makefile.am b/lib/c-ares-1.19.1/src/Makefile.am deleted file mode 100644 index 2e97e422f73..00000000000 --- a/lib/c-ares-1.19.1/src/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -EXTRA_DIST=CMakeLists.txt -SUBDIRS=lib tools diff --git a/lib/c-ares-1.19.1/src/lib/ares__addrinfo2hostent.c b/lib/c-ares-1.19.1/src/lib/ares__addrinfo2hostent.c deleted file mode 100644 index efb145cd11b..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares__addrinfo2hostent.c +++ /dev/null @@ -1,266 +0,0 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright 2005 Dominick Meglio - * Copyright (C) 2019 by Andrew Selivanov - * Copyright (C) 2021 by Brad House - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#ifdef HAVE_LIMITS_H -# include -#endif - -#include "ares.h" -#include "ares_dns.h" -#include "ares_inet_net_pton.h" -#include "ares_private.h" - -int ares__addrinfo2hostent(const struct ares_addrinfo *ai, int family, - struct hostent **host) -{ - struct ares_addrinfo_node *next; - struct ares_addrinfo_cname *next_cname; - char **aliases = NULL; - char *addrs = NULL; - int naliases = 0, naddrs = 0, alias = 0, i; - - if (ai == NULL || host == NULL) - return ARES_EBADQUERY; - - *host = ares_malloc(sizeof(**host)); - if (!(*host)) - { - goto enomem; - } - memset(*host, 0, sizeof(**host)); - - /* Use the first node of the response as the family, since hostent can only - * represent one family. We assume getaddrinfo() returned a sorted list if - * the user requested AF_UNSPEC. */ - if (family == AF_UNSPEC && ai->nodes) - family = ai->nodes->ai_family; - - next = ai->nodes; - while (next) - { - if(next->ai_family == family) - { - ++naddrs; - } - next = next->ai_next; - } - - next_cname = ai->cnames; - while (next_cname) - { - if(next_cname->alias) - ++naliases; - next_cname = next_cname->next; - } - - aliases = ares_malloc((naliases + 1) * sizeof(char *)); - if (!aliases) - { - goto enomem; - } - (*host)->h_aliases = aliases; - memset(aliases, 0, (naliases + 1) * sizeof(char *)); - - if (naliases) - { - next_cname = ai->cnames; - while (next_cname) - { - if(next_cname->alias) { - aliases[alias] = ares_strdup(next_cname->alias); - if (!aliases[alias]) { - goto enomem; - } - alias++; - } - next_cname = next_cname->next; - } - } - - - (*host)->h_addr_list = ares_malloc((naddrs + 1) * sizeof(char *)); - if (!(*host)->h_addr_list) - { - goto enomem; - } - - memset((*host)->h_addr_list, 0, (naddrs + 1) * sizeof(char *)); - - if (ai->cnames) - { - (*host)->h_name = ares_strdup(ai->cnames->name); - if ((*host)->h_name == NULL && ai->cnames->name) - { - goto enomem; - } - } - else - { - (*host)->h_name = ares_strdup(ai->name); - if ((*host)->h_name == NULL && ai->name) - { - goto enomem; - } - } - - (*host)->h_addrtype = family; - (*host)->h_length = (family == AF_INET)? - sizeof(struct in_addr):sizeof(struct ares_in6_addr); - - if (naddrs) - { - addrs = ares_malloc(naddrs * (*host)->h_length); - if (!addrs) - { - goto enomem; - } - - i = 0; - next = ai->nodes; - while (next) - { - if(next->ai_family == family) - { - (*host)->h_addr_list[i] = addrs + (i * (*host)->h_length); - if (family == AF_INET6) - { - memcpy((*host)->h_addr_list[i], - &(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr), - (*host)->h_length); - } - else - { - memcpy((*host)->h_addr_list[i], - &(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr), - (*host)->h_length); - } - ++i; - } - next = next->ai_next; - } - - if (i == 0) - { - ares_free(addrs); - } - } - - if (naddrs == 0 && naliases == 0) - { - ares_free_hostent(*host); - *host = NULL; - return ARES_ENODATA; - } - - return ARES_SUCCESS; - -enomem: - ares_free_hostent(*host); - *host = NULL; - return ARES_ENOMEM; -} - - -int ares__addrinfo2addrttl(const struct ares_addrinfo *ai, int family, - int req_naddrttls, struct ares_addrttl *addrttls, - struct ares_addr6ttl *addr6ttls, int *naddrttls) -{ - struct ares_addrinfo_node *next; - struct ares_addrinfo_cname *next_cname; - int cname_ttl = INT_MAX; - - if (family != AF_INET && family != AF_INET6) - return ARES_EBADQUERY; - - if (ai == NULL || naddrttls == NULL) - return ARES_EBADQUERY; - - if (family == AF_INET && addrttls == NULL) - return ARES_EBADQUERY; - - if (family == AF_INET6 && addr6ttls == NULL) - return ARES_EBADQUERY; - - if (req_naddrttls == 0) - return ARES_EBADQUERY; - - *naddrttls = 0; - - next_cname = ai->cnames; - while (next_cname) - { - if(next_cname->ttl < cname_ttl) - cname_ttl = next_cname->ttl; - next_cname = next_cname->next; - } - - next = ai->nodes; - while (next) - { - if(next->ai_family == family) - { - if (*naddrttls < req_naddrttls) - { - if (family == AF_INET6) - { - if(next->ai_ttl > cname_ttl) - addr6ttls[*naddrttls].ttl = cname_ttl; - else - addr6ttls[*naddrttls].ttl = next->ai_ttl; - - memcpy(&addr6ttls[*naddrttls].ip6addr, - &(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr), - sizeof(struct ares_in6_addr)); - } - else - { - if(next->ai_ttl > cname_ttl) - addrttls[*naddrttls].ttl = cname_ttl; - else - addrttls[*naddrttls].ttl = next->ai_ttl; - memcpy(&addrttls[*naddrttls].ipaddr, - &(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr), - sizeof(struct in_addr)); - } - (*naddrttls)++; - } - } - next = next->ai_next; - } - - return ARES_SUCCESS; -} - diff --git a/lib/c-ares-1.19.1/src/lib/ares__addrinfo_localhost.c b/lib/c-ares-1.19.1/src/lib/ares__addrinfo_localhost.c deleted file mode 100644 index 5bc1e0bff08..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares__addrinfo_localhost.c +++ /dev/null @@ -1,240 +0,0 @@ -/* Copyright (C) 2021 - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#if defined(_WIN32) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 -#include -#include -#endif - -#include "ares.h" -#include "ares_inet_net_pton.h" -#include "ares_nowarn.h" -#include "ares_private.h" - -int ares_append_ai_node(int aftype, - unsigned short port, - int ttl, - const void *adata, - struct ares_addrinfo_node **nodes) -{ - struct ares_addrinfo_node *node; - - node = ares__append_addrinfo_node(nodes); - if (!node) - { - return ARES_ENOMEM; - } - - memset(node, 0, sizeof(*node)); - - if (aftype == AF_INET) - { - struct sockaddr_in *sin = ares_malloc(sizeof(*sin)); - if (!sin) - { - return ARES_ENOMEM; - } - - memset(sin, 0, sizeof(*sin)); - memcpy(&sin->sin_addr.s_addr, adata, sizeof(sin->sin_addr.s_addr)); - sin->sin_family = AF_INET; - sin->sin_port = htons(port); - - node->ai_addr = (struct sockaddr *)sin; - node->ai_family = AF_INET; - node->ai_addrlen = sizeof(*sin); - node->ai_addr = (struct sockaddr *)sin; - node->ai_ttl = ttl; - } - - if (aftype == AF_INET6) - { - struct sockaddr_in6 *sin6 = ares_malloc(sizeof(*sin6)); - if (!sin6) - { - return ARES_ENOMEM; - } - - memset(sin6, 0, sizeof(*sin6)); - memcpy(&sin6->sin6_addr.s6_addr, adata, sizeof(sin6->sin6_addr.s6_addr)); - sin6->sin6_family = AF_INET6; - sin6->sin6_port = htons(port); - - node->ai_addr = (struct sockaddr *)sin6; - node->ai_family = AF_INET6; - node->ai_addrlen = sizeof(*sin6); - node->ai_addr = (struct sockaddr *)sin6; - node->ai_ttl = ttl; - } - - return ARES_SUCCESS; -} - - -static int ares__default_loopback_addrs(int aftype, - unsigned short port, - struct ares_addrinfo_node **nodes) -{ - int status = ARES_SUCCESS; - - if (aftype == AF_UNSPEC || aftype == AF_INET6) - { - struct ares_in6_addr addr6; - ares_inet_pton(AF_INET6, "::1", &addr6); - status = ares_append_ai_node(AF_INET6, port, 0, &addr6, nodes); - if (status != ARES_SUCCESS) - { - return status; - } - } - - if (aftype == AF_UNSPEC || aftype == AF_INET) - { - struct in_addr addr4; - ares_inet_pton(AF_INET, "127.0.0.1", &addr4); - status = ares_append_ai_node(AF_INET, port, 0, &addr4, nodes); - if (status != ARES_SUCCESS) - { - return status; - } - } - - return status; -} - - -static int ares__system_loopback_addrs(int aftype, - unsigned short port, - struct ares_addrinfo_node **nodes) -{ -#if defined(_WIN32) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 && !defined(__WATCOMC__) - PMIB_UNICASTIPADDRESS_TABLE table; - unsigned int i; - int status; - - *nodes = NULL; - - if (GetUnicastIpAddressTable(aftype, &table) != NO_ERROR) - return ARES_ENOTFOUND; - - for (i=0; iNumEntries; i++) - { - if (table->Table[i].InterfaceLuid.Info.IfType != - IF_TYPE_SOFTWARE_LOOPBACK) - { - continue; - } - - if (table->Table[i].Address.si_family == AF_INET) - { - status = ares_append_ai_node(table->Table[i].Address.si_family, port, 0, - &table->Table[i].Address.Ipv4.sin_addr, - nodes); - } - else if (table->Table[i].Address.si_family == AF_INET6) - { - status = ares_append_ai_node(table->Table[i].Address.si_family, port, 0, - &table->Table[i].Address.Ipv6.sin6_addr, - nodes); - } - else - { - /* Ignore any others */ - continue; - } - - if (status != ARES_SUCCESS) - { - goto fail; - } - } - - if (*nodes == NULL) - status = ARES_ENOTFOUND; - -fail: - FreeMibTable(table); - - if (status != ARES_SUCCESS) - { - ares__freeaddrinfo_nodes(*nodes); - *nodes = NULL; - } - - return status; - -#else - (void)aftype; - (void)port; - (void)nodes; - /* Not supported on any other OS at this time */ - return ARES_ENOTFOUND; -#endif -} - - -int ares__addrinfo_localhost(const char *name, - unsigned short port, - const struct ares_addrinfo_hints *hints, - struct ares_addrinfo *ai) -{ - struct ares_addrinfo_node *nodes = NULL; - int result; - - /* Validate family */ - switch (hints->ai_family) { - case AF_INET: - case AF_INET6: - case AF_UNSPEC: - break; - default: - return ARES_EBADFAMILY; - } - - ai->name = ares_strdup(name); - if(!ai->name) - { - goto enomem; - } - - result = ares__system_loopback_addrs(hints->ai_family, port, &nodes); - - if (result == ARES_ENOTFOUND) - { - result = ares__default_loopback_addrs(hints->ai_family, port, &nodes); - } - - ares__addrinfo_cat_nodes(&ai->nodes, nodes); - - return result; - -enomem: - ares__freeaddrinfo_nodes(nodes); - ares_free(ai->name); - ai->name = NULL; - return ARES_ENOMEM; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares__close_sockets.c b/lib/c-ares-1.19.1/src/lib/ares__close_sockets.c deleted file mode 100644 index 0477174e3e1..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares__close_sockets.c +++ /dev/null @@ -1,61 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include "ares.h" -#include "ares_private.h" - -void ares__close_sockets(ares_channel channel, struct server_state *server) -{ - struct send_request *sendreq; - - /* Free all pending output buffers. */ - while (server->qhead) - { - /* Advance server->qhead; pull out query as we go. */ - sendreq = server->qhead; - server->qhead = sendreq->next; - if (sendreq->data_storage != NULL) - ares_free(sendreq->data_storage); - ares_free(sendreq); - } - server->qtail = NULL; - - /* Reset any existing input buffer. */ - if (server->tcp_buffer) - ares_free(server->tcp_buffer); - server->tcp_buffer = NULL; - server->tcp_lenbuf_pos = 0; - - /* Reset brokenness */ - server->is_broken = 0; - - /* Close the TCP and UDP sockets. */ - if (server->tcp_socket != ARES_SOCKET_BAD) - { - SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0); - ares__close_socket(channel, server->tcp_socket); - server->tcp_socket = ARES_SOCKET_BAD; - server->tcp_connection_generation = ++channel->tcp_connection_generation; - } - if (server->udp_socket != ARES_SOCKET_BAD) - { - SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0); - ares__close_socket(channel, server->udp_socket); - server->udp_socket = ARES_SOCKET_BAD; - } -} diff --git a/lib/c-ares-1.19.1/src/lib/ares__get_hostent.c b/lib/c-ares-1.19.1/src/lib/ares__get_hostent.c deleted file mode 100644 index 367f39037b1..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares__get_hostent.c +++ /dev/null @@ -1,260 +0,0 @@ - -/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares.h" -#include "ares_inet_net_pton.h" -#include "ares_nowarn.h" -#include "ares_private.h" - -int ares__get_hostent(FILE *fp, int family, struct hostent **host) -{ - char *line = NULL, *p, *q, **alias; - char *txtaddr, *txthost, *txtalias; - int status; - size_t addrlen, linesize, naliases; - struct ares_addr addr; - struct hostent *hostent = NULL; - - *host = NULL; /* Assume failure */ - - /* Validate family */ - switch (family) { - case AF_INET: - case AF_INET6: - case AF_UNSPEC: - break; - default: - return ARES_EBADFAMILY; - } - - while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) - { - - /* Trim line comment. */ - p = line; - while (*p && (*p != '#')) - p++; - *p = '\0'; - - /* Trim trailing whitespace. */ - q = p - 1; - while ((q >= line) && ISSPACE(*q)) - q--; - *++q = '\0'; - - /* Skip leading whitespace. */ - p = line; - while (*p && ISSPACE(*p)) - p++; - if (!*p) - /* Ignore line if empty. */ - continue; - - /* Pointer to start of IPv4 or IPv6 address part. */ - txtaddr = p; - - /* Advance past address part. */ - while (*p && !ISSPACE(*p)) - p++; - if (!*p) - /* Ignore line if reached end of line. */ - continue; - - /* Null terminate address part. */ - *p = '\0'; - - /* Advance to host name */ - p++; - while (*p && ISSPACE(*p)) - p++; - if (!*p) - /* Ignore line if reached end of line. */ - continue; /* LCOV_EXCL_LINE: trailing whitespace already stripped */ - - /* Pointer to start of host name. */ - txthost = p; - - /* Advance past host name. */ - while (*p && !ISSPACE(*p)) - p++; - - /* Pointer to start of first alias. */ - txtalias = NULL; - if (*p) - { - q = p + 1; - while (*q && ISSPACE(*q)) - q++; - if (*q) - txtalias = q; - } - - /* Null terminate host name. */ - *p = '\0'; - - /* find out number of aliases. */ - naliases = 0; - if (txtalias) - { - p = txtalias; - while (*p) - { - while (*p && !ISSPACE(*p)) - p++; - while (*p && ISSPACE(*p)) - p++; - naliases++; - } - } - - /* Convert address string to network address for the requested family. */ - addrlen = 0; - addr.family = AF_UNSPEC; - addr.addrV4.s_addr = INADDR_NONE; - if ((family == AF_INET) || (family == AF_UNSPEC)) - { - if (ares_inet_pton(AF_INET, txtaddr, &addr.addrV4) > 0) - { - /* Actual network address family and length. */ - addr.family = AF_INET; - addrlen = sizeof(addr.addrV4); - } - } - if ((family == AF_INET6) || ((family == AF_UNSPEC) && (!addrlen))) - { - if (ares_inet_pton(AF_INET6, txtaddr, &addr.addrV6) > 0) - { - /* Actual network address family and length. */ - addr.family = AF_INET6; - addrlen = sizeof(addr.addrV6); - } - } - if (!addrlen) - /* Ignore line if invalid address string for the requested family. */ - continue; - - /* - ** Actual address family possible values are AF_INET and AF_INET6 only. - */ - - /* Allocate memory for the hostent structure. */ - hostent = ares_malloc(sizeof(struct hostent)); - if (!hostent) - break; - - /* Initialize fields for out of memory condition. */ - hostent->h_aliases = NULL; - hostent->h_addr_list = NULL; - - /* Copy official host name. */ - hostent->h_name = ares_strdup(txthost); - if (!hostent->h_name) - break; - - /* Copy network address. */ - hostent->h_addr_list = ares_malloc(2 * sizeof(char *)); - if (!hostent->h_addr_list) - break; - hostent->h_addr_list[1] = NULL; - hostent->h_addr_list[0] = ares_malloc(addrlen); - if (!hostent->h_addr_list[0]) - break; - if (addr.family == AF_INET) - memcpy(hostent->h_addr_list[0], &addr.addrV4, sizeof(addr.addrV4)); - else - memcpy(hostent->h_addr_list[0], &addr.addrV6, sizeof(addr.addrV6)); - - /* Copy aliases. */ - hostent->h_aliases = ares_malloc((naliases + 1) * sizeof(char *)); - if (!hostent->h_aliases) - break; - alias = hostent->h_aliases; - while (naliases) - *(alias + naliases--) = NULL; - *alias = NULL; - while (txtalias) - { - p = txtalias; - while (*p && !ISSPACE(*p)) - p++; - q = p; - while (*q && ISSPACE(*q)) - q++; - *p = '\0'; - if ((*alias = ares_strdup(txtalias)) == NULL) - break; - alias++; - txtalias = *q ? q : NULL; - } - if (txtalias) - /* Alias memory allocation failure. */ - break; - - /* Copy actual network address family and length. */ - hostent->h_addrtype = aresx_sitoss(addr.family); - hostent->h_length = aresx_uztoss(addrlen); - - /* Free line buffer. */ - ares_free(line); - - /* Return hostent successfully */ - *host = hostent; - return ARES_SUCCESS; - - } - - /* If allocated, free line buffer. */ - if (line) - ares_free(line); - - if (status == ARES_SUCCESS) - { - /* Memory allocation failure; clean up. */ - if (hostent) - { - if (hostent->h_name) - ares_free((char *) hostent->h_name); - if (hostent->h_aliases) - { - for (alias = hostent->h_aliases; *alias; alias++) - ares_free(*alias); - ares_free(hostent->h_aliases); - } - if (hostent->h_addr_list) - { - if (hostent->h_addr_list[0]) - ares_free(hostent->h_addr_list[0]); - ares_free(hostent->h_addr_list); - } - ares_free(hostent); - } - return ARES_ENOMEM; - } - - return status; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares__parse_into_addrinfo.c b/lib/c-ares-1.19.1/src/lib/ares__parse_into_addrinfo.c deleted file mode 100644 index 4393f04b961..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares__parse_into_addrinfo.c +++ /dev/null @@ -1,229 +0,0 @@ -/* Copyright (C) 2019 by Andrew Selivanov - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#ifdef HAVE_LIMITS_H -# include -#endif - -#include "ares.h" -#include "ares_dns.h" -#include "ares_private.h" - -int ares__parse_into_addrinfo(const unsigned char *abuf, - int alen, int cname_only_is_enodata, - unsigned short port, - struct ares_addrinfo *ai) -{ - unsigned int qdcount, ancount; - int status, i, rr_type, rr_class, rr_len, rr_ttl; - int got_a = 0, got_aaaa = 0, got_cname = 0; - long len; - const unsigned char *aptr; - char *question_hostname = NULL; - char *hostname, *rr_name = NULL, *rr_data; - struct ares_addrinfo_cname *cname, *cnames = NULL; - struct ares_addrinfo_node *nodes = NULL; - - /* Give up if abuf doesn't have room for a header. */ - if (alen < HFIXEDSZ) - return ARES_EBADRESP; - - /* Fetch the question and answer count from the header. */ - qdcount = DNS_HEADER_QDCOUNT(abuf); - ancount = DNS_HEADER_ANCOUNT(abuf); - if (qdcount != 1) - return ARES_EBADRESP; - - - /* Expand the name from the question, and skip past the question. */ - aptr = abuf + HFIXEDSZ; - status = ares__expand_name_for_response(aptr, abuf, alen, &question_hostname, &len, 0); - if (status != ARES_SUCCESS) - return status; - if (aptr + len + QFIXEDSZ > abuf + alen) - { - status = ARES_EBADRESP; - goto failed_stat; - } - - hostname = question_hostname; - - aptr += len + QFIXEDSZ; - - /* Examine each answer resource record (RR) in turn. */ - for (i = 0; i < (int)ancount; i++) - { - /* Decode the RR up to the data field. */ - status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len, 0); - if (status != ARES_SUCCESS) - { - rr_name = NULL; - goto failed_stat; - } - - aptr += len; - if (aptr + RRFIXEDSZ > abuf + alen) - { - status = ARES_EBADRESP; - goto failed_stat; - } - rr_type = DNS_RR_TYPE(aptr); - rr_class = DNS_RR_CLASS(aptr); - rr_len = DNS_RR_LEN(aptr); - rr_ttl = DNS_RR_TTL(aptr); - aptr += RRFIXEDSZ; - if (aptr + rr_len > abuf + alen) - { - status = ARES_EBADRESP; - goto failed_stat; - } - - if (rr_class == C_IN && rr_type == T_A - && rr_len == sizeof(struct in_addr) - && strcasecmp(rr_name, hostname) == 0) - { - got_a = 1; - if (aptr + sizeof(struct in_addr) > abuf + alen) - { /* LCOV_EXCL_START: already checked above */ - status = ARES_EBADRESP; - goto failed_stat; - } /* LCOV_EXCL_STOP */ - - status = ares_append_ai_node(AF_INET, port, rr_ttl, aptr, &nodes); - if (status != ARES_SUCCESS) - goto failed_stat; - } - else if (rr_class == C_IN && rr_type == T_AAAA - && rr_len == sizeof(struct ares_in6_addr) - && strcasecmp(rr_name, hostname) == 0) - { - got_aaaa = 1; - if (aptr + sizeof(struct ares_in6_addr) > abuf + alen) - { /* LCOV_EXCL_START: already checked above */ - status = ARES_EBADRESP; - goto failed_stat; - } /* LCOV_EXCL_STOP */ - - status = ares_append_ai_node(AF_INET6, port, rr_ttl, aptr, &nodes); - if (status != ARES_SUCCESS) - goto failed_stat; - } - - if (rr_class == C_IN && rr_type == T_CNAME) - { - got_cname = 1; - status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, - &len, 1); - if (status != ARES_SUCCESS) - { - goto failed_stat; - } - - /* Decode the RR data and replace the hostname with it. */ - /* SA: Seems wrong as it introduses order dependency. */ - hostname = rr_data; - - cname = ares__append_addrinfo_cname(&cnames); - if (!cname) - { - status = ARES_ENOMEM; - ares_free(rr_data); - goto failed_stat; - } - cname->ttl = rr_ttl; - cname->alias = rr_name; - cname->name = rr_data; - rr_name = NULL; - } - else - { - /* rr_name is only saved for cname */ - ares_free(rr_name); - rr_name = NULL; - } - - - aptr += rr_len; - if (aptr > abuf + alen) - { /* LCOV_EXCL_START: already checked above */ - status = ARES_EBADRESP; - goto failed_stat; - } /* LCOV_EXCL_STOP */ - } - - if (status == ARES_SUCCESS) - { - if (!got_a && !got_aaaa) - { - if (!got_cname || (got_cname && cname_only_is_enodata)) - { - status = ARES_ENODATA; - goto failed_stat; - } - } - - /* save the question hostname as ai->name */ - if (ai->name == NULL || strcasecmp(ai->name, question_hostname) != 0) - { - ares_free(ai->name); - ai->name = ares_strdup(question_hostname); - if (!ai->name) - { - status = ARES_ENOMEM; - goto failed_stat; - } - } - - if (got_a || got_aaaa) - { - ares__addrinfo_cat_nodes(&ai->nodes, nodes); - nodes = NULL; - } - - if (got_cname) - { - ares__addrinfo_cat_cnames(&ai->cnames, cnames); - cnames = NULL; - } - } - - ares_free(question_hostname); - return status; - -failed_stat: - ares_free(question_hostname); - ares_free(rr_name); - ares__freeaddrinfo_cnames(cnames); - ares__freeaddrinfo_nodes(nodes); - return status; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares__read_line.c b/lib/c-ares-1.19.1/src/lib/ares__read_line.c deleted file mode 100644 index c62ad2a2b41..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares__read_line.c +++ /dev/null @@ -1,73 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include "ares.h" -#include "ares_nowarn.h" -#include "ares_private.h" - -/* This is an internal function. Its contract is to read a line from - * a file into a dynamically allocated buffer, zeroing the trailing - * newline if there is one. The calling routine may call - * ares__read_line multiple times with the same buf and bufsize - * pointers; *buf will be reallocated and *bufsize adjusted as - * appropriate. The initial value of *buf should be NULL. After the - * calling routine is done reading lines, it should free *buf. - */ -int ares__read_line(FILE *fp, char **buf, size_t *bufsize) -{ - char *newbuf; - size_t offset = 0; - size_t len; - - if (*buf == NULL) - { - *buf = ares_malloc(128); - if (!*buf) - return ARES_ENOMEM; - *bufsize = 128; - } - - for (;;) - { - int bytestoread = aresx_uztosi(*bufsize - offset); - - if (!fgets(*buf + offset, bytestoread, fp)) - return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF; - len = offset + strlen(*buf + offset); - if ((*buf)[len - 1] == '\n') - { - (*buf)[len - 1] = 0; - break; - } - offset = len; - if(len < *bufsize - 1) - continue; - - /* Allocate more space. */ - newbuf = ares_realloc(*buf, *bufsize * 2); - if (!newbuf) - { - ares_free(*buf); - *buf = NULL; - return ARES_ENOMEM; - } - *buf = newbuf; - *bufsize *= 2; - } - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares__readaddrinfo.c b/lib/c-ares-1.19.1/src/lib/ares__readaddrinfo.c deleted file mode 100644 index 2315df94111..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares__readaddrinfo.c +++ /dev/null @@ -1,258 +0,0 @@ -/* Copyright (C) 2019 by Andrew Selivanov - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares.h" -#include "ares_inet_net_pton.h" -#include "ares_nowarn.h" -#include "ares_private.h" - -#define MAX_ALIASES 40 - -int ares__readaddrinfo(FILE *fp, - const char *name, - unsigned short port, - const struct ares_addrinfo_hints *hints, - struct ares_addrinfo *ai) -{ - char *line = NULL, *p, *q; - char *txtaddr, *txthost, *txtalias; - char *aliases[MAX_ALIASES]; - unsigned int i, alias_count; - int status = ARES_SUCCESS; - size_t linesize; - struct ares_addrinfo_cname *cname = NULL, *cnames = NULL; - struct ares_addrinfo_node *nodes = NULL; - int match_with_alias, match_with_canonical; - int want_cname = hints->ai_flags & ARES_AI_CANONNAME; - - /* Validate family */ - switch (hints->ai_family) { - case AF_INET: - case AF_INET6: - case AF_UNSPEC: - break; - default: - return ARES_EBADFAMILY; - } - - ai->name = ares_strdup(name); - if(!ai->name) - { - status = ARES_ENOMEM; - goto fail; - } - - while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) - { - match_with_alias = 0; - match_with_canonical = 0; - alias_count = 0; - /* Trim line comment. */ - p = line; - while (*p && (*p != '#')) - p++; - *p = '\0'; - - /* Trim trailing whitespace. */ - q = p - 1; - while ((q >= line) && ISSPACE(*q)) - q--; - *++q = '\0'; - - /* Skip leading whitespace. */ - p = line; - while (*p && ISSPACE(*p)) - p++; - if (!*p) - /* Ignore line if empty. */ - continue; - - /* Pointer to start of IPv4 or IPv6 address part. */ - txtaddr = p; - - /* Advance past address part. */ - while (*p && !ISSPACE(*p)) - p++; - if (!*p) - /* Ignore line if reached end of line. */ - continue; - - /* Null terminate address part. */ - *p = '\0'; - - /* Advance to host name */ - p++; - while (*p && ISSPACE(*p)) - p++; - if (!*p) - /* Ignore line if reached end of line. */ - continue; /* LCOV_EXCL_LINE: trailing whitespace already stripped */ - - /* Pointer to start of host name. */ - txthost = p; - - /* Advance past host name. */ - while (*p && !ISSPACE(*p)) - p++; - - /* Pointer to start of first alias. */ - txtalias = NULL; - if (*p) - { - q = p + 1; - while (*q && ISSPACE(*q)) - q++; - if (*q) - txtalias = q; - } - - /* Null terminate host name. */ - *p = '\0'; - - /* Find out if host name matches with canonical host name. */ - if (strcasecmp(txthost, name) == 0) - { - match_with_canonical = 1; - } - - /* Find out if host name matches with one of the aliases. */ - while (txtalias) - { - p = txtalias; - while (*p && !ISSPACE(*p)) - p++; - q = p; - while (*q && ISSPACE(*q)) - q++; - *p = '\0'; - if (strcasecmp(txtalias, name) == 0) - { - match_with_alias = 1; - if (!want_cname) - break; - } - if (alias_count < MAX_ALIASES) - { - aliases[alias_count++] = txtalias; - } - txtalias = *q ? q : NULL; - } - - /* Try next line if host does not match. */ - if (!match_with_alias && !match_with_canonical) - { - continue; - } - - /* - * Convert address string to network address for the requested families. - * Actual address family possible values are AF_INET and AF_INET6 only. - */ - if ((hints->ai_family == AF_INET) || (hints->ai_family == AF_UNSPEC)) - { - struct in_addr addr4; - if (ares_inet_pton(AF_INET, txtaddr, &addr4) == 1) - { - status = ares_append_ai_node(AF_INET, port, 0, &addr4, &nodes); - if (status != ARES_SUCCESS) - { - goto fail; - } - } - } - if ((hints->ai_family == AF_INET6) || (hints->ai_family == AF_UNSPEC)) - { - struct ares_in6_addr addr6; - if (ares_inet_pton(AF_INET6, txtaddr, &addr6) == 1) - { - status = ares_append_ai_node(AF_INET6, port, 0, &addr6, &nodes); - if (status != ARES_SUCCESS) - { - goto fail; - } - } - } - - if (status != ARES_SUCCESS) - /* Ignore line if invalid address string for the requested family. */ - continue; - - if (want_cname) - { - for (i = 0; i < alias_count; ++i) - { - cname = ares__append_addrinfo_cname(&cnames); - if (!cname) - { - status = ARES_ENOMEM; - goto fail; - } - cname->alias = ares_strdup(aliases[i]); - cname->name = ares_strdup(txthost); - } - /* No aliases, cname only. */ - if(!alias_count) - { - cname = ares__append_addrinfo_cname(&cnames); - if (!cname) - { - status = ARES_ENOMEM; - goto fail; - } - cname->name = ares_strdup(txthost); - } - } - } - - /* Last read failed. */ - if (status == ARES_ENOMEM) - { - goto fail; - } - - /* If no results, its a failure */ - if (!nodes) - { - status = ARES_ENOTFOUND; - goto fail; - } - - /* Free line buffer. */ - ares_free(line); - ares__addrinfo_cat_cnames(&ai->cnames, cnames); - ares__addrinfo_cat_nodes(&ai->nodes, nodes); - - return ARES_SUCCESS; - -fail: - ares_free(line); - ares__freeaddrinfo_cnames(cnames); - ares__freeaddrinfo_nodes(nodes); - ares_free(ai->name); - ai->name = NULL; - return status; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares__sortaddrinfo.c b/lib/c-ares-1.19.1/src/lib/ares__sortaddrinfo.c deleted file mode 100644 index 3f050cad00f..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares__sortaddrinfo.c +++ /dev/null @@ -1,507 +0,0 @@ -/* - * Original file name getaddrinfo.c - * Lifted from the 'Android Bionic' project with the BSD license. - */ - -/* - * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. - * Copyright (C) 2018 The Android Open Source Project - * Copyright (C) 2019 by Andrew Selivanov - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif - -#include -#include - -#include "ares.h" -#include "ares_private.h" - -struct addrinfo_sort_elem -{ - struct ares_addrinfo_node *ai; - int has_src_addr; - ares_sockaddr src_addr; - int original_order; -}; - -#define ARES_IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) - -#define ARES_IPV6_ADDR_SCOPE_NODELOCAL 0x01 -#define ARES_IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 -#define ARES_IPV6_ADDR_SCOPE_LINKLOCAL 0x02 -#define ARES_IPV6_ADDR_SCOPE_SITELOCAL 0x05 -#define ARES_IPV6_ADDR_SCOPE_ORGLOCAL 0x08 -#define ARES_IPV6_ADDR_SCOPE_GLOBAL 0x0e - -#define ARES_IN_LOOPBACK(a) ((((long int)(a)) & 0xff000000) == 0x7f000000) - -/* RFC 4193. */ -#define ARES_IN6_IS_ADDR_ULA(a) (((a)->s6_addr[0] & 0xfe) == 0xfc) - -/* These macros are modelled after the ones in . */ -/* RFC 4380, section 2.6 */ -#define ARES_IN6_IS_ADDR_TEREDO(a) \ - ((*(const unsigned int *)(const void *)(&(a)->s6_addr[0]) == ntohl(0x20010000))) -/* RFC 3056, section 2. */ -#define ARES_IN6_IS_ADDR_6TO4(a) \ - (((a)->s6_addr[0] == 0x20) && ((a)->s6_addr[1] == 0x02)) -/* 6bone testing address area (3ffe::/16), deprecated in RFC 3701. */ -#define ARES_IN6_IS_ADDR_6BONE(a) \ - (((a)->s6_addr[0] == 0x3f) && ((a)->s6_addr[1] == 0xfe)) - - -static int get_scope(const struct sockaddr *addr) -{ - if (addr->sa_family == AF_INET6) - { - const struct sockaddr_in6 *addr6 = CARES_INADDR_CAST(const struct sockaddr_in6 *, addr); - if (IN6_IS_ADDR_MULTICAST(&addr6->sin6_addr)) - { - return ARES_IPV6_ADDR_MC_SCOPE(&addr6->sin6_addr); - } - else if (IN6_IS_ADDR_LOOPBACK(&addr6->sin6_addr) || - IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr)) - { - /* - * RFC 4291 section 2.5.3 says loopback is to be treated as having - * link-local scope. - */ - return ARES_IPV6_ADDR_SCOPE_LINKLOCAL; - } - else if (IN6_IS_ADDR_SITELOCAL(&addr6->sin6_addr)) - { - return ARES_IPV6_ADDR_SCOPE_SITELOCAL; - } - else - { - return ARES_IPV6_ADDR_SCOPE_GLOBAL; - } - } - else if (addr->sa_family == AF_INET) - { - const struct sockaddr_in *addr4 = CARES_INADDR_CAST(const struct sockaddr_in *, addr); - unsigned long int na = ntohl(addr4->sin_addr.s_addr); - if (ARES_IN_LOOPBACK(na) || /* 127.0.0.0/8 */ - (na & 0xffff0000) == 0xa9fe0000) /* 169.254.0.0/16 */ - { - return ARES_IPV6_ADDR_SCOPE_LINKLOCAL; - } - else - { - /* - * RFC 6724 section 3.2. Other IPv4 addresses, including private - * addresses and shared addresses (100.64.0.0/10), are assigned global - * scope. - */ - return ARES_IPV6_ADDR_SCOPE_GLOBAL; - } - } - else - { - /* - * This should never happen. - * Return a scope with low priority as a last resort. - */ - return ARES_IPV6_ADDR_SCOPE_NODELOCAL; - } -} - -static int get_label(const struct sockaddr *addr) -{ - if (addr->sa_family == AF_INET) - { - return 4; - } - else if (addr->sa_family == AF_INET6) - { - const struct sockaddr_in6 *addr6 = CARES_INADDR_CAST(const struct sockaddr_in6 *, addr); - if (IN6_IS_ADDR_LOOPBACK(&addr6->sin6_addr)) - { - return 0; - } - else if (IN6_IS_ADDR_V4MAPPED(&addr6->sin6_addr)) - { - return 4; - } - else if (ARES_IN6_IS_ADDR_6TO4(&addr6->sin6_addr)) - { - return 2; - } - else if (ARES_IN6_IS_ADDR_TEREDO(&addr6->sin6_addr)) - { - return 5; - } - else if (ARES_IN6_IS_ADDR_ULA(&addr6->sin6_addr)) - { - return 13; - } - else if (IN6_IS_ADDR_V4COMPAT(&addr6->sin6_addr)) - { - return 3; - } - else if (IN6_IS_ADDR_SITELOCAL(&addr6->sin6_addr)) - { - return 11; - } - else if (ARES_IN6_IS_ADDR_6BONE(&addr6->sin6_addr)) - { - return 12; - } - else - { - /* All other IPv6 addresses, including global unicast addresses. */ - return 1; - } - } - else - { - /* - * This should never happen. - * Return a semi-random label as a last resort. - */ - return 1; - } -} - -/* - * Get the precedence for a given IPv4/IPv6 address. - * RFC 6724, section 2.1. - */ -static int get_precedence(const struct sockaddr *addr) -{ - if (addr->sa_family == AF_INET) - { - return 35; - } - else if (addr->sa_family == AF_INET6) - { - const struct sockaddr_in6 *addr6 = CARES_INADDR_CAST(const struct sockaddr_in6 *, addr); - if (IN6_IS_ADDR_LOOPBACK(&addr6->sin6_addr)) - { - return 50; - } - else if (IN6_IS_ADDR_V4MAPPED(&addr6->sin6_addr)) - { - return 35; - } - else if (ARES_IN6_IS_ADDR_6TO4(&addr6->sin6_addr)) - { - return 30; - } - else if (ARES_IN6_IS_ADDR_TEREDO(&addr6->sin6_addr)) - { - return 5; - } - else if (ARES_IN6_IS_ADDR_ULA(&addr6->sin6_addr)) - { - return 3; - } - else if (IN6_IS_ADDR_V4COMPAT(&addr6->sin6_addr) || - IN6_IS_ADDR_SITELOCAL(&addr6->sin6_addr) || - ARES_IN6_IS_ADDR_6BONE(&addr6->sin6_addr)) - { - return 1; - } - else - { - /* All other IPv6 addresses, including global unicast addresses. */ - return 40; - } - } - else - { - return 1; - } -} - -/* - * Find number of matching initial bits between the two addresses a1 and a2. - */ -static int common_prefix_len(const struct in6_addr *a1, - const struct in6_addr *a2) -{ - const char *p1 = (const char *)a1; - const char *p2 = (const char *)a2; - unsigned i; - for (i = 0; i < sizeof(*a1); ++i) - { - int x, j; - if (p1[i] == p2[i]) - { - continue; - } - x = p1[i] ^ p2[i]; - for (j = 0; j < CHAR_BIT; ++j) - { - if (x & (1 << (CHAR_BIT - 1))) - { - return i * CHAR_BIT + j; - } - x <<= 1; - } - } - return sizeof(*a1) * CHAR_BIT; -} - -/* - * Compare two source/destination address pairs. - * RFC 6724, section 6. - */ -static int rfc6724_compare(const void *ptr1, const void *ptr2) -{ - const struct addrinfo_sort_elem *a1 = (const struct addrinfo_sort_elem *)ptr1; - const struct addrinfo_sort_elem *a2 = (const struct addrinfo_sort_elem *)ptr2; - int scope_src1, scope_dst1, scope_match1; - int scope_src2, scope_dst2, scope_match2; - int label_src1, label_dst1, label_match1; - int label_src2, label_dst2, label_match2; - int precedence1, precedence2; - int prefixlen1, prefixlen2; - - /* Rule 1: Avoid unusable destinations. */ - if (a1->has_src_addr != a2->has_src_addr) - { - return a2->has_src_addr - a1->has_src_addr; - } - - /* Rule 2: Prefer matching scope. */ - scope_src1 = ARES_IPV6_ADDR_SCOPE_NODELOCAL; - if (a1->has_src_addr) - scope_src1 = get_scope(&a1->src_addr.sa); - scope_dst1 = get_scope(a1->ai->ai_addr); - scope_match1 = (scope_src1 == scope_dst1); - - scope_src2 = ARES_IPV6_ADDR_SCOPE_NODELOCAL; - if (a2->has_src_addr) - scope_src2 = get_scope(&a2->src_addr.sa); - scope_dst2 = get_scope(a2->ai->ai_addr); - scope_match2 = (scope_src2 == scope_dst2); - - if (scope_match1 != scope_match2) - { - return scope_match2 - scope_match1; - } - - /* Rule 3: Avoid deprecated addresses. */ - - /* Rule 4: Prefer home addresses. */ - - /* Rule 5: Prefer matching label. */ - label_src1 = 1; - if (a1->has_src_addr) - label_src1 = get_label(&a1->src_addr.sa); - label_dst1 = get_label(a1->ai->ai_addr); - label_match1 = (label_src1 == label_dst1); - - label_src2 = 1; - if (a2->has_src_addr) - label_src2 = get_label(&a2->src_addr.sa); - label_dst2 = get_label(a2->ai->ai_addr); - label_match2 = (label_src2 == label_dst2); - - if (label_match1 != label_match2) - { - return label_match2 - label_match1; - } - - /* Rule 6: Prefer higher precedence. */ - precedence1 = get_precedence(a1->ai->ai_addr); - precedence2 = get_precedence(a2->ai->ai_addr); - if (precedence1 != precedence2) - { - return precedence2 - precedence1; - } - - /* Rule 7: Prefer native transport. */ - - /* Rule 8: Prefer smaller scope. */ - if (scope_dst1 != scope_dst2) - { - return scope_dst1 - scope_dst2; - } - - /* Rule 9: Use longest matching prefix. */ - if (a1->has_src_addr && a1->ai->ai_addr->sa_family == AF_INET6 && - a2->has_src_addr && a2->ai->ai_addr->sa_family == AF_INET6) - { - const struct sockaddr_in6 *a1_src = &a1->src_addr.sa6; - const struct sockaddr_in6 *a1_dst = - CARES_INADDR_CAST(const struct sockaddr_in6 *, a1->ai->ai_addr); - const struct sockaddr_in6 *a2_src = &a2->src_addr.sa6; - const struct sockaddr_in6 *a2_dst = - CARES_INADDR_CAST(const struct sockaddr_in6 *, a2->ai->ai_addr); - prefixlen1 = common_prefix_len(&a1_src->sin6_addr, &a1_dst->sin6_addr); - prefixlen2 = common_prefix_len(&a2_src->sin6_addr, &a2_dst->sin6_addr); - if (prefixlen1 != prefixlen2) - { - return prefixlen2 - prefixlen1; - } - } - - /* - * Rule 10: Leave the order unchanged. - * We need this since qsort() is not necessarily stable. - */ - return a1->original_order - a2->original_order; -} - -/* - * Find the source address that will be used if trying to connect to the given - * address. - * - * Returns 1 if a source address was found, 0 if the address is unreachable, - * and -1 if a fatal error occurred. If 0 or 1, the contents of src_addr are - * undefined. - */ -static int find_src_addr(ares_channel channel, - const struct sockaddr *addr, - struct sockaddr *src_addr) -{ - ares_socket_t sock; - int ret; - ares_socklen_t len; - - switch (addr->sa_family) - { - case AF_INET: - len = sizeof(struct sockaddr_in); - break; - case AF_INET6: - len = sizeof(struct sockaddr_in6); - break; - default: - /* No known usable source address for non-INET families. */ - return 0; - } - - sock = ares__open_socket(channel, addr->sa_family, SOCK_DGRAM, IPPROTO_UDP); - if (sock == ARES_SOCKET_BAD) - { - if (errno == EAFNOSUPPORT) - { - return 0; - } - else - { - return -1; - } - } - - do - { - ret = ares__connect_socket(channel, sock, addr, len); - } - while (ret == -1 && errno == EINTR); - - if (ret == -1) - { - ares__close_socket(channel, sock); - return 0; - } - - if (getsockname(sock, src_addr, &len) != 0) - { - ares__close_socket(channel, sock); - return -1; - } - ares__close_socket(channel, sock); - return 1; -} - -/* - * Sort the linked list starting at sentinel->ai_next in RFC6724 order. - * Will leave the list unchanged if an error occurs. - */ -int ares__sortaddrinfo(ares_channel channel, struct ares_addrinfo_node *list_sentinel) -{ - struct ares_addrinfo_node *cur; - int nelem = 0, i; - int has_src_addr; - struct addrinfo_sort_elem *elems; - - cur = list_sentinel->ai_next; - while (cur) - { - ++nelem; - cur = cur->ai_next; - } - - if (!nelem) - return ARES_ENODATA; - - elems = (struct addrinfo_sort_elem *)ares_malloc( - nelem * sizeof(struct addrinfo_sort_elem)); - if (!elems) - { - return ARES_ENOMEM; - } - - /* - * Convert the linked list to an array that also contains the candidate - * source address for each destination address. - */ - for (i = 0, cur = list_sentinel->ai_next; i < nelem; ++i, cur = cur->ai_next) - { - assert(cur != NULL); - elems[i].ai = cur; - elems[i].original_order = i; - has_src_addr = find_src_addr(channel, cur->ai_addr, &elems[i].src_addr.sa); - if (has_src_addr == -1) - { - ares_free(elems); - return ARES_ENOTFOUND; - } - elems[i].has_src_addr = has_src_addr; - } - - /* Sort the addresses, and rearrange the linked list so it matches the sorted - * order. */ - qsort((void *)elems, nelem, sizeof(struct addrinfo_sort_elem), - rfc6724_compare); - - list_sentinel->ai_next = elems[0].ai; - for (i = 0; i < nelem - 1; ++i) - { - elems[i].ai->ai_next = elems[i + 1].ai; - } - elems[nelem - 1].ai->ai_next = NULL; - - ares_free(elems); - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares__timeval.c b/lib/c-ares-1.19.1/src/lib/ares__timeval.c deleted file mode 100644 index 94efb7db1e9..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares__timeval.c +++ /dev/null @@ -1,111 +0,0 @@ - -/* Copyright (C) 2008 by Daniel Stenberg et al - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include "ares.h" -#include "ares_private.h" - -#if defined(WIN32) && !defined(MSDOS) - -struct timeval ares__tvnow(void) -{ - /* - ** GetTickCount() is available on _all_ Windows versions from W95 up - ** to nowadays. Returns milliseconds elapsed since last system boot, - ** increases monotonically and wraps once 49.7 days have elapsed. - */ - struct timeval now; - DWORD milliseconds = GetTickCount(); - now.tv_sec = milliseconds / 1000; - now.tv_usec = (milliseconds % 1000) * 1000; - return now; -} - -#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) - -struct timeval ares__tvnow(void) -{ - /* - ** clock_gettime() is granted to be increased monotonically when the - ** monotonic clock is queried. Time starting point is unspecified, it - ** could be the system start-up time, the Epoch, or something else, - ** in any case the time starting point does not change once that the - ** system has started up. - */ - struct timeval now; - struct timespec tsnow; - if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) { - now.tv_sec = tsnow.tv_sec; - now.tv_usec = tsnow.tv_nsec / 1000; - } - /* - ** Even when the configure process has truly detected monotonic clock - ** availability, it might happen that it is not actually available at - ** run-time. When this occurs simply fallback to other time source. - */ -#ifdef HAVE_GETTIMEOFDAY - else - (void)gettimeofday(&now, NULL); /* LCOV_EXCL_LINE */ -#else - else { - now.tv_sec = (long)time(NULL); - now.tv_usec = 0; - } -#endif - return now; -} - -#elif defined(HAVE_GETTIMEOFDAY) - -struct timeval ares__tvnow(void) -{ - /* - ** gettimeofday() is not granted to be increased monotonically, due to - ** clock drifting and external source time synchronization it can jump - ** forward or backward in time. - */ - struct timeval now; - (void)gettimeofday(&now, NULL); - return now; -} - -#else - -struct timeval ares__tvnow(void) -{ - /* - ** time() returns the value of time in seconds since the Epoch. - */ - struct timeval now; - now.tv_sec = (long)time(NULL); - now.tv_usec = 0; - return now; -} - -#endif - -#if 0 /* Not used */ -/* - * Make sure that the first argument is the more recent time, as otherwise - * we'll get a weird negative time-diff back... - * - * Returns: the time difference in number of milliseconds. - */ -long ares__tvdiff(struct timeval newer, struct timeval older) -{ - return (newer.tv_sec-older.tv_sec)*1000+ - (newer.tv_usec-older.tv_usec)/1000; -} -#endif - diff --git a/lib/c-ares-1.19.1/src/lib/ares_android.h b/lib/c-ares-1.19.1/src/lib/ares_android.h deleted file mode 100644 index 93fb75f5850..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_android.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2017 by John Schember - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#ifndef __ARES_ANDROID_H__ -#define __ARES_ANDROID_H__ - -#if defined(ANDROID) || defined(__ANDROID__) - -char **ares_get_android_server_list(size_t max_servers, size_t *num_servers); -char *ares_get_android_search_domains_list(void); -void ares_library_cleanup_android(void); - -#endif - -#endif /* __ARES_ANDROID_H__ */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_cancel.c b/lib/c-ares-1.19.1/src/lib/ares_cancel.c deleted file mode 100644 index 465cc9e95ee..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_cancel.c +++ /dev/null @@ -1,63 +0,0 @@ - -/* Copyright (C) 2004 by Daniel Stenberg et al - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include - -#include "ares.h" -#include "ares_private.h" - -/* - * ares_cancel() cancels all ongoing requests/resolves that might be going on - * on the given channel. It does NOT kill the channel, use ares_destroy() for - * that. - */ -void ares_cancel(ares_channel channel) -{ - struct query *query; - struct list_node list_head_copy; - struct list_node* list_head; - struct list_node* list_node; - int i; - - if (!ares__is_list_empty(&(channel->all_queries))) - { - /* Swap list heads, so that only those queries which were present on entry - * into this function are cancelled. New queries added by callbacks of - * queries being cancelled will not be cancelled themselves. - */ - list_head = &(channel->all_queries); - list_head_copy.prev = list_head->prev; - list_head_copy.next = list_head->next; - list_head_copy.prev->next = &list_head_copy; - list_head_copy.next->prev = &list_head_copy; - list_head->prev = list_head; - list_head->next = list_head; - for (list_node = list_head_copy.next; list_node != &list_head_copy; ) - { - query = list_node->data; - list_node = list_node->next; /* since we're deleting the query */ - query->callback(query->arg, ARES_ECANCELLED, 0, NULL, 0); - ares__free_query(query); - } - } - if (!(channel->flags & ARES_FLAG_STAYOPEN) && ares__is_list_empty(&(channel->all_queries))) - { - if (channel->servers) - { - for (i = 0; i < channel->nservers; i++) - ares__close_sockets(channel, &channel->servers[i]); - } - } -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_create_query.c b/lib/c-ares-1.19.1/src/lib/ares_create_query.c deleted file mode 100644 index e3d874b4509..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_create_query.c +++ /dev/null @@ -1,197 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_dns.h" -#include "ares_private.h" - - -/* Header format, from RFC 1035: - * 1 1 1 1 1 1 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | ID | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * |QR| Opcode |AA|TC|RD|RA| Z | RCODE | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | QDCOUNT | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | ANCOUNT | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | NSCOUNT | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | ARCOUNT | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * - * AA, TC, RA, and RCODE are only set in responses. Brief description - * of the remaining fields: - * ID Identifier to match responses with queries - * QR Query (0) or response (1) - * Opcode For our purposes, always O_QUERY - * RD Recursion desired - * Z Reserved (zero) - * QDCOUNT Number of queries - * ANCOUNT Number of answers - * NSCOUNT Number of name server records - * ARCOUNT Number of additional records - * - * Question format, from RFC 1035: - * 1 1 1 1 1 1 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | | - * / QNAME / - * / / - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | QTYPE | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | QCLASS | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * - * The query name is encoded as a series of labels, each represented - * as a one-byte length (maximum 63) followed by the text of the - * label. The list is terminated by a label of length zero (which can - * be thought of as the root domain). - */ - -int ares_create_query(const char *name, int dnsclass, int type, - unsigned short id, int rd, unsigned char **bufp, - int *buflenp, int max_udp_size) -{ - size_t len; - unsigned char *q; - const char *p; - size_t buflen; - unsigned char *buf; - - /* Set our results early, in case we bail out early with an error. */ - *buflenp = 0; - *bufp = NULL; - - /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */ - if (ares__is_onion_domain(name)) - return ARES_ENOTFOUND; - - /* Allocate a memory area for the maximum size this packet might need. +2 - * is for the length byte and zero termination if no dots or ecscaping is - * used. - */ - len = strlen(name) + 2 + HFIXEDSZ + QFIXEDSZ + - (max_udp_size ? EDNSFIXEDSZ : 0); - buf = ares_malloc(len); - if (!buf) - return ARES_ENOMEM; - - /* Set up the header. */ - q = buf; - memset(q, 0, HFIXEDSZ); - DNS_HEADER_SET_QID(q, id); - DNS_HEADER_SET_OPCODE(q, O_QUERY); - if (rd) { - DNS_HEADER_SET_RD(q, 1); - } - else { - DNS_HEADER_SET_RD(q, 0); - } - DNS_HEADER_SET_QDCOUNT(q, 1); - - if (max_udp_size) { - DNS_HEADER_SET_ARCOUNT(q, 1); - } - - /* A name of "." is a screw case for the loop below, so adjust it. */ - if (strcmp(name, ".") == 0) - name++; - - /* Start writing out the name after the header. */ - q += HFIXEDSZ; - while (*name) - { - if (*name == '.') { - ares_free (buf); - return ARES_EBADNAME; - } - - /* Count the number of bytes in this label. */ - len = 0; - for (p = name; *p && *p != '.'; p++) - { - if (*p == '\\' && *(p + 1) != 0) - p++; - len++; - } - if (len > MAXLABEL) { - ares_free (buf); - return ARES_EBADNAME; - } - - /* Encode the length and copy the data. */ - *q++ = (unsigned char)len; - for (p = name; *p && *p != '.'; p++) - { - if (*p == '\\' && *(p + 1) != 0) - p++; - *q++ = *p; - } - - /* Go to the next label and repeat, unless we hit the end. */ - if (!*p) - break; - name = p + 1; - } - - /* Add the zero-length label at the end. */ - *q++ = 0; - - /* Finish off the question with the type and class. */ - DNS_QUESTION_SET_TYPE(q, type); - DNS_QUESTION_SET_CLASS(q, dnsclass); - - q += QFIXEDSZ; - if (max_udp_size) - { - memset(q, 0, EDNSFIXEDSZ); - q++; - DNS_RR_SET_TYPE(q, T_OPT); - DNS_RR_SET_CLASS(q, max_udp_size); - q += (EDNSFIXEDSZ-1); - } - buflen = (q - buf); - - /* Reject names that are longer than the maximum of 255 bytes that's - * specified in RFC 1035 ("To simplify implementations, the total length of - * a domain name (i.e., label octets and label length octets) is restricted - * to 255 octets or less."). */ - if (buflen > (size_t)(MAXCDNAME + HFIXEDSZ + QFIXEDSZ + - (max_udp_size ? EDNSFIXEDSZ : 0))) { - ares_free (buf); - return ARES_EBADNAME; - } - - /* we know this fits in an int at this point */ - *buflenp = (int) buflen; - *bufp = buf; - - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_data.c b/lib/c-ares-1.19.1/src/lib/ares_data.c deleted file mode 100644 index 69dff06689a..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_data.c +++ /dev/null @@ -1,256 +0,0 @@ - -/* Copyright (C) 2009-2013 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - - -#include "ares_setup.h" - -#include - -#include "ares.h" -#include "ares_data.h" -#include "ares_private.h" - - -/* -** ares_free_data() - c-ares external API function. -** -** This function must be used by the application to free data memory that -** has been internally allocated by some c-ares function and for which a -** pointer has already been returned to the calling application. The list -** of c-ares functions returning pointers that must be free'ed using this -** function is: -** -** ares_get_servers() -** ares_parse_srv_reply() -** ares_parse_txt_reply() -*/ - -void ares_free_data(void *dataptr) -{ - while (dataptr != NULL) { - struct ares_data *ptr; - void *next_data = NULL; - -#ifdef __INTEL_COMPILER -# pragma warning(push) -# pragma warning(disable:1684) - /* 1684: conversion from pointer to same-sized integral type */ -#endif - - ptr = (void *)((char *)dataptr - offsetof(struct ares_data, data)); - -#ifdef __INTEL_COMPILER -# pragma warning(pop) -#endif - - if (ptr->mark != ARES_DATATYPE_MARK) - return; - - switch (ptr->type) - { - case ARES_DATATYPE_MX_REPLY: - - if (ptr->data.mx_reply.next) - next_data = ptr->data.mx_reply.next; - if (ptr->data.mx_reply.host) - ares_free(ptr->data.mx_reply.host); - break; - - case ARES_DATATYPE_SRV_REPLY: - - if (ptr->data.srv_reply.next) - next_data = ptr->data.srv_reply.next; - if (ptr->data.srv_reply.host) - ares_free(ptr->data.srv_reply.host); - break; - - case ARES_DATATYPE_URI_REPLY: - - if (ptr->data.uri_reply.next) - next_data = ptr->data.uri_reply.next; - if (ptr->data.uri_reply.uri) - ares_free(ptr->data.uri_reply.uri); - break; - - case ARES_DATATYPE_TXT_REPLY: - case ARES_DATATYPE_TXT_EXT: - - if (ptr->data.txt_reply.next) - next_data = ptr->data.txt_reply.next; - if (ptr->data.txt_reply.txt) - ares_free(ptr->data.txt_reply.txt); - break; - - case ARES_DATATYPE_ADDR_NODE: - - if (ptr->data.addr_node.next) - next_data = ptr->data.addr_node.next; - break; - - case ARES_DATATYPE_ADDR_PORT_NODE: - - if (ptr->data.addr_port_node.next) - next_data = ptr->data.addr_port_node.next; - break; - - case ARES_DATATYPE_NAPTR_REPLY: - - if (ptr->data.naptr_reply.next) - next_data = ptr->data.naptr_reply.next; - if (ptr->data.naptr_reply.flags) - ares_free(ptr->data.naptr_reply.flags); - if (ptr->data.naptr_reply.service) - ares_free(ptr->data.naptr_reply.service); - if (ptr->data.naptr_reply.regexp) - ares_free(ptr->data.naptr_reply.regexp); - if (ptr->data.naptr_reply.replacement) - ares_free(ptr->data.naptr_reply.replacement); - break; - - case ARES_DATATYPE_SOA_REPLY: - if (ptr->data.soa_reply.nsname) - ares_free(ptr->data.soa_reply.nsname); - if (ptr->data.soa_reply.hostmaster) - ares_free(ptr->data.soa_reply.hostmaster); - break; - - case ARES_DATATYPE_CAA_REPLY: - - if (ptr->data.caa_reply.next) - next_data = ptr->data.caa_reply.next; - if (ptr->data.caa_reply.property) - ares_free(ptr->data.caa_reply.property); - if (ptr->data.caa_reply.value) - ares_free(ptr->data.caa_reply.value); - break; - - default: - return; - } - - ares_free(ptr); - dataptr = next_data; - } -} - - -/* -** ares_malloc_data() - c-ares internal helper function. -** -** This function allocates memory for a c-ares private ares_data struct -** for the specified ares_datatype, initializes c-ares private fields -** and zero initializes those which later might be used from the public -** API. It returns an interior pointer which can be passed by c-ares -** functions to the calling application, and that must be free'ed using -** c-ares external API function ares_free_data(). -*/ - -void *ares_malloc_data(ares_datatype type) -{ - struct ares_data *ptr; - - ptr = ares_malloc(sizeof(struct ares_data)); - if (!ptr) - return NULL; - - switch (type) - { - case ARES_DATATYPE_MX_REPLY: - ptr->data.mx_reply.next = NULL; - ptr->data.mx_reply.host = NULL; - ptr->data.mx_reply.priority = 0; - break; - - case ARES_DATATYPE_SRV_REPLY: - ptr->data.srv_reply.next = NULL; - ptr->data.srv_reply.host = NULL; - ptr->data.srv_reply.priority = 0; - ptr->data.srv_reply.weight = 0; - ptr->data.srv_reply.port = 0; - break; - - case ARES_DATATYPE_URI_REPLY: - ptr->data.uri_reply.next = NULL; - ptr->data.uri_reply.priority = 0; - ptr->data.uri_reply.weight = 0; - ptr->data.uri_reply.uri = NULL; - ptr->data.uri_reply.ttl = 0; - break; - - case ARES_DATATYPE_TXT_EXT: - ptr->data.txt_ext.record_start = 0; - /* FALLTHROUGH */ - - case ARES_DATATYPE_TXT_REPLY: - ptr->data.txt_reply.next = NULL; - ptr->data.txt_reply.txt = NULL; - ptr->data.txt_reply.length = 0; - break; - - case ARES_DATATYPE_CAA_REPLY: - ptr->data.caa_reply.next = NULL; - ptr->data.caa_reply.plength = 0; - ptr->data.caa_reply.property = NULL; - ptr->data.caa_reply.length = 0; - ptr->data.caa_reply.value = NULL; - break; - - case ARES_DATATYPE_ADDR_NODE: - ptr->data.addr_node.next = NULL; - ptr->data.addr_node.family = 0; - memset(&ptr->data.addr_node.addrV6, 0, - sizeof(ptr->data.addr_node.addrV6)); - break; - - case ARES_DATATYPE_ADDR_PORT_NODE: - ptr->data.addr_port_node.next = NULL; - ptr->data.addr_port_node.family = 0; - ptr->data.addr_port_node.udp_port = 0; - ptr->data.addr_port_node.tcp_port = 0; - memset(&ptr->data.addr_port_node.addrV6, 0, - sizeof(ptr->data.addr_port_node.addrV6)); - break; - - case ARES_DATATYPE_NAPTR_REPLY: - ptr->data.naptr_reply.next = NULL; - ptr->data.naptr_reply.flags = NULL; - ptr->data.naptr_reply.service = NULL; - ptr->data.naptr_reply.regexp = NULL; - ptr->data.naptr_reply.replacement = NULL; - ptr->data.naptr_reply.order = 0; - ptr->data.naptr_reply.preference = 0; - break; - - case ARES_DATATYPE_SOA_REPLY: - ptr->data.soa_reply.nsname = NULL; - ptr->data.soa_reply.hostmaster = NULL; - ptr->data.soa_reply.serial = 0; - ptr->data.soa_reply.refresh = 0; - ptr->data.soa_reply.retry = 0; - ptr->data.soa_reply.expire = 0; - ptr->data.soa_reply.minttl = 0; - break; - - default: - ares_free(ptr); - return NULL; - } - - ptr->mark = ARES_DATATYPE_MARK; - ptr->type = type; - - return &ptr->data; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_data.h b/lib/c-ares-1.19.1/src/lib/ares_data.h deleted file mode 100644 index a682ad54cb9..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_data.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef __ARES_DATA_H -#define __ARES_DATA_H - - -/* Copyright (C) 2009-2013 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -typedef enum { - ARES_DATATYPE_UNKNOWN = 1, /* unknown data type - introduced in 1.7.0 */ - ARES_DATATYPE_SRV_REPLY, /* struct ares_srv_reply - introduced in 1.7.0 */ - ARES_DATATYPE_TXT_REPLY, /* struct ares_txt_reply - introduced in 1.7.0 */ - ARES_DATATYPE_TXT_EXT, /* struct ares_txt_ext - introduced in 1.11.0 */ - ARES_DATATYPE_ADDR_NODE, /* struct ares_addr_node - introduced in 1.7.1 */ - ARES_DATATYPE_MX_REPLY, /* struct ares_mx_reply - introduced in 1.7.2 */ - ARES_DATATYPE_NAPTR_REPLY,/* struct ares_naptr_reply - introduced in 1.7.6 */ - ARES_DATATYPE_SOA_REPLY, /* struct ares_soa_reply - introduced in 1.9.0 */ - ARES_DATATYPE_URI_REPLY, /* struct ares_uri_reply */ -#if 0 - ARES_DATATYPE_ADDR6TTL, /* struct ares_addrttl */ - ARES_DATATYPE_ADDRTTL, /* struct ares_addr6ttl */ - ARES_DATATYPE_HOSTENT, /* struct hostent */ - ARES_DATATYPE_OPTIONS, /* struct ares_options */ -#endif - ARES_DATATYPE_ADDR_PORT_NODE, /* struct ares_addr_port_node - introduced in 1.11.0 */ - ARES_DATATYPE_CAA_REPLY, /* struct ares_caa_reply - introduced in 1.17 */ - ARES_DATATYPE_LAST /* not used - introduced in 1.7.0 */ -} ares_datatype; - -#define ARES_DATATYPE_MARK 0xbead - -/* - * ares_data struct definition is internal to c-ares and shall not - * be exposed by the public API in order to allow future changes - * and extensions to it without breaking ABI. This will be used - * internally by c-ares as the container of multiple types of data - * dynamically allocated for which a reference will be returned - * to the calling application. - * - * c-ares API functions returning a pointer to c-ares internally - * allocated data will actually be returning an interior pointer - * into this ares_data struct. - * - * All this is 'invisible' to the calling application, the only - * requirement is that this kind of data must be free'ed by the - * calling application using ares_free_data() with the pointer - * it has received from a previous c-ares function call. - */ - -struct ares_data { - ares_datatype type; /* Actual data type identifier. */ - unsigned int mark; /* Private ares_data signature. */ - union { - struct ares_txt_reply txt_reply; - struct ares_txt_ext txt_ext; - struct ares_srv_reply srv_reply; - struct ares_addr_node addr_node; - struct ares_addr_port_node addr_port_node; - struct ares_mx_reply mx_reply; - struct ares_naptr_reply naptr_reply; - struct ares_soa_reply soa_reply; - struct ares_caa_reply caa_reply; - struct ares_uri_reply uri_reply; - } data; -}; - -void *ares_malloc_data(ares_datatype type); - - -#endif /* __ARES_DATA_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_destroy.c b/lib/c-ares-1.19.1/src/lib/ares_destroy.c deleted file mode 100644 index 62c899f82e0..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_destroy.c +++ /dev/null @@ -1,121 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2011 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include - -#include "ares.h" -#include "ares_private.h" - -void ares_destroy_options(struct ares_options *options) -{ - int i; - - if(options->servers) - ares_free(options->servers); - for (i = 0; i < options->ndomains; i++) - ares_free(options->domains[i]); - if(options->domains) - ares_free(options->domains); - if(options->sortlist) - ares_free(options->sortlist); - if(options->lookups) - ares_free(options->lookups); - if(options->resolvconf_path) - ares_free(options->resolvconf_path); - if(options->hosts_path) - ares_free(options->hosts_path); -} - -void ares_destroy(ares_channel channel) -{ - int i; - struct query *query; - struct list_node* list_head; - struct list_node* list_node; - - if (!channel) - return; - - list_head = &(channel->all_queries); - for (list_node = list_head->next; list_node != list_head; ) - { - query = list_node->data; - list_node = list_node->next; /* since we're deleting the query */ - query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL, 0); - ares__free_query(query); - } -#ifndef NDEBUG - /* Freeing the query should remove it from all the lists in which it sits, - * so all query lists should be empty now. - */ - assert(ares__is_list_empty(&(channel->all_queries))); - for (i = 0; i < ARES_QID_TABLE_SIZE; i++) - { - assert(ares__is_list_empty(&(channel->queries_by_qid[i]))); - } - for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) - { - assert(ares__is_list_empty(&(channel->queries_by_timeout[i]))); - } -#endif - - ares__destroy_servers_state(channel); - - if (channel->domains) { - for (i = 0; i < channel->ndomains; i++) - ares_free(channel->domains[i]); - ares_free(channel->domains); - } - - if(channel->sortlist) - ares_free(channel->sortlist); - - if (channel->lookups) - ares_free(channel->lookups); - - if (channel->resolvconf_path) - ares_free(channel->resolvconf_path); - - if (channel->hosts_path) - ares_free(channel->hosts_path); - - if (channel->rand_state) - ares__destroy_rand_state(channel->rand_state); - - ares_free(channel); -} - -void ares__destroy_servers_state(ares_channel channel) -{ - struct server_state *server; - int i; - - if (channel->servers) - { - for (i = 0; i < channel->nservers; i++) - { - server = &channel->servers[i]; - ares__close_sockets(channel, server); - assert(ares__is_list_empty(&server->queries_to_server)); - } - ares_free(channel->servers); - channel->servers = NULL; - } - channel->nservers = -1; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_expand_name.c b/lib/c-ares-1.19.1/src/lib/ares_expand_name.c deleted file mode 100644 index ad1c97f9377..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_expand_name.c +++ /dev/null @@ -1,311 +0,0 @@ - -/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_nowarn.h" -#include "ares_private.h" /* for the memdebug */ - -/* Maximum number of indirections allowed for a name */ -#define MAX_INDIRS 50 - -static int name_length(const unsigned char *encoded, const unsigned char *abuf, - int alen, int is_hostname); - -/* Reserved characters for names that need to be escaped */ -static int is_reservedch(int ch) -{ - switch (ch) { - case '"': - case '.': - case ';': - case '\\': - case '(': - case ')': - case '@': - case '$': - return 1; - default: - break; - } - - return 0; -} - -static int ares__isprint(int ch) -{ - if (ch >= 0x20 && ch <= 0x7E) - return 1; - return 0; -} - -/* Character set allowed by hostnames. This is to include the normal - * domain name character set plus: - * - underscores which are used in SRV records. - * - Forward slashes such as are used for classless in-addr.arpa - * delegation (CNAMEs) - * - Asterisks may be used for wildcard domains in CNAMEs as seen in the - * real world. - * While RFC 2181 section 11 does state not to do validation, - * that applies to servers, not clients. Vulnerabilities have been - * reported when this validation is not performed. Security is more - * important than edge-case compatibility (which is probably invalid - * anyhow). */ -static int is_hostnamech(int ch) -{ - /* [A-Za-z0-9-*._/] - * Don't use isalnum() as it is locale-specific - */ - if (ch >= 'A' && ch <= 'Z') - return 1; - if (ch >= 'a' && ch <= 'z') - return 1; - if (ch >= '0' && ch <= '9') - return 1; - if (ch == '-' || ch == '.' || ch == '_' || ch == '/' || ch == '*') - return 1; - - return 0; -} - -/* Expand an RFC1035-encoded domain name given by encoded. The - * containing message is given by abuf and alen. The result given by - * *s, which is set to a NUL-terminated allocated buffer. *enclen is - * set to the length of the encoded name (not the length of the - * expanded name; the goal is to tell the caller how many bytes to - * move forward to get past the encoded name). - * - * In the simple case, an encoded name is a series of labels, each - * composed of a one-byte length (limited to values between 0 and 63 - * inclusive) followed by the label contents. The name is terminated - * by a zero-length label. - * - * In the more complicated case, a label may be terminated by an - * indirection pointer, specified by two bytes with the high bits of - * the first byte (corresponding to INDIR_MASK) set to 11. With the - * two high bits of the first byte stripped off, the indirection - * pointer gives an offset from the beginning of the containing - * message with more labels to decode. Indirection can happen an - * arbitrary number of times, so we have to detect loops. - * - * Since the expanded name uses '.' as a label separator, we use - * backslashes to escape periods or backslashes in the expanded name. - * - * If the result is expected to be a hostname, then no escaped data is allowed - * and will return error. - */ - -int ares__expand_name_validated(const unsigned char *encoded, - const unsigned char *abuf, - int alen, char **s, long *enclen, - int is_hostname) -{ - int len, indir = 0; - char *q; - const unsigned char *p; - union { - ares_ssize_t sig; - size_t uns; - } nlen; - - nlen.sig = name_length(encoded, abuf, alen, is_hostname); - if (nlen.sig < 0) - return ARES_EBADNAME; - - *s = ares_malloc(nlen.uns + 1); - if (!*s) - return ARES_ENOMEM; - q = *s; - - if (nlen.uns == 0) { - /* RFC2181 says this should be ".": the root of the DNS tree. - * Since this function strips trailing dots though, it becomes "" - */ - q[0] = '\0'; - - /* indirect root label (like 0xc0 0x0c) is 2 bytes long (stupid, but - valid) */ - if ((*encoded & INDIR_MASK) == INDIR_MASK) - *enclen = 2L; - else - *enclen = 1L; /* the caller should move one byte to get past this */ - - return ARES_SUCCESS; - } - - /* No error-checking necessary; it was all done by name_length(). */ - p = encoded; - while (*p) - { - if ((*p & INDIR_MASK) == INDIR_MASK) - { - if (!indir) - { - *enclen = aresx_uztosl(p + 2U - encoded); - indir = 1; - } - p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1)); - } - else - { - int name_len = *p; - len = name_len; - p++; - - while (len--) - { - /* Output as \DDD for consistency with RFC1035 5.1, except - * for the special case of a root name response */ - if (!ares__isprint(*p) && !(name_len == 1 && *p == 0)) - { - *q++ = '\\'; - *q++ = (char)('0' + *p / 100); - *q++ = (char)('0' + (*p % 100) / 10); - *q++ = (char)('0' + (*p % 10)); - } - else if (is_reservedch(*p)) - { - *q++ = '\\'; - *q++ = *p; - } - else - { - *q++ = *p; - } - p++; - } - *q++ = '.'; - } - } - - if (!indir) - *enclen = aresx_uztosl(p + 1U - encoded); - - /* Nuke the trailing period if we wrote one. */ - if (q > *s) - *(q - 1) = 0; - else - *q = 0; /* zero terminate; LCOV_EXCL_LINE: empty names exit above */ - - return ARES_SUCCESS; -} - - -int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, - int alen, char **s, long *enclen) -{ - return ares__expand_name_validated(encoded, abuf, alen, s, enclen, 0); -} - -/* Return the length of the expansion of an encoded domain name, or - * -1 if the encoding is invalid. - */ -static int name_length(const unsigned char *encoded, const unsigned char *abuf, - int alen, int is_hostname) -{ - int n = 0, offset, indir = 0, top; - - /* Allow the caller to pass us abuf + alen and have us check for it. */ - if (encoded >= abuf + alen) - return -1; - - while (*encoded) - { - top = (*encoded & INDIR_MASK); - if (top == INDIR_MASK) - { - /* Check the offset and go there. */ - if (encoded + 1 >= abuf + alen) - return -1; - offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1); - if (offset >= alen) - return -1; - encoded = abuf + offset; - - /* If we've seen more indirects than the message length, - * then there's a loop. - */ - ++indir; - if (indir > alen || indir > MAX_INDIRS) - return -1; - } - else if (top == 0x00) - { - int name_len = *encoded; - offset = name_len; - if (encoded + offset + 1 >= abuf + alen) - return -1; - encoded++; - - while (offset--) - { - if (!ares__isprint(*encoded) && !(name_len == 1 && *encoded == 0)) - { - if (is_hostname) - return -1; - n += 4; - } - else if (is_reservedch(*encoded)) - { - if (is_hostname) - return -1; - n += 2; - } - else - { - if (is_hostname && !is_hostnamech(*encoded)) - return -1; - n += 1; - } - encoded++; - } - - n++; - } - else - { - /* RFC 1035 4.1.4 says other options (01, 10) for top 2 - * bits are reserved. - */ - return -1; - } - } - - /* If there were any labels at all, then the number of dots is one - * less than the number of labels, so subtract one. - */ - return (n) ? n - 1 : n; -} - -/* Like ares_expand_name_validated but returns EBADRESP in case of invalid - * input. */ -int ares__expand_name_for_response(const unsigned char *encoded, - const unsigned char *abuf, int alen, - char **s, long *enclen, int is_hostname) -{ - int status = ares__expand_name_validated(encoded, abuf, alen, s, enclen, - is_hostname); - if (status == ARES_EBADNAME) - status = ARES_EBADRESP; - return status; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_expand_string.c b/lib/c-ares-1.19.1/src/lib/ares_expand_string.c deleted file mode 100644 index 03e39299752..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_expand_string.c +++ /dev/null @@ -1,67 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_private.h" /* for the memdebug */ - -/* Simply decodes a length-encoded character string. The first byte of the - * input is the length of the string to be returned and the bytes thereafter - * are the characters of the string. The returned result will be NULL - * terminated. - */ -int ares_expand_string(const unsigned char *encoded, - const unsigned char *abuf, - int alen, - unsigned char **s, - long *enclen) -{ - unsigned char *q; - union { - ares_ssize_t sig; - size_t uns; - } elen; - - if (encoded == abuf+alen) - return ARES_EBADSTR; - - elen.uns = *encoded; - if (encoded+elen.sig+1 > abuf+alen) - return ARES_EBADSTR; - - encoded++; - - *s = ares_malloc(elen.uns+1); - if (*s == NULL) - return ARES_ENOMEM; - q = *s; - strncpy((char *)q, (char *)encoded, elen.uns); - q[elen.uns] = '\0'; - - *s = q; - - *enclen = (long)(elen.sig+1); - - return ARES_SUCCESS; -} - diff --git a/lib/c-ares-1.19.1/src/lib/ares_fds.c b/lib/c-ares-1.19.1/src/lib/ares_fds.c deleted file mode 100644 index f405fc047c7..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_fds.c +++ /dev/null @@ -1,59 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include "ares.h" -#include "ares_nowarn.h" -#include "ares_private.h" - -int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds) -{ - struct server_state *server; - ares_socket_t nfds; - int i; - - /* Are there any active queries? */ - int active_queries = !ares__is_list_empty(&(channel->all_queries)); - - nfds = 0; - for (i = 0; i < channel->nservers; i++) - { - server = &channel->servers[i]; - /* We only need to register interest in UDP sockets if we have - * outstanding queries. - */ - if (active_queries && server->udp_socket != ARES_SOCKET_BAD) - { - FD_SET(server->udp_socket, read_fds); - if (server->udp_socket >= nfds) - nfds = server->udp_socket + 1; - } - /* We always register for TCP events, because we want to know - * when the other side closes the connection, so we don't waste - * time trying to use a broken connection. - */ - if (server->tcp_socket != ARES_SOCKET_BAD) - { - FD_SET(server->tcp_socket, read_fds); - if (server->qhead) - FD_SET(server->tcp_socket, write_fds); - if (server->tcp_socket >= nfds) - nfds = server->tcp_socket + 1; - } - } - return (int)nfds; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_free_hostent.c b/lib/c-ares-1.19.1/src/lib/ares_free_hostent.c deleted file mode 100644 index ea28ff0e2c1..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_free_hostent.c +++ /dev/null @@ -1,43 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETDB_H -#include -#endif - -#include "ares.h" -#include "ares_private.h" /* for memdebug */ - -void ares_free_hostent(struct hostent *host) -{ - char **p; - - if (!host) - return; - - ares_free((char *)(host->h_name)); - for (p = host->h_aliases; p && *p; p++) - ares_free(*p); - ares_free(host->h_aliases); - if (host->h_addr_list) { - ares_free(host->h_addr_list[0]); /* no matter if there is one or many entries, - there is only one malloc for all of them */ - ares_free(host->h_addr_list); - } - ares_free(host); -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_free_string.c b/lib/c-ares-1.19.1/src/lib/ares_free_string.c deleted file mode 100644 index 024992e1c20..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_free_string.c +++ /dev/null @@ -1,25 +0,0 @@ - -/* Copyright 2000 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include "ares.h" -#include "ares_private.h" - -void ares_free_string(void *str) -{ - ares_free(str); -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_freeaddrinfo.c b/lib/c-ares-1.19.1/src/lib/ares_freeaddrinfo.c deleted file mode 100644 index ab871363d51..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_freeaddrinfo.c +++ /dev/null @@ -1,60 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2019 by Andrew Selivanov - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETDB_H -# include -#endif - -#include "ares.h" -#include "ares_private.h" - -void ares__freeaddrinfo_cnames(struct ares_addrinfo_cname *head) -{ - struct ares_addrinfo_cname *current; - while (head) - { - current = head; - head = head->next; - ares_free(current->alias); - ares_free(current->name); - ares_free(current); - } -} - -void ares__freeaddrinfo_nodes(struct ares_addrinfo_node *head) -{ - struct ares_addrinfo_node *current; - while (head) - { - current = head; - head = head->ai_next; - ares_free(current->ai_addr); - ares_free(current); - } -} - -void ares_freeaddrinfo(struct ares_addrinfo *ai) -{ - if (ai == NULL) - return; - ares__freeaddrinfo_cnames(ai->cnames); - ares__freeaddrinfo_nodes(ai->nodes); - ares_free(ai->name); - ares_free(ai); -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_getaddrinfo.c b/lib/c-ares-1.19.1/src/lib/ares_getaddrinfo.c deleted file mode 100644 index cb494242f28..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_getaddrinfo.c +++ /dev/null @@ -1,850 +0,0 @@ - -/* Copyright 1998, 2011, 2013 by the Massachusetts Institute of Technology. - * Copyright (C) 2017 - 2018 by Christian Ammer - * Copyright (C) 2019 by Andrew Selivanov - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_GETSERVBYNAME_R -# if !defined(GETSERVBYNAME_R_ARGS) || \ - (GETSERVBYNAME_R_ARGS < 4) || (GETSERVBYNAME_R_ARGS > 6) -# error "you MUST specifiy a valid number of arguments for getservbyname_r" -# endif -#endif - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -#include -#endif -#include - -#ifdef HAVE_LIMITS_H -#include -#endif - -#include "ares.h" -#include "bitncmp.h" -#include "ares_private.h" - -#ifdef WATT32 -#undef WIN32 -#endif -#ifdef WIN32 -# include "ares_platform.h" -#endif - -struct host_query -{ - ares_channel channel; - char *name; - unsigned short port; /* in host order */ - ares_addrinfo_callback callback; - void *arg; - struct ares_addrinfo_hints hints; - int sent_family; /* this family is what was is being used */ - int timeouts; /* number of timeouts we saw for this request */ - const char *remaining_lookups; /* types of lookup we need to perform ("fb" by - default, file and dns respectively) */ - struct ares_addrinfo *ai; /* store results between lookups */ - int remaining; /* number of DNS answers waiting for */ - int next_domain; /* next search domain to try */ - int nodata_cnt; /* Track nodata responses to possibly override final result */ -}; - -static const struct ares_addrinfo_hints default_hints = { - 0, /* ai_flags */ - AF_UNSPEC, /* ai_family */ - 0, /* ai_socktype */ - 0, /* ai_protocol */ -}; - -static const struct ares_addrinfo_cname empty_addrinfo_cname = { - INT_MAX, /* ttl */ - NULL, /* alias */ - NULL, /* name */ - NULL, /* next */ -}; - -static const struct ares_addrinfo_node empty_addrinfo_node = { - 0, /* ai_ttl */ - 0, /* ai_flags */ - 0, /* ai_family */ - 0, /* ai_socktype */ - 0, /* ai_protocol */ - 0, /* ai_addrlen */ - NULL, /* ai_addr */ - NULL /* ai_next */ -}; - -static const struct ares_addrinfo empty_addrinfo = { - NULL, /* cnames */ - NULL, /* nodes */ - NULL /* name */ -}; - -/* forward declarations */ -static void host_callback(void *arg, int status, int timeouts, - unsigned char *abuf, int alen); -static int as_is_first(const struct host_query *hquery); -static int as_is_only(const struct host_query* hquery); -static int next_dns_lookup(struct host_query *hquery); - -struct ares_addrinfo_cname *ares__malloc_addrinfo_cname() -{ - struct ares_addrinfo_cname *cname = ares_malloc(sizeof(struct ares_addrinfo_cname)); - if (!cname) - return NULL; - - *cname = empty_addrinfo_cname; - return cname; -} - -struct ares_addrinfo_cname *ares__append_addrinfo_cname(struct ares_addrinfo_cname **head) -{ - struct ares_addrinfo_cname *tail = ares__malloc_addrinfo_cname(); - struct ares_addrinfo_cname *last = *head; - if (!last) - { - *head = tail; - return tail; - } - - while (last->next) - { - last = last->next; - } - - last->next = tail; - return tail; -} - -void ares__addrinfo_cat_cnames(struct ares_addrinfo_cname **head, - struct ares_addrinfo_cname *tail) -{ - struct ares_addrinfo_cname *last = *head; - if (!last) - { - *head = tail; - return; - } - - while (last->next) - { - last = last->next; - } - - last->next = tail; -} - -struct ares_addrinfo *ares__malloc_addrinfo() -{ - struct ares_addrinfo *ai = ares_malloc(sizeof(struct ares_addrinfo)); - if (!ai) - return NULL; - - *ai = empty_addrinfo; - return ai; -} - -struct ares_addrinfo_node *ares__malloc_addrinfo_node() -{ - struct ares_addrinfo_node *node = - ares_malloc(sizeof(struct ares_addrinfo_node)); - if (!node) - return NULL; - - *node = empty_addrinfo_node; - return node; -} - -/* Allocate new addrinfo and append to the tail. */ -struct ares_addrinfo_node *ares__append_addrinfo_node(struct ares_addrinfo_node **head) -{ - struct ares_addrinfo_node *tail = ares__malloc_addrinfo_node(); - struct ares_addrinfo_node *last = *head; - if (!last) - { - *head = tail; - return tail; - } - - while (last->ai_next) - { - last = last->ai_next; - } - - last->ai_next = tail; - return tail; -} - -void ares__addrinfo_cat_nodes(struct ares_addrinfo_node **head, - struct ares_addrinfo_node *tail) -{ - struct ares_addrinfo_node *last = *head; - if (!last) - { - *head = tail; - return; - } - - while (last->ai_next) - { - last = last->ai_next; - } - - last->ai_next = tail; -} - -/* Resolve service name into port number given in host byte order. - * If not resolved, return 0. - */ -static unsigned short lookup_service(const char *service, int flags) -{ - const char *proto; - struct servent *sep; -#ifdef HAVE_GETSERVBYNAME_R - struct servent se; - char tmpbuf[4096]; -#endif - - if (service) - { - if (flags & ARES_NI_UDP) - proto = "udp"; - else if (flags & ARES_NI_SCTP) - proto = "sctp"; - else if (flags & ARES_NI_DCCP) - proto = "dccp"; - else - proto = "tcp"; -#ifdef HAVE_GETSERVBYNAME_R - memset(&se, 0, sizeof(se)); - sep = &se; - memset(tmpbuf, 0, sizeof(tmpbuf)); -#if GETSERVBYNAME_R_ARGS == 6 - if (getservbyname_r(service, proto, &se, (void *)tmpbuf, sizeof(tmpbuf), - &sep) != 0) - sep = NULL; /* LCOV_EXCL_LINE: buffer large so this never fails */ -#elif GETSERVBYNAME_R_ARGS == 5 - sep = - getservbyname_r(service, proto, &se, (void *)tmpbuf, sizeof(tmpbuf)); -#elif GETSERVBYNAME_R_ARGS == 4 - if (getservbyname_r(service, proto, &se, (void *)tmpbuf) != 0) - sep = NULL; -#else - /* Lets just hope the OS uses TLS! */ - sep = getservbyname(service, proto); -#endif -#else - /* Lets just hope the OS uses TLS! */ -#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) - sep = getservbyname(service, (char *)proto); -#else - sep = getservbyname(service, proto); -#endif -#endif - return (sep ? ntohs((unsigned short)sep->s_port) : 0); - } - return 0; -} - -/* If the name looks like an IP address or an error occured, - * fake up a host entry, end the query immediately, and return true. - * Otherwise return false. - */ -static int fake_addrinfo(const char *name, - unsigned short port, - const struct ares_addrinfo_hints *hints, - struct ares_addrinfo *ai, - ares_addrinfo_callback callback, - void *arg) -{ - struct ares_addrinfo_cname *cname; - int status = ARES_SUCCESS; - int result = 0; - int family = hints->ai_family; - if (family == AF_INET || family == AF_INET6 || family == AF_UNSPEC) - { - /* It only looks like an IP address if it's all numbers and dots. */ - int numdots = 0, valid = 1; - const char *p; - for (p = name; *p; p++) - { - if (!ISDIGIT(*p) && *p != '.') - { - valid = 0; - break; - } - else if (*p == '.') - { - numdots++; - } - } - - /* if we don't have 3 dots, it is illegal - * (although inet_pton doesn't think so). - */ - if (numdots != 3 || !valid) - result = 0; - else - { - struct in_addr addr4; - result = ares_inet_pton(AF_INET, name, &addr4) < 1 ? 0 : 1; - if (result) - { - status = ares_append_ai_node(AF_INET, port, 0, &addr4, &ai->nodes); - if (status != ARES_SUCCESS) - { - callback(arg, status, 0, NULL); - return 1; - } - } - } - } - - if (!result && (family == AF_INET6 || family == AF_UNSPEC)) - { - struct ares_in6_addr addr6; - result = ares_inet_pton(AF_INET6, name, &addr6) < 1 ? 0 : 1; - if (result) - { - status = ares_append_ai_node(AF_INET6, port, 0, &addr6, &ai->nodes); - if (status != ARES_SUCCESS) - { - callback(arg, status, 0, NULL); - return 1; - } - } - } - - if (!result) - return 0; - - if (hints->ai_flags & ARES_AI_CANONNAME) - { - cname = ares__append_addrinfo_cname(&ai->cnames); - if (!cname) - { - ares_freeaddrinfo(ai); - callback(arg, ARES_ENOMEM, 0, NULL); - return 1; - } - - /* Duplicate the name, to avoid a constness violation. */ - cname->name = ares_strdup(name); - if (!cname->name) - { - ares_freeaddrinfo(ai); - callback(arg, ARES_ENOMEM, 0, NULL); - return 1; - } - } - - ai->nodes->ai_socktype = hints->ai_socktype; - ai->nodes->ai_protocol = hints->ai_protocol; - - callback(arg, ARES_SUCCESS, 0, ai); - return 1; -} - -static void end_hquery(struct host_query *hquery, int status) -{ - struct ares_addrinfo_node sentinel; - struct ares_addrinfo_node *next; - if (status == ARES_SUCCESS) - { - if (!(hquery->hints.ai_flags & ARES_AI_NOSORT) && hquery->ai->nodes) - { - sentinel.ai_next = hquery->ai->nodes; - ares__sortaddrinfo(hquery->channel, &sentinel); - hquery->ai->nodes = sentinel.ai_next; - } - next = hquery->ai->nodes; - - while (next) - { - next->ai_socktype = hquery->hints.ai_socktype; - next->ai_protocol = hquery->hints.ai_protocol; - next = next->ai_next; - } - } - else - { - /* Clean up what we have collected by so far. */ - ares_freeaddrinfo(hquery->ai); - hquery->ai = NULL; - } - - hquery->callback(hquery->arg, status, hquery->timeouts, hquery->ai); - ares_free(hquery->name); - ares_free(hquery); -} - -static int is_localhost(const char *name) -{ - /* RFC6761 6.3 says : The domain "localhost." and any names falling within ".localhost." */ - size_t len; - - if (name == NULL) - return 0; - - if (strcmp(name, "localhost") == 0) - return 1; - - len = strlen(name); - if (len < 10 /* strlen(".localhost") */) - return 0; - - if (strcmp(name + (len - 10 /* strlen(".localhost") */), ".localhost") == 0) - return 1; - - return 0; -} - -static int file_lookup(struct host_query *hquery) -{ - FILE *fp; - int error; - int status; - char *path_hosts = NULL; - - if (hquery->hints.ai_flags & ARES_AI_ENVHOSTS) - { - path_hosts = ares_strdup(getenv("CARES_HOSTS")); - if (!path_hosts) - return ARES_ENOMEM; - } - - if (hquery->channel->hosts_path) - { - path_hosts = ares_strdup(hquery->channel->hosts_path); - if (!path_hosts) - return ARES_ENOMEM; - } - - if (!path_hosts) - { -#ifdef WIN32 - char PATH_HOSTS[MAX_PATH]; - win_platform platform; - - PATH_HOSTS[0] = '\0'; - - platform = ares__getplatform(); - - if (platform == WIN_NT) - { - char tmp[MAX_PATH]; - HKEY hkeyHosts; - - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, - &hkeyHosts) == ERROR_SUCCESS) - { - DWORD dwLength = MAX_PATH; - RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, - &dwLength); - ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH); - RegCloseKey(hkeyHosts); - } - } - else if (platform == WIN_9X) - GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH); - else - return ARES_ENOTFOUND; - - strcat(PATH_HOSTS, WIN_PATH_HOSTS); -#elif defined(WATT32) - const char *PATH_HOSTS = _w32_GetHostsFile(); - - if (!PATH_HOSTS) - return ARES_ENOTFOUND; -#endif - path_hosts = ares_strdup(PATH_HOSTS); - if (!path_hosts) - return ARES_ENOMEM; - } - - fp = fopen(path_hosts, "r"); - if (!fp) - { - error = ERRNO; - switch (error) - { - case ENOENT: - case ESRCH: - status = ARES_ENOTFOUND; - break; - default: - DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", error, - strerror(error))); - DEBUGF(fprintf(stderr, "Error opening file: %s\n", path_hosts)); - status = ARES_EFILE; - break; - } - } - else - { - status = ares__readaddrinfo(fp, hquery->name, hquery->port, &hquery->hints, hquery->ai); - fclose(fp); - } - ares_free(path_hosts); - - /* RFC6761 section 6.3 #3 states that "Name resolution APIs and libraries - * SHOULD recognize localhost names as special and SHOULD always return the - * IP loopback address for address queries". - * We will also ignore ALL errors when trying to resolve localhost, such - * as permissions errors reading /etc/hosts or a malformed /etc/hosts */ - if (status != ARES_SUCCESS && is_localhost(hquery->name)) - { - return ares__addrinfo_localhost(hquery->name, hquery->port, - &hquery->hints, hquery->ai); - } - - return status; -} - -static void next_lookup(struct host_query *hquery, int status) -{ - switch (*hquery->remaining_lookups) - { - case 'b': - /* RFC6761 section 6.3 #3 says "Name resolution APIs SHOULD NOT send - * queries for localhost names to their configured caching DNS - * server(s)." */ - if (!is_localhost(hquery->name)) - { - /* DNS lookup */ - if (next_dns_lookup(hquery)) - break; - } - - hquery->remaining_lookups++; - next_lookup(hquery, status); - break; - - case 'f': - /* Host file lookup */ - if (file_lookup(hquery) == ARES_SUCCESS) - { - end_hquery(hquery, ARES_SUCCESS); - break; - } - hquery->remaining_lookups++; - next_lookup(hquery, status); - break; - default: - /* No lookup left */ - end_hquery(hquery, status); - break; - } -} - -static void host_callback(void *arg, int status, int timeouts, - unsigned char *abuf, int alen) -{ - struct host_query *hquery = (struct host_query*)arg; - int addinfostatus = ARES_SUCCESS; - hquery->timeouts += timeouts; - hquery->remaining--; - - if (status == ARES_SUCCESS) - { - addinfostatus = ares__parse_into_addrinfo(abuf, alen, 1, hquery->port, hquery->ai); - } - - if (!hquery->remaining) - { - if (addinfostatus != ARES_SUCCESS && addinfostatus != ARES_ENODATA) - { - /* error in parsing result e.g. no memory */ - if (addinfostatus == ARES_EBADRESP && hquery->ai->nodes) - { - /* We got a bad response from server, but at least one query - * ended with ARES_SUCCESS */ - end_hquery(hquery, ARES_SUCCESS); - } - else - { - end_hquery(hquery, addinfostatus); - } - } - else if (hquery->ai->nodes) - { - /* at least one query ended with ARES_SUCCESS */ - end_hquery(hquery, ARES_SUCCESS); - } - else if (status == ARES_ENOTFOUND || status == ARES_ENODATA || - addinfostatus == ARES_ENODATA) - { - if (status == ARES_ENODATA || addinfostatus == ARES_ENODATA) - hquery->nodata_cnt++; - next_lookup(hquery, hquery->nodata_cnt?ARES_ENODATA:status); - } - else if (status == ARES_EDESTRUCTION) - { - /* NOTE: Could also be ARES_EDESTRUCTION. We need to only call this - * once all queries (there can be multiple for getaddrinfo) are - * terminated. */ - end_hquery(hquery, status); - } - else - { - end_hquery(hquery, status); - } - } - - /* at this point we keep on waiting for the next query to finish */ -} - -void ares_getaddrinfo(ares_channel channel, - const char* name, const char* service, - const struct ares_addrinfo_hints* hints, - ares_addrinfo_callback callback, void* arg) -{ - struct host_query *hquery; - unsigned short port = 0; - int family; - struct ares_addrinfo *ai; - char *alias_name = NULL; - int status; - - if (!hints) - { - hints = &default_hints; - } - - family = hints->ai_family; - - /* Right now we only know how to look up Internet addresses - and unspec means try both basically. */ - if (family != AF_INET && - family != AF_INET6 && - family != AF_UNSPEC) - { - callback(arg, ARES_ENOTIMP, 0, NULL); - return; - } - - if (ares__is_onion_domain(name)) - { - callback(arg, ARES_ENOTFOUND, 0, NULL); - return; - } - - /* perform HOSTALIAS resolution (technically this function does some other - * things we are going to ignore) */ - status = ares__single_domain(channel, name, &alias_name); - if (status != ARES_SUCCESS) { - callback(arg, status, 0, NULL); - return; - } - - if (alias_name) - name = alias_name; - - if (service) - { - if (hints->ai_flags & ARES_AI_NUMERICSERV) - { - unsigned long val; - errno = 0; - val = strtoul(service, NULL, 0); - if ((val == 0 && errno != 0) || val > 65535) - { - ares_free(alias_name); - callback(arg, ARES_ESERVICE, 0, NULL); - return; - } - port = (unsigned short)val; - } - else - { - port = lookup_service(service, 0); - if (!port) - { - unsigned long val; - errno = 0; - val = strtoul(service, NULL, 0); - if ((val == 0 && errno != 0) || val > 65535) - { - ares_free(alias_name); - callback(arg, ARES_ESERVICE, 0, NULL); - return; - } - port = (unsigned short)val; - } - } - } - - ai = ares__malloc_addrinfo(); - if (!ai) - { - ares_free(alias_name); - callback(arg, ARES_ENOMEM, 0, NULL); - return; - } - - if (fake_addrinfo(name, port, hints, ai, callback, arg)) - { - ares_free(alias_name); - return; - } - - /* Allocate and fill in the host query structure. */ - hquery = ares_malloc(sizeof(struct host_query)); - if (!hquery) - { - ares_free(alias_name); - ares_freeaddrinfo(ai); - callback(arg, ARES_ENOMEM, 0, NULL); - return; - } - - hquery->name = ares_strdup(name); - ares_free(alias_name); - if (!hquery->name) - { - ares_free(hquery); - ares_freeaddrinfo(ai); - callback(arg, ARES_ENOMEM, 0, NULL); - return; - } - - hquery->port = port; - hquery->channel = channel; - hquery->hints = *hints; - hquery->sent_family = -1; /* nothing is sent yet */ - hquery->callback = callback; - hquery->arg = arg; - hquery->remaining_lookups = channel->lookups; - hquery->timeouts = 0; - hquery->ai = ai; - hquery->next_domain = -1; - hquery->remaining = 0; - hquery->nodata_cnt = 0; - - /* Start performing lookups according to channel->lookups. */ - next_lookup(hquery, ARES_ECONNREFUSED /* initial error code */); -} - -static int next_dns_lookup(struct host_query *hquery) -{ - char *s = NULL; - int is_s_allocated = 0; - int status; - - /* if next_domain == -1 and as_is_first is true, try hquery->name */ - if (hquery->next_domain == -1) - { - if (as_is_first(hquery)) - { - s = hquery->name; - } - hquery->next_domain = 0; - } - - /* if as_is_first is false, try hquery->name at last */ - if (!s && hquery->next_domain == hquery->channel->ndomains) { - if (!as_is_first(hquery)) - { - s = hquery->name; - } - hquery->next_domain++; - } - - if (!s && hquery->next_domain < hquery->channel->ndomains && !as_is_only(hquery)) - { - status = ares__cat_domain( - hquery->name, - hquery->channel->domains[hquery->next_domain++], - &s); - if (status == ARES_SUCCESS) - { - is_s_allocated = 1; - } - } - - if (s) - { - switch (hquery->hints.ai_family) - { - case AF_INET: - hquery->remaining += 1; - ares_query(hquery->channel, s, C_IN, T_A, host_callback, hquery); - break; - case AF_INET6: - hquery->remaining += 1; - ares_query(hquery->channel, s, C_IN, T_AAAA, host_callback, hquery); - break; - case AF_UNSPEC: - hquery->remaining += 2; - ares_query(hquery->channel, s, C_IN, T_A, host_callback, hquery); - ares_query(hquery->channel, s, C_IN, T_AAAA, host_callback, hquery); - break; - default: break; - } - if (is_s_allocated) - { - ares_free(s); - } - return 1; - } - else - { - assert(!hquery->ai->nodes); - return 0; - } -} - -static int as_is_first(const struct host_query* hquery) -{ - char* p; - int ndots = 0; - size_t nname = hquery->name?strlen(hquery->name):0; - for (p = hquery->name; *p; p++) - { - if (*p == '.') - { - ndots++; - } - } - if (nname && hquery->name[nname-1] == '.') - { - /* prevent ARES_EBADNAME for valid FQDN, where ndots < channel->ndots */ - return 1; - } - return ndots >= hquery->channel->ndots; -} - -static int as_is_only(const struct host_query* hquery) -{ - size_t nname = hquery->name?strlen(hquery->name):0; - if (nname && hquery->name[nname-1] == '.') - return 1; - return 0; -} - diff --git a/lib/c-ares-1.19.1/src/lib/ares_getenv.c b/lib/c-ares-1.19.1/src/lib/ares_getenv.c deleted file mode 100644 index f6e4dc29526..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_getenv.c +++ /dev/null @@ -1,28 +0,0 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include "ares_getenv.h" - -#ifndef HAVE_GETENV - -char *ares_getenv(const char *name) -{ - return NULL; -} - -#endif diff --git a/lib/c-ares-1.19.1/src/lib/ares_getenv.h b/lib/c-ares-1.19.1/src/lib/ares_getenv.h deleted file mode 100644 index 6da6cc5081a..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_getenv.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef HEADER_CARES_GETENV_H -#define HEADER_CARES_GETENV_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifndef HAVE_GETENV -extern char *ares_getenv(const char *name); -#endif - -#endif /* HEADER_CARES_GETENV_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_gethostbyaddr.c b/lib/c-ares-1.19.1/src/lib/ares_gethostbyaddr.c deleted file mode 100644 index c62d230d96e..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_gethostbyaddr.c +++ /dev/null @@ -1,287 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_inet_net_pton.h" -#include "ares_platform.h" -#include "ares_private.h" - -#ifdef WATT32 -#undef WIN32 -#endif - -struct addr_query { - /* Arguments passed to ares_gethostbyaddr() */ - ares_channel channel; - struct ares_addr addr; - ares_host_callback callback; - void *arg; - - const char *remaining_lookups; - int timeouts; -}; - -static void next_lookup(struct addr_query *aquery); -static void addr_callback(void *arg, int status, int timeouts, - unsigned char *abuf, int alen); -static void end_aquery(struct addr_query *aquery, int status, - struct hostent *host); -static int file_lookup(struct ares_addr *addr, struct hostent **host); -static void ptr_rr_name(char *name, const struct ares_addr *addr); - -void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, - int family, ares_host_callback callback, void *arg) -{ - struct addr_query *aquery; - - if (family != AF_INET && family != AF_INET6) - { - callback(arg, ARES_ENOTIMP, 0, NULL); - return; - } - - if ((family == AF_INET && addrlen != sizeof(aquery->addr.addrV4)) || - (family == AF_INET6 && addrlen != sizeof(aquery->addr.addrV6))) - { - callback(arg, ARES_ENOTIMP, 0, NULL); - return; - } - - aquery = ares_malloc(sizeof(struct addr_query)); - if (!aquery) - { - callback(arg, ARES_ENOMEM, 0, NULL); - return; - } - aquery->channel = channel; - if (family == AF_INET) - memcpy(&aquery->addr.addrV4, addr, sizeof(aquery->addr.addrV4)); - else - memcpy(&aquery->addr.addrV6, addr, sizeof(aquery->addr.addrV6)); - aquery->addr.family = family; - aquery->callback = callback; - aquery->arg = arg; - aquery->remaining_lookups = channel->lookups; - aquery->timeouts = 0; - - next_lookup(aquery); -} - -static void next_lookup(struct addr_query *aquery) -{ - const char *p; - char name[128]; - int status; - struct hostent *host; - - for (p = aquery->remaining_lookups; *p; p++) - { - switch (*p) - { - case 'b': - ptr_rr_name(name, &aquery->addr); - aquery->remaining_lookups = p + 1; - ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback, - aquery); - return; - case 'f': - status = file_lookup(&aquery->addr, &host); - - /* this status check below previously checked for !ARES_ENOTFOUND, - but we should not assume that this single error code is the one - that can occur, as that is in fact no longer the case */ - if (status == ARES_SUCCESS) - { - end_aquery(aquery, status, host); - return; - } - break; - } - } - end_aquery(aquery, ARES_ENOTFOUND, NULL); -} - -static void addr_callback(void *arg, int status, int timeouts, - unsigned char *abuf, int alen) -{ - struct addr_query *aquery = (struct addr_query *) arg; - struct hostent *host; - size_t addrlen; - - aquery->timeouts += timeouts; - if (status == ARES_SUCCESS) - { - if (aquery->addr.family == AF_INET) - { - addrlen = sizeof(aquery->addr.addrV4); - status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4, - (int)addrlen, AF_INET, &host); - } - else - { - addrlen = sizeof(aquery->addr.addrV6); - status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6, - (int)addrlen, AF_INET6, &host); - } - end_aquery(aquery, status, host); - } - else if (status == ARES_EDESTRUCTION || status == ARES_ECANCELLED) - end_aquery(aquery, status, NULL); - else - next_lookup(aquery); -} - -static void end_aquery(struct addr_query *aquery, int status, - struct hostent *host) -{ - aquery->callback(aquery->arg, status, aquery->timeouts, host); - if (host) - ares_free_hostent(host); - ares_free(aquery); -} - -static int file_lookup(struct ares_addr *addr, struct hostent **host) -{ - FILE *fp; - int status; - int error; - -#ifdef WIN32 - char PATH_HOSTS[MAX_PATH]; - win_platform platform; - - PATH_HOSTS[0] = '\0'; - - platform = ares__getplatform(); - - if (platform == WIN_NT) { - char tmp[MAX_PATH]; - HKEY hkeyHosts; - - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, - &hkeyHosts) == ERROR_SUCCESS) - { - DWORD dwLength = MAX_PATH; - RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, - &dwLength); - ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH); - RegCloseKey(hkeyHosts); - } - } - else if (platform == WIN_9X) - GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH); - else - return ARES_ENOTFOUND; - - strcat(PATH_HOSTS, WIN_PATH_HOSTS); - -#elif defined(WATT32) - const char *PATH_HOSTS = _w32_GetHostsFile(); - - if (!PATH_HOSTS) - return ARES_ENOTFOUND; -#endif - - fp = fopen(PATH_HOSTS, "r"); - if (!fp) - { - error = ERRNO; - switch(error) - { - case ENOENT: - case ESRCH: - return ARES_ENOTFOUND; - default: - DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", - error, strerror(error))); - DEBUGF(fprintf(stderr, "Error opening file: %s\n", - PATH_HOSTS)); - *host = NULL; - return ARES_EFILE; - } - } - while ((status = ares__get_hostent(fp, addr->family, host)) == ARES_SUCCESS) - { - if (addr->family != (*host)->h_addrtype) - { - ares_free_hostent(*host); - continue; - } - if (addr->family == AF_INET) - { - if (memcmp((*host)->h_addr, &addr->addrV4, - sizeof(addr->addrV4)) == 0) - break; - } - else if (addr->family == AF_INET6) - { - if (memcmp((*host)->h_addr, &addr->addrV6, - sizeof(addr->addrV6)) == 0) - break; - } - ares_free_hostent(*host); - } - fclose(fp); - if (status == ARES_EOF) - status = ARES_ENOTFOUND; - if (status != ARES_SUCCESS) - *host = NULL; - return status; -} - -static void ptr_rr_name(char *name, const struct ares_addr *addr) -{ - if (addr->family == AF_INET) - { - unsigned long laddr = ntohl(addr->addrV4.s_addr); - unsigned long a1 = (laddr >> 24UL) & 0xFFUL; - unsigned long a2 = (laddr >> 16UL) & 0xFFUL; - unsigned long a3 = (laddr >> 8UL) & 0xFFUL; - unsigned long a4 = laddr & 0xFFUL; - sprintf(name, "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1); - } - else - { - unsigned char *bytes = (unsigned char *)&addr->addrV6; - /* There are too many arguments to do this in one line using - * minimally C89-compliant compilers */ - sprintf(name, - "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.", - bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4, - bytes[13]&0xf, bytes[13] >> 4, bytes[12]&0xf, bytes[12] >> 4, - bytes[11]&0xf, bytes[11] >> 4, bytes[10]&0xf, bytes[10] >> 4, - bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4); - sprintf(name+strlen(name), - "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa", - bytes[7]&0xf, bytes[7] >> 4, bytes[6]&0xf, bytes[6] >> 4, - bytes[5]&0xf, bytes[5] >> 4, bytes[4]&0xf, bytes[4] >> 4, - bytes[3]&0xf, bytes[3] >> 4, bytes[2]&0xf, bytes[2] >> 4, - bytes[1]&0xf, bytes[1] >> 4, bytes[0]&0xf, bytes[0] >> 4); - } -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_gethostbyname.c b/lib/c-ares-1.19.1/src/lib/ares_gethostbyname.c deleted file mode 100644 index 8c71cc67f3c..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_gethostbyname.c +++ /dev/null @@ -1,338 +0,0 @@ -/* Copyright 1998, 2011, 2013 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -#include -#endif - -#include "ares.h" -#include "ares_inet_net_pton.h" -#include "bitncmp.h" -#include "ares_platform.h" -#include "ares_nowarn.h" -#include "ares_private.h" - -static void sort_addresses(struct hostent *host, - const struct apattern *sortlist, int nsort); -static void sort6_addresses(struct hostent *host, - const struct apattern *sortlist, int nsort); -static int get_address_index(const struct in_addr *addr, - const struct apattern *sortlist, int nsort); -static int get6_address_index(const struct ares_in6_addr *addr, - const struct apattern *sortlist, int nsort); - -struct host_query { - ares_host_callback callback; - void *arg; - ares_channel channel; -}; - -static void ares_gethostbyname_callback(void *arg, int status, int timeouts, - struct ares_addrinfo *result) -{ - struct hostent *hostent = NULL; - struct host_query *ghbn_arg = arg; - - if (status == ARES_SUCCESS) - { - status = ares__addrinfo2hostent(result, AF_UNSPEC, &hostent); - } - - /* addrinfo2hostent will only return ENODATA if there are no addresses _and_ - * no cname/aliases. However, gethostbyname will return ENODATA even if there - * is cname/alias data */ - if (status == ARES_SUCCESS && hostent && - (!hostent->h_addr_list || !hostent->h_addr_list[0])) - { - status = ARES_ENODATA; - } - - if (status == ARES_SUCCESS && ghbn_arg->channel->nsort && hostent) - { - if (hostent->h_addrtype == AF_INET6) - sort6_addresses(hostent, ghbn_arg->channel->sortlist, - ghbn_arg->channel->nsort); - if (hostent->h_addrtype == AF_INET) - sort_addresses(hostent, ghbn_arg->channel->sortlist, - ghbn_arg->channel->nsort); - } - - ghbn_arg->callback(ghbn_arg->arg, status, timeouts, hostent); - - ares_freeaddrinfo(result); - ares_free(ghbn_arg); - ares_free_hostent(hostent); -} - -void ares_gethostbyname(ares_channel channel, const char *name, int family, - ares_host_callback callback, void *arg) -{ - const struct ares_addrinfo_hints hints = { ARES_AI_CANONNAME, family, 0, 0 }; - struct host_query *ghbn_arg; - - if (!callback) - return; - - ghbn_arg = ares_malloc(sizeof(*ghbn_arg)); - if (!ghbn_arg) - { - callback(arg, ARES_ENOMEM, 0, NULL); - return; - } - - ghbn_arg->callback=callback; - ghbn_arg->arg=arg; - ghbn_arg->channel=channel; - - ares_getaddrinfo(channel, name, NULL, &hints, ares_gethostbyname_callback, - ghbn_arg); -} - - -static void sort_addresses(struct hostent *host, - const struct apattern *sortlist, int nsort) -{ - struct in_addr a1, a2; - int i1, i2, ind1, ind2; - - /* This is a simple insertion sort, not optimized at all. i1 walks - * through the address list, with the loop invariant that everything - * to the left of i1 is sorted. In the loop body, the value at i1 is moved - * back through the list (via i2) until it is in sorted order. - */ - for (i1 = 0; host->h_addr_list[i1]; i1++) - { - memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr)); - ind1 = get_address_index(&a1, sortlist, nsort); - for (i2 = i1 - 1; i2 >= 0; i2--) - { - memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr)); - ind2 = get_address_index(&a2, sortlist, nsort); - if (ind2 <= ind1) - break; - memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr)); - } - memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr)); - } -} - -/* Find the first entry in sortlist which matches addr. Return nsort - * if none of them match. - */ -static int get_address_index(const struct in_addr *addr, - const struct apattern *sortlist, - int nsort) -{ - int i; - - for (i = 0; i < nsort; i++) - { - if (sortlist[i].family != AF_INET) - continue; - if (sortlist[i].type == PATTERN_MASK) - { - if ((addr->s_addr & sortlist[i].mask.addr4.s_addr) - == sortlist[i].addrV4.s_addr) - break; - } - else - { - if (!ares__bitncmp(&addr->s_addr, &sortlist[i].addrV4.s_addr, - sortlist[i].mask.bits)) - break; - } - } - return i; -} - -static void sort6_addresses(struct hostent *host, - const struct apattern *sortlist, int nsort) -{ - struct ares_in6_addr a1, a2; - int i1, i2, ind1, ind2; - - /* This is a simple insertion sort, not optimized at all. i1 walks - * through the address list, with the loop invariant that everything - * to the left of i1 is sorted. In the loop body, the value at i1 is moved - * back through the list (via i2) until it is in sorted order. - */ - for (i1 = 0; host->h_addr_list[i1]; i1++) - { - memcpy(&a1, host->h_addr_list[i1], sizeof(struct ares_in6_addr)); - ind1 = get6_address_index(&a1, sortlist, nsort); - for (i2 = i1 - 1; i2 >= 0; i2--) - { - memcpy(&a2, host->h_addr_list[i2], sizeof(struct ares_in6_addr)); - ind2 = get6_address_index(&a2, sortlist, nsort); - if (ind2 <= ind1) - break; - memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct ares_in6_addr)); - } - memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct ares_in6_addr)); - } -} - -/* Find the first entry in sortlist which matches addr. Return nsort - * if none of them match. - */ -static int get6_address_index(const struct ares_in6_addr *addr, - const struct apattern *sortlist, - int nsort) -{ - int i; - - for (i = 0; i < nsort; i++) - { - if (sortlist[i].family != AF_INET6) - continue; - if (!ares__bitncmp(addr, &sortlist[i].addrV6, sortlist[i].mask.bits)) - break; - } - return i; -} - - - -static int file_lookup(const char *name, int family, struct hostent **host); - -/* I really have no idea why this is exposed as a public function, but since - * it is, we can't kill this legacy function. */ -int ares_gethostbyname_file(ares_channel channel, const char *name, - int family, struct hostent **host) -{ - int result; - - /* We only take the channel to ensure that ares_init() been called. */ - if(channel == NULL) - { - /* Anything will do, really. This seems fine, and is consistent with - other error cases. */ - *host = NULL; - return ARES_ENOTFOUND; - } - - /* Just chain to the internal implementation we use here; it's exactly - * what we want. - */ - result = file_lookup(name, family, host); - if(result != ARES_SUCCESS) - { - /* We guarantee a NULL hostent on failure. */ - *host = NULL; - } - return result; -} - -static int file_lookup(const char *name, int family, struct hostent **host) -{ - FILE *fp; - char **alias; - int status; - int error; - -#ifdef WIN32 - char PATH_HOSTS[MAX_PATH]; - win_platform platform; - - PATH_HOSTS[0] = '\0'; - - platform = ares__getplatform(); - - if (platform == WIN_NT) { - char tmp[MAX_PATH]; - HKEY hkeyHosts; - - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, - &hkeyHosts) == ERROR_SUCCESS) - { - DWORD dwLength = MAX_PATH; - RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, - &dwLength); - ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH); - RegCloseKey(hkeyHosts); - } - } - else if (platform == WIN_9X) - GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH); - else - return ARES_ENOTFOUND; - - strcat(PATH_HOSTS, WIN_PATH_HOSTS); - -#elif defined(WATT32) - const char *PATH_HOSTS = _w32_GetHostsFile(); - - if (!PATH_HOSTS) - return ARES_ENOTFOUND; -#endif - - /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */ - if (ares__is_onion_domain(name)) - return ARES_ENOTFOUND; - - - fp = fopen(PATH_HOSTS, "r"); - if (!fp) - { - error = ERRNO; - switch(error) - { - case ENOENT: - case ESRCH: - return ARES_ENOTFOUND; - default: - DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", - error, strerror(error))); - DEBUGF(fprintf(stderr, "Error opening file: %s\n", - PATH_HOSTS)); - *host = NULL; - return ARES_EFILE; - } - } - while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS) - { - if (strcasecmp((*host)->h_name, name) == 0) - break; - for (alias = (*host)->h_aliases; *alias; alias++) - { - if (strcasecmp(*alias, name) == 0) - break; - } - if (*alias) - break; - ares_free_hostent(*host); - } - fclose(fp); - if (status == ARES_EOF) - status = ARES_ENOTFOUND; - if (status != ARES_SUCCESS) - *host = NULL; - return status; -} - diff --git a/lib/c-ares-1.19.1/src/lib/ares_getnameinfo.c b/lib/c-ares-1.19.1/src/lib/ares_getnameinfo.c deleted file mode 100644 index 966919ac232..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_getnameinfo.c +++ /dev/null @@ -1,447 +0,0 @@ - -/* Copyright 2005 by Dominick Meglio - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ -#include "ares_setup.h" - -#ifdef HAVE_GETSERVBYPORT_R -# if !defined(GETSERVBYPORT_R_ARGS) || \ - (GETSERVBYPORT_R_ARGS < 4) || (GETSERVBYPORT_R_ARGS > 6) -# error "you MUST specifiy a valid number of arguments for getservbyport_r" -# endif -#endif - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_NET_IF_H -#include -#endif - -#include "ares.h" -#include "ares_ipv6.h" -#include "ares_nowarn.h" -#include "ares_private.h" - -struct nameinfo_query { - ares_nameinfo_callback callback; - void *arg; - union { - struct sockaddr_in addr4; - struct sockaddr_in6 addr6; - } addr; - int family; - int flags; - int timeouts; -}; - -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID -#define IPBUFSIZ \ - (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + IF_NAMESIZE) -#else -#define IPBUFSIZ \ - (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")) -#endif - -static void nameinfo_callback(void *arg, int status, int timeouts, - struct hostent *host); -static char *lookup_service(unsigned short port, int flags, - char *buf, size_t buflen); -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID -static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int scopeid, - char *buf, size_t buflen); -#endif -STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2); - -void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, - ares_socklen_t salen, - int flags, ares_nameinfo_callback callback, void *arg) -{ - struct sockaddr_in *addr = NULL; - struct sockaddr_in6 *addr6 = NULL; - struct nameinfo_query *niquery; - unsigned int port = 0; - - /* Validate socket address family and length */ - if ((sa->sa_family == AF_INET) && - (salen == sizeof(struct sockaddr_in))) - { - addr = CARES_INADDR_CAST(struct sockaddr_in *, sa); - port = addr->sin_port; - } - else if ((sa->sa_family == AF_INET6) && - (salen == sizeof(struct sockaddr_in6))) - { - addr6 = CARES_INADDR_CAST(struct sockaddr_in6 *, sa); - port = addr6->sin6_port; - } - else - { - callback(arg, ARES_ENOTIMP, 0, NULL, NULL); - return; - } - - /* If neither, assume they want a host */ - if (!(flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST)) - flags |= ARES_NI_LOOKUPHOST; - - /* All they want is a service, no need for DNS */ - if ((flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST)) - { - char buf[33], *service; - - service = lookup_service((unsigned short)(port & 0xffff), - flags, buf, sizeof(buf)); - callback(arg, ARES_SUCCESS, 0, NULL, service); - return; - } - - /* They want a host lookup */ - if ((flags & ARES_NI_LOOKUPHOST)) - { - /* A numeric host can be handled without DNS */ - if ((flags & ARES_NI_NUMERICHOST)) - { - char ipbuf[IPBUFSIZ]; - char srvbuf[33]; - char *service = NULL; - ipbuf[0] = 0; - - /* Specifying not to lookup a host, but then saying a host - * is required has to be illegal. - */ - if (flags & ARES_NI_NAMEREQD) - { - callback(arg, ARES_EBADFLAGS, 0, NULL, NULL); - return; - } - if (salen == sizeof(struct sockaddr_in6)) - { - ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ); - /* If the system supports scope IDs, use it */ -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf)); -#endif - } - else - { - ares_inet_ntop(AF_INET, &addr->sin_addr, ipbuf, IPBUFSIZ); - } - /* They also want a service */ - if (flags & ARES_NI_LOOKUPSERVICE) - service = lookup_service((unsigned short)(port & 0xffff), - flags, srvbuf, sizeof(srvbuf)); - callback(arg, ARES_SUCCESS, 0, ipbuf, service); - return; - } - /* This is where a DNS lookup becomes necessary */ - else - { - niquery = ares_malloc(sizeof(struct nameinfo_query)); - if (!niquery) - { - callback(arg, ARES_ENOMEM, 0, NULL, NULL); - return; - } - niquery->callback = callback; - niquery->arg = arg; - niquery->flags = flags; - niquery->timeouts = 0; - if (sa->sa_family == AF_INET) - { - niquery->family = AF_INET; - memcpy(&niquery->addr.addr4, addr, sizeof(niquery->addr.addr4)); - ares_gethostbyaddr(channel, &addr->sin_addr, - sizeof(struct in_addr), AF_INET, - nameinfo_callback, niquery); - } - else - { - niquery->family = AF_INET6; - memcpy(&niquery->addr.addr6, addr6, sizeof(niquery->addr.addr6)); - ares_gethostbyaddr(channel, &addr6->sin6_addr, - sizeof(struct ares_in6_addr), AF_INET6, - nameinfo_callback, niquery); - } - } - } -} - -static void nameinfo_callback(void *arg, int status, int timeouts, - struct hostent *host) -{ - struct nameinfo_query *niquery = (struct nameinfo_query *) arg; - char srvbuf[33]; - char *service = NULL; - - niquery->timeouts += timeouts; - if (status == ARES_SUCCESS) - { - /* They want a service too */ - if (niquery->flags & ARES_NI_LOOKUPSERVICE) - { - if (niquery->family == AF_INET) - service = lookup_service(niquery->addr.addr4.sin_port, - niquery->flags, srvbuf, sizeof(srvbuf)); - else - service = lookup_service(niquery->addr.addr6.sin6_port, - niquery->flags, srvbuf, sizeof(srvbuf)); - } - /* NOFQDN means we have to strip off the domain name portion. We do - this by determining our own domain name, then searching the string - for this domain name and removing it. - */ -#ifdef HAVE_GETHOSTNAME - if (niquery->flags & ARES_NI_NOFQDN) - { - char buf[255]; - char *domain; - gethostname(buf, 255); - if ((domain = strchr(buf, '.')) != NULL) - { - char *end = ares_striendstr(host->h_name, domain); - if (end) - *end = 0; - } - } -#endif - niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, - (char *)(host->h_name), - service); - ares_free(niquery); - return; - } - /* We couldn't find the host, but it's OK, we can use the IP */ - else if (status == ARES_ENOTFOUND && !(niquery->flags & ARES_NI_NAMEREQD)) - { - char ipbuf[IPBUFSIZ]; - if (niquery->family == AF_INET) - ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf, - IPBUFSIZ); - else - { - ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf, - IPBUFSIZ); -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf, - sizeof(ipbuf)); -#endif - } - /* They want a service too */ - if (niquery->flags & ARES_NI_LOOKUPSERVICE) - { - if (niquery->family == AF_INET) - service = lookup_service(niquery->addr.addr4.sin_port, - niquery->flags, srvbuf, sizeof(srvbuf)); - else - service = lookup_service(niquery->addr.addr6.sin6_port, - niquery->flags, srvbuf, sizeof(srvbuf)); - } - niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf, - service); - ares_free(niquery); - return; - } - niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL); - ares_free(niquery); -} - -static char *lookup_service(unsigned short port, int flags, - char *buf, size_t buflen) -{ - const char *proto; - struct servent *sep; -#ifdef HAVE_GETSERVBYPORT_R - struct servent se; -#endif - char tmpbuf[4096]; - char *name; - size_t name_len; - - if (port) - { - if (flags & ARES_NI_NUMERICSERV) - sep = NULL; - else - { - if (flags & ARES_NI_UDP) - proto = "udp"; - else if (flags & ARES_NI_SCTP) - proto = "sctp"; - else if (flags & ARES_NI_DCCP) - proto = "dccp"; - else - proto = "tcp"; -#ifdef HAVE_GETSERVBYPORT_R - memset(&se, 0, sizeof(se)); - sep = &se; - memset(tmpbuf, 0, sizeof(tmpbuf)); -#if GETSERVBYPORT_R_ARGS == 6 - if (getservbyport_r(port, proto, &se, (void *)tmpbuf, - sizeof(tmpbuf), &sep) != 0) - sep = NULL; /* LCOV_EXCL_LINE: buffer large so this never fails */ -#elif GETSERVBYPORT_R_ARGS == 5 - sep = getservbyport_r(port, proto, &se, (void *)tmpbuf, - sizeof(tmpbuf)); -#elif GETSERVBYPORT_R_ARGS == 4 - if (getservbyport_r(port, proto, &se, (void *)tmpbuf) != 0) - sep = NULL; -#else - /* Lets just hope the OS uses TLS! */ - sep = getservbyport(port, proto); -#endif -#else - /* Lets just hope the OS uses TLS! */ -#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) - sep = getservbyport(port, (char*)proto); -#else - sep = getservbyport(port, proto); -#endif -#endif - } - if (sep && sep->s_name) - { - /* get service name */ - name = sep->s_name; - } - else - { - /* get port as a string */ - sprintf(tmpbuf, "%u", (unsigned int)ntohs(port)); - name = tmpbuf; - } - name_len = strlen(name); - if (name_len < buflen) - /* return it if buffer big enough */ - memcpy(buf, name, name_len + 1); - else - /* avoid reusing previous one */ - buf[0] = '\0'; /* LCOV_EXCL_LINE: no real service names are too big */ - return buf; - } - buf[0] = '\0'; - return NULL; -} - -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID -static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, - char *buf, size_t buflen) -{ -#ifdef HAVE_IF_INDEXTONAME - int is_ll, is_mcll; -#endif - char tmpbuf[IF_NAMESIZE + 2]; - size_t bufl; - int is_scope_long = sizeof(addr6->sin6_scope_id) > sizeof(unsigned int); - - tmpbuf[0] = '%'; - -#ifdef HAVE_IF_INDEXTONAME - is_ll = IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr); - is_mcll = IN6_IS_ADDR_MC_LINKLOCAL(&addr6->sin6_addr); - if ((flags & ARES_NI_NUMERICSCOPE) || - (!is_ll && !is_mcll)) - { - if (is_scope_long) - { - sprintf(&tmpbuf[1], "%lu", (unsigned long)addr6->sin6_scope_id); - } - else - { - sprintf(&tmpbuf[1], "%u", (unsigned int)addr6->sin6_scope_id); - } - } - else - { - if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL) - { - if (is_scope_long) - { - sprintf(&tmpbuf[1], "%lu", (unsigned long)addr6->sin6_scope_id); - } - else - { - sprintf(&tmpbuf[1], "%u", (unsigned int)addr6->sin6_scope_id); - } - } - } -#else - if (is_scope_long) - { - sprintf(&tmpbuf[1], "%lu", (unsigned long)addr6->sin6_scope_id); - } - else - { - sprintf(&tmpbuf[1], "%u", (unsigned int)addr6->sin6_scope_id); - } - (void) flags; -#endif - tmpbuf[IF_NAMESIZE + 1] = '\0'; - bufl = strlen(buf); - - if(bufl + strlen(tmpbuf) < buflen) - /* only append the scopeid string if it fits in the target buffer */ - strcpy(&buf[bufl], tmpbuf); -} -#endif - -/* Determines if s1 ends with the string in s2 (case-insensitive) */ -STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2) -{ - const char *c1, *c2, *c1_begin; - int lo1, lo2; - size_t s1_len = strlen(s1), s2_len = strlen(s2); - - /* If the substr is longer than the full str, it can't match */ - if (s2_len > s1_len) - return NULL; - - /* Jump to the end of s1 minus the length of s2 */ - c1_begin = s1+s1_len-s2_len; - c1 = (const char *)c1_begin; - c2 = s2; - while (c2 < s2+s2_len) - { - lo1 = TOLOWER(*c1); - lo2 = TOLOWER(*c2); - if (lo1 != lo2) - return NULL; - else - { - c1++; - c2++; - } - } - return (char *)c1_begin; -} - -int ares__is_onion_domain(const char *name) -{ - if (ares_striendstr(name, ".onion")) - return 1; - - if (ares_striendstr(name, ".onion.")) - return 1; - - return 0; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_getsock.c b/lib/c-ares-1.19.1/src/lib/ares_getsock.c deleted file mode 100644 index 22d344679fa..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_getsock.c +++ /dev/null @@ -1,66 +0,0 @@ - -/* Copyright (C) 2005 - 2010, Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include "ares.h" -#include "ares_private.h" - -int ares_getsock(ares_channel channel, - ares_socket_t *socks, - int numsocks) /* size of the 'socks' array */ -{ - struct server_state *server; - int i; - int sockindex=0; - int bitmap = 0; - unsigned int setbits = 0xffffffff; - - /* Are there any active queries? */ - int active_queries = !ares__is_list_empty(&(channel->all_queries)); - - for (i = 0; i < channel->nservers; i++) - { - server = &channel->servers[i]; - /* We only need to register interest in UDP sockets if we have - * outstanding queries. - */ - if (active_queries && server->udp_socket != ARES_SOCKET_BAD) - { - if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM) - break; - socks[sockindex] = server->udp_socket; - bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); - sockindex++; - } - /* We always register for TCP events, because we want to know - * when the other side closes the connection, so we don't waste - * time trying to use a broken connection. - */ - if (server->tcp_socket != ARES_SOCKET_BAD) - { - if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM) - break; - socks[sockindex] = server->tcp_socket; - bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); - - if (server->qhead && active_queries) - /* then the tcp socket is also writable! */ - bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex); - - sockindex++; - } - } - return bitmap; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_inet_net_pton.h b/lib/c-ares-1.19.1/src/lib/ares_inet_net_pton.h deleted file mode 100644 index 90da2cc6514..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_inet_net_pton.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef HEADER_CARES_INET_NET_PTON_H -#define HEADER_CARES_INET_NET_PTON_H - -/* Copyright (C) 2005-2013 by Daniel Stenberg et al - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#ifdef HAVE_INET_NET_PTON -#define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z) -#else -int ares_inet_net_pton(int af, const char *src, void *dst, size_t size); -#endif - -#endif /* HEADER_CARES_INET_NET_PTON_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_init.c b/lib/c-ares-1.19.1/src/lib/ares_init.c deleted file mode 100644 index 0519f43e561..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_init.c +++ /dev/null @@ -1,2266 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2007-2013 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_SYS_PARAM_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_NETDB_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#include "ares_nameser.h" - -#if defined(ANDROID) || defined(__ANDROID__) -#include -#include "ares_android.h" -/* From the Bionic sources */ -#define DNS_PROP_NAME_PREFIX "net.dns" -#define MAX_DNS_PROPERTIES 8 -#endif - -#if defined(CARES_USE_LIBRESOLV) -#include -#endif - -#if defined(USE_WINSOCK) -# include -#endif - -#include "ares.h" -#include "ares_inet_net_pton.h" -#include "ares_nowarn.h" -#include "ares_platform.h" -#include "ares_private.h" - -#ifdef WATT32 -#undef WIN32 /* Redefined in MingW/MSVC headers */ -#endif - - -static int init_by_options(ares_channel channel, - const struct ares_options *options, - int optmask); -static int init_by_environment(ares_channel channel); -static int init_by_resolv_conf(ares_channel channel); -static int init_by_defaults(ares_channel channel); - -#ifndef WATT32 -static int config_nameserver(struct server_state **servers, int *nservers, - char *str); -#endif -static int set_search(ares_channel channel, const char *str); -static int set_options(ares_channel channel, const char *str); -static const char *try_option(const char *p, const char *q, const char *opt); - -static int config_sortlist(struct apattern **sortlist, int *nsort, - const char *str); -static int sortlist_alloc(struct apattern **sortlist, int *nsort, - struct apattern *pat); -static int ip_addr(const char *s, ares_ssize_t len, struct in_addr *addr); -static void natural_mask(struct apattern *pat); -#if !defined(WIN32) && !defined(WATT32) && \ - !defined(ANDROID) && !defined(__ANDROID__) && !defined(CARES_USE_LIBRESOLV) -static int config_domain(ares_channel channel, char *str); -static int config_lookup(ares_channel channel, const char *str, - const char *bindch, const char *altbindch, - const char *filech); -static char *try_config(char *s, const char *opt, char scc); -#endif - -#define ARES_CONFIG_CHECK(x) (x->lookups && x->nsort > -1 && \ - x->nservers > -1 && \ - x->ndomains > -1 && \ - x->ndots > -1 && x->timeout > -1 && \ - x->tries > -1) - -int ares_init(ares_channel *channelptr) -{ - return ares_init_options(channelptr, NULL, 0); -} - -int ares_init_options(ares_channel *channelptr, struct ares_options *options, - int optmask) -{ - ares_channel channel; - int i; - int status = ARES_SUCCESS; - struct timeval now; - - if (ares_library_initialized() != ARES_SUCCESS) - return ARES_ENOTINITIALIZED; /* LCOV_EXCL_LINE: n/a on non-WinSock */ - - channel = ares_malloc(sizeof(struct ares_channeldata)); - if (!channel) { - *channelptr = NULL; - return ARES_ENOMEM; - } - - now = ares__tvnow(); - - /* Set everything to distinguished values so we know they haven't - * been set yet. - */ - channel->flags = -1; - channel->timeout = -1; - channel->tries = -1; - channel->ndots = -1; - channel->rotate = -1; - channel->udp_port = -1; - channel->tcp_port = -1; - channel->ednspsz = -1; - channel->socket_send_buffer_size = -1; - channel->socket_receive_buffer_size = -1; - channel->nservers = -1; - channel->ndomains = -1; - channel->nsort = -1; - channel->tcp_connection_generation = 0; - channel->lookups = NULL; - channel->domains = NULL; - channel->sortlist = NULL; - channel->servers = NULL; - channel->sock_state_cb = NULL; - channel->sock_state_cb_data = NULL; - channel->sock_create_cb = NULL; - channel->sock_create_cb_data = NULL; - channel->sock_config_cb = NULL; - channel->sock_config_cb_data = NULL; - channel->sock_funcs = NULL; - channel->sock_func_cb_data = NULL; - channel->resolvconf_path = NULL; - channel->hosts_path = NULL; - channel->rand_state = NULL; - - channel->last_server = 0; - channel->last_timeout_processed = (time_t)now.tv_sec; - - memset(&channel->local_dev_name, 0, sizeof(channel->local_dev_name)); - channel->local_ip4 = 0; - memset(&channel->local_ip6, 0, sizeof(channel->local_ip6)); - - /* Initialize our lists of queries */ - ares__init_list_head(&(channel->all_queries)); - for (i = 0; i < ARES_QID_TABLE_SIZE; i++) - { - ares__init_list_head(&(channel->queries_by_qid[i])); - } - for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) - { - ares__init_list_head(&(channel->queries_by_timeout[i])); - } - - /* Initialize configuration by each of the four sources, from highest - * precedence to lowest. - */ - - status = init_by_options(channel, options, optmask); - if (status != ARES_SUCCESS) { - DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n", - ares_strerror(status))); - /* If we fail to apply user-specified options, fail the whole init process */ - goto done; - } - status = init_by_environment(channel); - if (status != ARES_SUCCESS) - DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n", - ares_strerror(status))); - if (status == ARES_SUCCESS) { - status = init_by_resolv_conf(channel); - if (status != ARES_SUCCESS) - DEBUGF(fprintf(stderr, "Error: init_by_resolv_conf failed: %s\n", - ares_strerror(status))); - } - - /* - * No matter what failed or succeeded, seed defaults to provide - * useful behavior for things that we missed. - */ - status = init_by_defaults(channel); - if (status != ARES_SUCCESS) - DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", - ares_strerror(status))); - - /* Generate random key */ - - if (status == ARES_SUCCESS) { - channel->rand_state = ares__init_rand_state(); - if (channel->rand_state == NULL) { - status = ARES_ENOMEM; - } - - if (status == ARES_SUCCESS) - channel->next_id = ares__generate_new_id(channel->rand_state); - else - DEBUGF(fprintf(stderr, "Error: init_id_key failed: %s\n", - ares_strerror(status))); - } - -done: - if (status != ARES_SUCCESS) - { - /* Something failed; clean up memory we may have allocated. */ - if (channel->servers) - ares_free(channel->servers); - if (channel->ndomains != -1) - ares__strsplit_free(channel->domains, channel->ndomains); - if (channel->sortlist) - ares_free(channel->sortlist); - if(channel->lookups) - ares_free(channel->lookups); - if(channel->resolvconf_path) - ares_free(channel->resolvconf_path); - if(channel->hosts_path) - ares_free(channel->hosts_path); - if (channel->rand_state) - ares__destroy_rand_state(channel->rand_state); - ares_free(channel); - return status; - } - - /* Trim to one server if ARES_FLAG_PRIMARY is set. */ - if ((channel->flags & ARES_FLAG_PRIMARY) && channel->nservers > 1) - channel->nservers = 1; - - ares__init_servers_state(channel); - - *channelptr = channel; - return ARES_SUCCESS; -} - -/* ares_dup() duplicates a channel handle with all its options and returns a - new channel handle */ -int ares_dup(ares_channel *dest, ares_channel src) -{ - struct ares_options opts; - struct ares_addr_port_node *servers; - int non_v4_default_port = 0; - int i, rc; - int optmask; - - *dest = NULL; /* in case of failure return NULL explicitly */ - - /* First get the options supported by the old ares_save_options() function, - which is most of them */ - rc = ares_save_options(src, &opts, &optmask); - if(rc) - { - ares_destroy_options(&opts); - return rc; - } - - /* Then create the new channel with those options */ - rc = ares_init_options(dest, &opts, optmask); - - /* destroy the options copy to not leak any memory */ - ares_destroy_options(&opts); - - if(rc) - return rc; - - /* Now clone the options that ares_save_options() doesn't support. */ - (*dest)->sock_create_cb = src->sock_create_cb; - (*dest)->sock_create_cb_data = src->sock_create_cb_data; - (*dest)->sock_config_cb = src->sock_config_cb; - (*dest)->sock_config_cb_data = src->sock_config_cb_data; - (*dest)->sock_funcs = src->sock_funcs; - (*dest)->sock_func_cb_data = src->sock_func_cb_data; - - strncpy((*dest)->local_dev_name, src->local_dev_name, - sizeof((*dest)->local_dev_name)); - (*dest)->local_ip4 = src->local_ip4; - memcpy((*dest)->local_ip6, src->local_ip6, sizeof(src->local_ip6)); - - /* Full name server cloning required if there is a non-IPv4, or non-default port, nameserver */ - for (i = 0; i < src->nservers; i++) - { - if ((src->servers[i].addr.family != AF_INET) || - (src->servers[i].addr.udp_port != 0) || - (src->servers[i].addr.tcp_port != 0)) { - non_v4_default_port++; - break; - } - } - if (non_v4_default_port) { - rc = ares_get_servers_ports(src, &servers); - if (rc != ARES_SUCCESS) { - ares_destroy(*dest); - *dest = NULL; - return rc; - } - rc = ares_set_servers_ports(*dest, servers); - ares_free_data(servers); - if (rc != ARES_SUCCESS) { - ares_destroy(*dest); - *dest = NULL; - return rc; - } - } - - return ARES_SUCCESS; /* everything went fine */ -} - -/* Save options from initialized channel */ -int ares_save_options(ares_channel channel, struct ares_options *options, - int *optmask) -{ - int i, j; - int ipv4_nservers = 0; - - /* Zero everything out */ - memset(options, 0, sizeof(struct ares_options)); - - if (!ARES_CONFIG_CHECK(channel)) - return ARES_ENODATA; - - /* Traditionally the optmask wasn't saved in the channel struct so it was - recreated here. ROTATE is the first option that has no struct field of - its own in the public config struct */ - (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS| - ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB| - ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS| - ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS); - (*optmask) |= (channel->rotate ? ARES_OPT_ROTATE : ARES_OPT_NOROTATE); - - if (channel->resolvconf_path) - (*optmask) |= ARES_OPT_RESOLVCONF; - - if (channel->hosts_path) - (*optmask) |= ARES_OPT_HOSTS_FILE; - - /* Copy easy stuff */ - options->flags = channel->flags; - - /* We return full millisecond resolution but that's only because we don't - set the ARES_OPT_TIMEOUT anymore, only the new ARES_OPT_TIMEOUTMS */ - options->timeout = channel->timeout; - options->tries = channel->tries; - options->ndots = channel->ndots; - options->udp_port = ntohs(aresx_sitous(channel->udp_port)); - options->tcp_port = ntohs(aresx_sitous(channel->tcp_port)); - options->sock_state_cb = channel->sock_state_cb; - options->sock_state_cb_data = channel->sock_state_cb_data; - - /* Copy IPv4 servers that use the default port */ - if (channel->nservers) { - for (i = 0; i < channel->nservers; i++) - { - if ((channel->servers[i].addr.family == AF_INET) && - (channel->servers[i].addr.udp_port == 0) && - (channel->servers[i].addr.tcp_port == 0)) - ipv4_nservers++; - } - if (ipv4_nservers) { - options->servers = ares_malloc(ipv4_nservers * sizeof(struct in_addr)); - if (!options->servers) - return ARES_ENOMEM; - for (i = j = 0; i < channel->nservers; i++) - { - if ((channel->servers[i].addr.family == AF_INET) && - (channel->servers[i].addr.udp_port == 0) && - (channel->servers[i].addr.tcp_port == 0)) - memcpy(&options->servers[j++], - &channel->servers[i].addr.addrV4, - sizeof(channel->servers[i].addr.addrV4)); - } - } - } - options->nservers = ipv4_nservers; - - /* copy domains */ - if (channel->ndomains) { - options->domains = ares_malloc(channel->ndomains * sizeof(char *)); - if (!options->domains) - return ARES_ENOMEM; - - for (i = 0; i < channel->ndomains; i++) - { - options->ndomains = i; - options->domains[i] = ares_strdup(channel->domains[i]); - if (!options->domains[i]) - return ARES_ENOMEM; - } - } - options->ndomains = channel->ndomains; - - /* copy lookups */ - if (channel->lookups) { - options->lookups = ares_strdup(channel->lookups); - if (!options->lookups && channel->lookups) - return ARES_ENOMEM; - } - - /* copy sortlist */ - if (channel->nsort) { - options->sortlist = ares_malloc(channel->nsort * sizeof(struct apattern)); - if (!options->sortlist) - return ARES_ENOMEM; - for (i = 0; i < channel->nsort; i++) - options->sortlist[i] = channel->sortlist[i]; - } - options->nsort = channel->nsort; - - /* copy path for resolv.conf file */ - if (channel->resolvconf_path) { - options->resolvconf_path = ares_strdup(channel->resolvconf_path); - if (!options->resolvconf_path) - return ARES_ENOMEM; - } - - /* copy path for hosts file */ - if (channel->hosts_path) { - options->hosts_path = ares_strdup(channel->hosts_path); - if (!options->hosts_path) - return ARES_ENOMEM; - } - - return ARES_SUCCESS; -} - -static int init_by_options(ares_channel channel, - const struct ares_options *options, - int optmask) -{ - int i; - - /* Easy stuff. */ - if ((optmask & ARES_OPT_FLAGS) && channel->flags == -1) - channel->flags = options->flags; - if ((optmask & ARES_OPT_TIMEOUTMS) && channel->timeout == -1) - channel->timeout = options->timeout; - else if ((optmask & ARES_OPT_TIMEOUT) && channel->timeout == -1) - channel->timeout = options->timeout * 1000; - if ((optmask & ARES_OPT_TRIES) && channel->tries == -1) - channel->tries = options->tries; - if ((optmask & ARES_OPT_NDOTS) && channel->ndots == -1) - channel->ndots = options->ndots; - if ((optmask & ARES_OPT_ROTATE) && channel->rotate == -1) - channel->rotate = 1; - if ((optmask & ARES_OPT_NOROTATE) && channel->rotate == -1) - channel->rotate = 0; - if ((optmask & ARES_OPT_UDP_PORT) && channel->udp_port == -1) - channel->udp_port = htons(options->udp_port); - if ((optmask & ARES_OPT_TCP_PORT) && channel->tcp_port == -1) - channel->tcp_port = htons(options->tcp_port); - if ((optmask & ARES_OPT_SOCK_STATE_CB) && channel->sock_state_cb == NULL) - { - channel->sock_state_cb = options->sock_state_cb; - channel->sock_state_cb_data = options->sock_state_cb_data; - } - if ((optmask & ARES_OPT_SOCK_SNDBUF) - && channel->socket_send_buffer_size == -1) - channel->socket_send_buffer_size = options->socket_send_buffer_size; - if ((optmask & ARES_OPT_SOCK_RCVBUF) - && channel->socket_receive_buffer_size == -1) - channel->socket_receive_buffer_size = options->socket_receive_buffer_size; - - if ((optmask & ARES_OPT_EDNSPSZ) && channel->ednspsz == -1) - channel->ednspsz = options->ednspsz; - - /* Copy the IPv4 servers, if given. */ - if ((optmask & ARES_OPT_SERVERS) && channel->nservers == -1) - { - /* Avoid zero size allocations at any cost */ - if (options->nservers > 0) - { - channel->servers = - ares_malloc(options->nservers * sizeof(struct server_state)); - if (!channel->servers) - return ARES_ENOMEM; - for (i = 0; i < options->nservers; i++) - { - channel->servers[i].addr.family = AF_INET; - channel->servers[i].addr.udp_port = 0; - channel->servers[i].addr.tcp_port = 0; - memcpy(&channel->servers[i].addr.addrV4, - &options->servers[i], - sizeof(channel->servers[i].addr.addrV4)); - } - } - channel->nservers = options->nservers; - } - - /* Copy the domains, if given. Keep channel->ndomains consistent so - * we can clean up in case of error. - */ - if ((optmask & ARES_OPT_DOMAINS) && channel->ndomains == -1) - { - /* Avoid zero size allocations at any cost */ - if (options->ndomains > 0) - { - channel->domains = ares_malloc(options->ndomains * sizeof(char *)); - if (!channel->domains) - return ARES_ENOMEM; - for (i = 0; i < options->ndomains; i++) - { - channel->ndomains = i; - channel->domains[i] = ares_strdup(options->domains[i]); - if (!channel->domains[i]) - return ARES_ENOMEM; - } - } - channel->ndomains = options->ndomains; - } - - /* Set lookups, if given. */ - if ((optmask & ARES_OPT_LOOKUPS) && !channel->lookups) - { - channel->lookups = ares_strdup(options->lookups); - if (!channel->lookups) - return ARES_ENOMEM; - } - - /* copy sortlist */ - if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1)) { - if (options->nsort > 0) { - channel->sortlist = ares_malloc(options->nsort * sizeof(struct apattern)); - if (!channel->sortlist) - return ARES_ENOMEM; - for (i = 0; i < options->nsort; i++) - channel->sortlist[i] = options->sortlist[i]; - } - channel->nsort = options->nsort; - } - - /* Set path for resolv.conf file, if given. */ - if ((optmask & ARES_OPT_RESOLVCONF) && !channel->resolvconf_path) - { - channel->resolvconf_path = ares_strdup(options->resolvconf_path); - if (!channel->resolvconf_path && options->resolvconf_path) - return ARES_ENOMEM; - } - - /* Set path for hosts file, if given. */ - if ((optmask & ARES_OPT_HOSTS_FILE) && !channel->hosts_path) - { - channel->hosts_path = ares_strdup(options->hosts_path); - if (!channel->hosts_path && options->hosts_path) - return ARES_ENOMEM; - } - - channel->optmask = optmask; - - return ARES_SUCCESS; -} - -static int init_by_environment(ares_channel channel) -{ - const char *localdomain, *res_options; - int status; - - localdomain = getenv("LOCALDOMAIN"); - if (localdomain && channel->ndomains == -1) - { - status = set_search(channel, localdomain); - if (status != ARES_SUCCESS) - return status; - } - - res_options = getenv("RES_OPTIONS"); - if (res_options) - { - status = set_options(channel, res_options); - if (status != ARES_SUCCESS) - return status; /* LCOV_EXCL_LINE: set_options() never fails */ - } - - return ARES_SUCCESS; -} - -#ifdef WIN32 -/* - * get_REG_SZ() - * - * Given a 'hKey' handle to an open registry key and a 'leafKeyName' pointer - * to the name of the registry leaf key to be queried, fetch it's string - * value and return a pointer in *outptr to a newly allocated memory area - * holding it as a null-terminated string. - * - * Returns 0 and nullifies *outptr upon inability to return a string value. - * - * Returns 1 and sets *outptr when returning a dynamically allocated string. - * - * Supported on Windows NT 3.5 and newer. - */ -static int get_REG_SZ(HKEY hKey, const char *leafKeyName, char **outptr) -{ - DWORD size = 0; - int res; - - *outptr = NULL; - - /* Find out size of string stored in registry */ - res = RegQueryValueExA(hKey, leafKeyName, 0, NULL, NULL, &size); - if ((res != ERROR_SUCCESS && res != ERROR_MORE_DATA) || !size) - return 0; - - /* Allocate buffer of indicated size plus one given that string - might have been stored without null termination */ - *outptr = ares_malloc(size+1); - if (!*outptr) - return 0; - - /* Get the value for real */ - res = RegQueryValueExA(hKey, leafKeyName, 0, NULL, - (unsigned char *)*outptr, &size); - if ((res != ERROR_SUCCESS) || (size == 1)) - { - ares_free(*outptr); - *outptr = NULL; - return 0; - } - - /* Null terminate buffer allways */ - *(*outptr + size) = '\0'; - - return 1; -} - -static void commanjoin(char** dst, const char* const src, const size_t len) -{ - char *newbuf; - size_t newsize; - - /* 1 for terminating 0 and 2 for , and terminating 0 */ - newsize = len + (*dst ? (strlen(*dst) + 2) : 1); - newbuf = ares_realloc(*dst, newsize); - if (!newbuf) - return; - if (*dst == NULL) - *newbuf = '\0'; - *dst = newbuf; - if (strlen(*dst) != 0) - strcat(*dst, ","); - strncat(*dst, src, len); -} - -/* - * commajoin() - * - * RTF code. - */ -static void commajoin(char **dst, const char *src) -{ - commanjoin(dst, src, strlen(src)); -} - - -/* A structure to hold the string form of IPv4 and IPv6 addresses so we can - * sort them by a metric. - */ -typedef struct -{ - /* The metric we sort them by. */ - ULONG metric; - - /* Original index of the item, used as a secondary sort parameter to make - * qsort() stable if the metrics are equal */ - size_t orig_idx; - - /* Room enough for the string form of any IPv4 or IPv6 address that - * ares_inet_ntop() will create. Based on the existing c-ares practice. - */ - char text[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; -} Address; - -/* Sort Address values \a left and \a right by metric, returning the usual - * indicators for qsort(). - */ -static int compareAddresses(const void *arg1, - const void *arg2) -{ - const Address * const left = arg1; - const Address * const right = arg2; - /* Lower metric the more preferred */ - if(left->metric < right->metric) return -1; - if(left->metric > right->metric) return 1; - /* If metrics are equal, lower original index more preferred */ - if(left->orig_idx < right->orig_idx) return -1; - if(left->orig_idx > right->orig_idx) return 1; - return 0; -} - -/* There can be multiple routes to "the Internet". And there can be different - * DNS servers associated with each of the interfaces that offer those routes. - * We have to assume that any DNS server can serve any request. But, some DNS - * servers may only respond if requested over their associated interface. But - * we also want to use "the preferred route to the Internet" whenever possible - * (and not use DNS servers on a non-preferred route even by forcing request - * to go out on the associated non-preferred interface). i.e. We want to use - * the DNS servers associated with the same interface that we would use to - * make a general request to anything else. - * - * But, Windows won't sort the DNS servers by the metrics associated with the - * routes and interfaces _even_ though it obviously sends IP packets based on - * those same routes and metrics. So, we must do it ourselves. - * - * So, we sort the DNS servers by the same metric values used to determine how - * an outgoing IP packet will go, thus effectively using the DNS servers - * associated with the interface that the DNS requests themselves will - * travel. This gives us optimal routing and avoids issues where DNS servers - * won't respond to requests that don't arrive via some specific subnetwork - * (and thus some specific interface). - * - * This function computes the metric we use to sort. On the interface - * identified by \a luid, it determines the best route to \a dest and combines - * that route's metric with \a interfaceMetric to compute a metric for the - * destination address on that interface. This metric can be used as a weight - * to sort the DNS server addresses associated with each interface (lower is - * better). - * - * Note that by restricting the route search to the specific interface with - * which the DNS servers are associated, this function asks the question "What - * is the metric for sending IP packets to this DNS server?" which allows us - * to sort the DNS servers correctly. - */ -static ULONG getBestRouteMetric(IF_LUID * const luid, /* Can't be const :( */ - const SOCKADDR_INET * const dest, - const ULONG interfaceMetric) -{ - /* On this interface, get the best route to that destination. */ -#if defined(__WATCOMC__) - /* OpenWatcom's builtin Windows SDK does not have a definition for - * MIB_IPFORWARD_ROW2, and also does not allow the usage of SOCKADDR_INET - * as a variable. Let's work around this by returning the worst possible - * metric, but only when using the OpenWatcom compiler. - * It may be worth investigating using a different version of the Windows - * SDK with OpenWatcom in the future, though this may be fixed in OpenWatcom - * 2.0. - */ - return (ULONG)-1; -#else - MIB_IPFORWARD_ROW2 row; - SOCKADDR_INET ignored; - if(GetBestRoute2(/* The interface to use. The index is ignored since we are - * passing a LUID. - */ - luid, 0, - /* No specific source address. */ - NULL, - /* Our destination address. */ - dest, - /* No options. */ - 0, - /* The route row. */ - &row, - /* The best source address, which we don't need. */ - &ignored) != NO_ERROR - /* If the metric is "unused" (-1) or too large for us to add the two - * metrics, use the worst possible, thus sorting this last. - */ - || row.Metric == (ULONG)-1 - || row.Metric > ((ULONG)-1) - interfaceMetric) { - /* Return the worst possible metric. */ - return (ULONG)-1; - } - - /* Return the metric value from that row, plus the interface metric. - * - * See - * http://msdn.microsoft.com/en-us/library/windows/desktop/aa814494(v=vs.85).aspx - * which describes the combination as a "sum". - */ - return row.Metric + interfaceMetric; -#endif /* __WATCOMC__ */ -} - -/* - * get_DNS_Windows() - * - * Locates DNS info using GetAdaptersAddresses() function from the Internet - * Protocol Helper (IP Helper) API. When located, this returns a pointer - * in *outptr to a newly allocated memory area holding a null-terminated - * string with a space or comma seperated list of DNS IP addresses. - * - * Returns 0 and nullifies *outptr upon inability to return DNSes string. - * - * Returns 1 and sets *outptr when returning a dynamically allocated string. - * - * Implementation supports Windows XP and newer. - */ -#define IPAA_INITIAL_BUF_SZ 15 * 1024 -#define IPAA_MAX_TRIES 3 -static int get_DNS_Windows(char **outptr) -{ - IP_ADAPTER_DNS_SERVER_ADDRESS *ipaDNSAddr; - IP_ADAPTER_ADDRESSES *ipaa, *newipaa, *ipaaEntry; - ULONG ReqBufsz = IPAA_INITIAL_BUF_SZ; - ULONG Bufsz = IPAA_INITIAL_BUF_SZ; - ULONG AddrFlags = 0; - int trying = IPAA_MAX_TRIES; - int res; - - /* The capacity of addresses, in elements. */ - size_t addressesSize; - /* The number of elements in addresses. */ - size_t addressesIndex = 0; - /* The addresses we will sort. */ - Address *addresses; - - union { - struct sockaddr *sa; - struct sockaddr_in *sa4; - struct sockaddr_in6 *sa6; - } namesrvr; - - *outptr = NULL; - - ipaa = ares_malloc(Bufsz); - if (!ipaa) - return 0; - - /* Start with enough room for a few DNS server addresses and we'll grow it - * as we encounter more. - */ - addressesSize = 4; - addresses = (Address*)ares_malloc(sizeof(Address) * addressesSize); - if(addresses == NULL) { - /* We need room for at least some addresses to function. */ - ares_free(ipaa); - return 0; - } - - /* Usually this call suceeds with initial buffer size */ - res = GetAdaptersAddresses(AF_UNSPEC, AddrFlags, NULL, ipaa, &ReqBufsz); - if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS)) - goto done; - - while ((res == ERROR_BUFFER_OVERFLOW) && (--trying)) - { - if (Bufsz < ReqBufsz) - { - newipaa = ares_realloc(ipaa, ReqBufsz); - if (!newipaa) - goto done; - Bufsz = ReqBufsz; - ipaa = newipaa; - } - res = GetAdaptersAddresses(AF_UNSPEC, AddrFlags, NULL, ipaa, &ReqBufsz); - if (res == ERROR_SUCCESS) - break; - } - if (res != ERROR_SUCCESS) - goto done; - - for (ipaaEntry = ipaa; ipaaEntry; ipaaEntry = ipaaEntry->Next) - { - if(ipaaEntry->OperStatus != IfOperStatusUp) - continue; - - /* For each interface, find any associated DNS servers as IPv4 or IPv6 - * addresses. For each found address, find the best route to that DNS - * server address _on_ _that_ _interface_ (at this moment in time) and - * compute the resulting total metric, just as Windows routing will do. - * Then, sort all the addresses found by the metric. - */ - for (ipaDNSAddr = ipaaEntry->FirstDnsServerAddress; - ipaDNSAddr; - ipaDNSAddr = ipaDNSAddr->Next) - { - namesrvr.sa = ipaDNSAddr->Address.lpSockaddr; - - if (namesrvr.sa->sa_family == AF_INET) - { - if ((namesrvr.sa4->sin_addr.S_un.S_addr == INADDR_ANY) || - (namesrvr.sa4->sin_addr.S_un.S_addr == INADDR_NONE)) - continue; - - /* Allocate room for another address, if necessary, else skip. */ - if(addressesIndex == addressesSize) { - const size_t newSize = addressesSize + 4; - Address * const newMem = - (Address*)ares_realloc(addresses, sizeof(Address) * newSize); - if(newMem == NULL) { - continue; - } - addresses = newMem; - addressesSize = newSize; - } - - addresses[addressesIndex].metric = - getBestRouteMetric(&ipaaEntry->Luid, - (SOCKADDR_INET*)(namesrvr.sa), - ipaaEntry->Ipv4Metric); - - /* Record insertion index to make qsort stable */ - addresses[addressesIndex].orig_idx = addressesIndex; - - if (!ares_inet_ntop(AF_INET, &namesrvr.sa4->sin_addr, - addresses[addressesIndex].text, - sizeof(addresses[0].text))) { - continue; - } - ++addressesIndex; - } - else if (namesrvr.sa->sa_family == AF_INET6) - { - if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any, - sizeof(namesrvr.sa6->sin6_addr)) == 0) - continue; - - /* Allocate room for another address, if necessary, else skip. */ - if(addressesIndex == addressesSize) { - const size_t newSize = addressesSize + 4; - Address * const newMem = - (Address*)ares_realloc(addresses, sizeof(Address) * newSize); - if(newMem == NULL) { - continue; - } - addresses = newMem; - addressesSize = newSize; - } - - addresses[addressesIndex].metric = - getBestRouteMetric(&ipaaEntry->Luid, - (SOCKADDR_INET*)(namesrvr.sa), - ipaaEntry->Ipv6Metric); - - /* Record insertion index to make qsort stable */ - addresses[addressesIndex].orig_idx = addressesIndex; - - if (!ares_inet_ntop(AF_INET6, &namesrvr.sa6->sin6_addr, - addresses[addressesIndex].text, - sizeof(addresses[0].text))) { - continue; - } - ++addressesIndex; - } - else { - /* Skip non-IPv4/IPv6 addresses completely. */ - continue; - } - } - } - - /* Sort all of the textual addresses by their metric (and original index if - * metrics are equal). */ - qsort(addresses, addressesIndex, sizeof(*addresses), compareAddresses); - - /* Join them all into a single string, removing duplicates. */ - { - size_t i; - for(i = 0; i < addressesIndex; ++i) { - size_t j; - /* Look for this address text appearing previously in the results. */ - for(j = 0; j < i; ++j) { - if(strcmp(addresses[j].text, addresses[i].text) == 0) { - break; - } - } - /* Iff we didn't emit this address already, emit it now. */ - if(j == i) { - /* Add that to outptr (if we can). */ - commajoin(outptr, addresses[i].text); - } - } - } - -done: - ares_free(addresses); - - if (ipaa) - ares_free(ipaa); - - if (!*outptr) { - return 0; - } - - return 1; -} - -/* - * get_SuffixList_Windows() - * - * Reads the "DNS Suffix Search List" from registry and writes the list items - * whitespace separated to outptr. If the Search List is empty, the - * "Primary Dns Suffix" is written to outptr. - * - * Returns 0 and nullifies *outptr upon inability to return the suffix list. - * - * Returns 1 and sets *outptr when returning a dynamically allocated string. - * - * Implementation supports Windows Server 2003 and newer - */ -static int get_SuffixList_Windows(char **outptr) -{ - HKEY hKey, hKeyEnum; - char keyName[256]; - DWORD keyNameBuffSize; - DWORD keyIdx = 0; - char *p = NULL; - - *outptr = NULL; - - if (ares__getplatform() != WIN_NT) - return 0; - - /* 1. Global DNS Suffix Search List */ - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, - KEY_READ, &hKey) == ERROR_SUCCESS) - { - get_REG_SZ(hKey, SEARCHLIST_KEY, outptr); - if (get_REG_SZ(hKey, DOMAIN_KEY, &p)) - { - commajoin(outptr, p); - ares_free(p); - p = NULL; - } - RegCloseKey(hKey); - } - - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NT_DNSCLIENT, 0, - KEY_READ, &hKey) == ERROR_SUCCESS) - { - if (get_REG_SZ(hKey, SEARCHLIST_KEY, &p)) - { - commajoin(outptr, p); - ares_free(p); - p = NULL; - } - RegCloseKey(hKey); - } - - /* 2. Connection Specific Search List composed of: - * a. Primary DNS Suffix */ - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_DNSCLIENT, 0, - KEY_READ, &hKey) == ERROR_SUCCESS) - { - if (get_REG_SZ(hKey, PRIMARYDNSSUFFIX_KEY, &p)) - { - commajoin(outptr, p); - ares_free(p); - p = NULL; - } - RegCloseKey(hKey); - } - - /* b. Interface SearchList, Domain, DhcpDomain */ - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY "\\" INTERFACES_KEY, 0, - KEY_READ, &hKey) == ERROR_SUCCESS) - { - for(;;) - { - keyNameBuffSize = sizeof(keyName); - if (RegEnumKeyExA(hKey, keyIdx++, keyName, &keyNameBuffSize, - 0, NULL, NULL, NULL) - != ERROR_SUCCESS) - break; - if (RegOpenKeyExA(hKey, keyName, 0, KEY_QUERY_VALUE, &hKeyEnum) - != ERROR_SUCCESS) - continue; - /* p can be comma separated (SearchList) */ - if (get_REG_SZ(hKeyEnum, SEARCHLIST_KEY, &p)) - { - commajoin(outptr, p); - ares_free(p); - p = NULL; - } - if (get_REG_SZ(hKeyEnum, DOMAIN_KEY, &p)) - { - commajoin(outptr, p); - ares_free(p); - p = NULL; - } - if (get_REG_SZ(hKeyEnum, DHCPDOMAIN_KEY, &p)) - { - commajoin(outptr, p); - ares_free(p); - p = NULL; - } - RegCloseKey(hKeyEnum); - } - RegCloseKey(hKey); - } - - return *outptr != NULL; -} - -#endif - -static int init_by_resolv_conf(ares_channel channel) -{ -#if !defined(ANDROID) && !defined(__ANDROID__) && !defined(WATT32) && \ - !defined(CARES_USE_LIBRESOLV) - char *line = NULL; -#endif - int status = -1, nservers = 0, nsort = 0; - struct server_state *servers = NULL; - struct apattern *sortlist = NULL; - -#ifdef WIN32 - - if (channel->nservers > -1) /* don't override ARES_OPT_SERVER */ - return ARES_SUCCESS; - - if (get_DNS_Windows(&line)) - { - status = config_nameserver(&servers, &nservers, line); - ares_free(line); - } - - if (channel->ndomains == -1 && get_SuffixList_Windows(&line)) - { - status = set_search(channel, line); - ares_free(line); - } - - if (status == ARES_SUCCESS) - status = ARES_EOF; - else - /* Catch the case when all the above checks fail (which happens when there - is no network card or the cable is unplugged) */ - status = ARES_EFILE; -#elif defined(__MVS__) - - struct __res_state *res = 0; - int count4, count6; - __STATEEXTIPV6 *v6; - struct server_state *pserver; - if (0 == res) { - int rc = res_init(); - while (rc == -1 && h_errno == TRY_AGAIN) { - rc = res_init(); - } - if (rc == -1) { - return ARES_ENOMEM; - } - res = __res(); - } - - v6 = res->__res_extIPv6; - count4 = res->nscount; - if (v6) { - count6 = v6->__stat_nscount; - } else { - count6 = 0; - } - - nservers = count4 + count6; - servers = ares_malloc(nservers * sizeof(struct server_state)); - if (!servers) - return ARES_ENOMEM; - - memset(servers, 0, nservers * sizeof(struct server_state)); - - pserver = servers; - for (int i = 0; i < count4; ++i, ++pserver) { - struct sockaddr_in *addr_in = &(res->nsaddr_list[i]); - pserver->addr.addrV4.s_addr = addr_in->sin_addr.s_addr; - pserver->addr.family = AF_INET; - pserver->addr.udp_port = addr_in->sin_port; - pserver->addr.tcp_port = addr_in->sin_port; - } - - for (int j = 0; j < count6; ++j, ++pserver) { - struct sockaddr_in6 *addr_in = &(v6->__stat_nsaddr_list[j]); - memcpy(&(pserver->addr.addr.addr6), &(addr_in->sin6_addr), - sizeof(addr_in->sin6_addr)); - pserver->addr.family = AF_INET6; - pserver->addr.udp_port = addr_in->sin6_port; - pserver->addr.tcp_port = addr_in->sin6_port; - } - - status = ARES_EOF; - -#elif defined(__riscos__) - - /* Under RISC OS, name servers are listed in the - system variable Inet$Resolvers, space separated. */ - - line = getenv("Inet$Resolvers"); - status = ARES_EOF; - if (line) { - char *resolvers = ares_strdup(line), *pos, *space; - - if (!resolvers) - return ARES_ENOMEM; - - pos = resolvers; - do { - space = strchr(pos, ' '); - if (space) - *space = '\0'; - status = config_nameserver(&servers, &nservers, pos); - if (status != ARES_SUCCESS) - break; - pos = space + 1; - } while (space); - - if (status == ARES_SUCCESS) - status = ARES_EOF; - - ares_free(resolvers); - } - -#elif defined(WATT32) - int i; - - sock_init(); - for (i = 0; def_nameservers[i]; i++) - ; - if (i == 0) - return ARES_SUCCESS; /* use localhost DNS server */ - - nservers = i; - servers = ares_malloc(sizeof(struct server_state)); - if (!servers) - return ARES_ENOMEM; - memset(servers, 0, sizeof(struct server_state)); - - for (i = 0; def_nameservers[i]; i++) - { - servers[i].addr.addrV4.s_addr = htonl(def_nameservers[i]); - servers[i].addr.family = AF_INET; - servers[i].addr.udp_port = 0; - servers[i].addr.tcp_port = 0; - } - status = ARES_EOF; - -#elif defined(ANDROID) || defined(__ANDROID__) - unsigned int i; - char **dns_servers; - char *domains; - size_t num_servers; - - /* Use the Android connectivity manager to get a list - * of DNS servers. As of Android 8 (Oreo) net.dns# - * system properties are no longer available. Google claims this - * improves privacy. Apps now need the ACCESS_NETWORK_STATE - * permission and must use the ConnectivityManager which - * is Java only. */ - dns_servers = ares_get_android_server_list(MAX_DNS_PROPERTIES, &num_servers); - if (dns_servers != NULL) - { - for (i = 0; i < num_servers; i++) - { - status = config_nameserver(&servers, &nservers, dns_servers[i]); - if (status != ARES_SUCCESS) - break; - status = ARES_EOF; - } - for (i = 0; i < num_servers; i++) - { - ares_free(dns_servers[i]); - } - ares_free(dns_servers); - } - if (channel->ndomains == -1) - { - domains = ares_get_android_search_domains_list(); - set_search(channel, domains); - ares_free(domains); - } - -# ifdef HAVE___SYSTEM_PROPERTY_GET - /* Old way using the system property still in place as - * a fallback. Older android versions can still use this. - * it's possible for older apps not not have added the new - * permission and we want to try to avoid breaking those. - * - * We'll only run this if we don't have any dns servers - * because this will get the same ones (if it works). */ - if (status != ARES_EOF) { - char propname[PROP_NAME_MAX]; - char propvalue[PROP_VALUE_MAX]=""; - for (i = 1; i <= MAX_DNS_PROPERTIES; i++) { - snprintf(propname, sizeof(propname), "%s%u", DNS_PROP_NAME_PREFIX, i); - if (__system_property_get(propname, propvalue) < 1) { - status = ARES_EOF; - break; - } - - status = config_nameserver(&servers, &nservers, propvalue); - if (status != ARES_SUCCESS) - break; - status = ARES_EOF; - } - } -# endif /* HAVE___SYSTEM_PROPERTY_GET */ -#elif defined(CARES_USE_LIBRESOLV) - struct __res_state res; - memset(&res, 0, sizeof(res)); - int result = res_ninit(&res); - if (result == 0 && (res.options & RES_INIT)) { - status = ARES_EOF; - - if (channel->nservers == -1) { - union res_sockaddr_union addr[MAXNS]; - int nscount = res_getservers(&res, addr, MAXNS); - int i; - for (i = 0; i < nscount; ++i) { - char str[INET6_ADDRSTRLEN]; - int config_status; - sa_family_t family = addr[i].sin.sin_family; - if (family == AF_INET) { - ares_inet_ntop(family, &addr[i].sin.sin_addr, str, sizeof(str)); - } else if (family == AF_INET6) { - ares_inet_ntop(family, &addr[i].sin6.sin6_addr, str, sizeof(str)); - } else { - continue; - } - - config_status = config_nameserver(&servers, &nservers, str); - if (config_status != ARES_SUCCESS) { - status = config_status; - break; - } - } - } - if (channel->ndomains == -1) { - int entries = 0; - while ((entries < MAXDNSRCH) && res.dnsrch[entries]) - entries++; - if(entries) { - channel->domains = ares_malloc(entries * sizeof(char *)); - if (!channel->domains) { - status = ARES_ENOMEM; - } else { - int i; - channel->ndomains = entries; - for (i = 0; i < channel->ndomains; ++i) { - channel->domains[i] = ares_strdup(res.dnsrch[i]); - if (!channel->domains[i]) - status = ARES_ENOMEM; - } - } - } - } - if (channel->ndots == -1) - channel->ndots = res.ndots; - if (channel->tries == -1) - channel->tries = res.retry; - if (channel->rotate == -1) - channel->rotate = res.options & RES_ROTATE; - if (channel->timeout == -1) { - channel->timeout = res.retrans * 1000; -#ifdef __APPLE__ - channel->timeout /= (res.retry + 1) * (res.nscount > 0 ? res.nscount : 1); -#endif - } - - res_ndestroy(&res); - } -#else - { - char *p; - FILE *fp; - size_t linesize; - int error; - int update_domains; - const char *resolvconf_path; - - /* Don't read resolv.conf and friends if we don't have to */ - if (ARES_CONFIG_CHECK(channel)) - return ARES_SUCCESS; - - /* Only update search domains if they're not already specified */ - update_domains = (channel->ndomains == -1); - - /* Support path for resolvconf filename set by ares_init_options */ - if(channel->resolvconf_path) { - resolvconf_path = channel->resolvconf_path; - } else { - resolvconf_path = PATH_RESOLV_CONF; - } - - fp = fopen(resolvconf_path, "r"); - if (fp) { - while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) - { - if ((p = try_config(line, "domain", ';')) && update_domains) - status = config_domain(channel, p); - else if ((p = try_config(line, "lookup", ';')) && !channel->lookups) - status = config_lookup(channel, p, "bind", NULL, "file"); - else if ((p = try_config(line, "search", ';')) && update_domains) - status = set_search(channel, p); - else if ((p = try_config(line, "nameserver", ';')) && - channel->nservers == -1) - status = config_nameserver(&servers, &nservers, p); - else if ((p = try_config(line, "sortlist", ';')) && - channel->nsort == -1) - status = config_sortlist(&sortlist, &nsort, p); - else if ((p = try_config(line, "options", ';'))) - status = set_options(channel, p); - else - status = ARES_SUCCESS; - if (status != ARES_SUCCESS) - break; - } - fclose(fp); - } - else { - error = ERRNO; - switch(error) { - case ENOENT: - case ESRCH: - status = ARES_EOF; - break; - default: - DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", - error, strerror(error))); - DEBUGF(fprintf(stderr, "Error opening file: %s\n", PATH_RESOLV_CONF)); - status = ARES_EFILE; - } - } - - if ((status == ARES_EOF) && (!channel->lookups)) { - /* Many systems (Solaris, Linux, BSD's) use nsswitch.conf */ - fp = fopen("/etc/nsswitch.conf", "r"); - if (fp) { - while ((status = ares__read_line(fp, &line, &linesize)) == - ARES_SUCCESS) - { - if ((p = try_config(line, "hosts:", '\0')) && !channel->lookups) - (void)config_lookup(channel, p, "dns", "resolve", "files"); - } - fclose(fp); - } - else { - error = ERRNO; - switch(error) { - case ENOENT: - case ESRCH: - break; - default: - DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", - error, strerror(error))); - DEBUGF(fprintf(stderr, "Error opening file: %s\n", - "/etc/nsswitch.conf")); - } - - /* ignore error, maybe we will get luck in next if clause */ - status = ARES_EOF; - } - } - - if ((status == ARES_EOF) && (!channel->lookups)) { - /* Linux / GNU libc 2.x and possibly others have host.conf */ - fp = fopen("/etc/host.conf", "r"); - if (fp) { - while ((status = ares__read_line(fp, &line, &linesize)) == - ARES_SUCCESS) - { - if ((p = try_config(line, "order", '\0')) && !channel->lookups) - /* ignore errors */ - (void)config_lookup(channel, p, "bind", NULL, "hosts"); - } - fclose(fp); - } - else { - error = ERRNO; - switch(error) { - case ENOENT: - case ESRCH: - break; - default: - DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", - error, strerror(error))); - DEBUGF(fprintf(stderr, "Error opening file: %s\n", - "/etc/host.conf")); - } - - /* ignore error, maybe we will get luck in next if clause */ - status = ARES_EOF; - } - } - - if ((status == ARES_EOF) && (!channel->lookups)) { - /* Tru64 uses /etc/svc.conf */ - fp = fopen("/etc/svc.conf", "r"); - if (fp) { - while ((status = ares__read_line(fp, &line, &linesize)) == - ARES_SUCCESS) - { - if ((p = try_config(line, "hosts=", '\0')) && !channel->lookups) - /* ignore errors */ - (void)config_lookup(channel, p, "bind", NULL, "local"); - } - fclose(fp); - } - else { - error = ERRNO; - switch(error) { - case ENOENT: - case ESRCH: - break; - default: - DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", - error, strerror(error))); - DEBUGF(fprintf(stderr, "Error opening file: %s\n", "/etc/svc.conf")); - } - - /* ignore error, default value will be chosen for `channel->lookups` */ - status = ARES_EOF; - } - } - - if(line) - ares_free(line); - } - -#endif - - /* Handle errors. */ - if (status != ARES_EOF) - { - if (servers != NULL) - ares_free(servers); - if (sortlist != NULL) - ares_free(sortlist); - return status; - } - - /* If we got any name server entries, fill them in. */ - if (servers) - { - channel->servers = servers; - channel->nservers = nservers; - } - - /* If we got any sortlist entries, fill them in. */ - if (sortlist) - { - channel->sortlist = sortlist; - channel->nsort = nsort; - } - - return ARES_SUCCESS; -} - -static int init_by_defaults(ares_channel channel) -{ - char *hostname = NULL; - int rc = ARES_SUCCESS; -#ifdef HAVE_GETHOSTNAME - char *dot; -#endif - - if (channel->flags == -1) - channel->flags = 0; - if (channel->timeout == -1) - channel->timeout = DEFAULT_TIMEOUT; - if (channel->tries == -1) - channel->tries = DEFAULT_TRIES; - if (channel->ndots == -1) - channel->ndots = 1; - if (channel->rotate == -1) - channel->rotate = 0; - if (channel->udp_port == -1) - channel->udp_port = htons(NAMESERVER_PORT); - if (channel->tcp_port == -1) - channel->tcp_port = htons(NAMESERVER_PORT); - - if (channel->ednspsz == -1) - channel->ednspsz = EDNSPACKETSZ; - - if (channel->nservers == -1) { - /* If nobody specified servers, try a local named. */ - channel->servers = ares_malloc(sizeof(struct server_state)); - if (!channel->servers) { - rc = ARES_ENOMEM; - goto error; - } - channel->servers[0].addr.family = AF_INET; - channel->servers[0].addr.addrV4.s_addr = htonl(INADDR_LOOPBACK); - channel->servers[0].addr.udp_port = 0; - channel->servers[0].addr.tcp_port = 0; - channel->nservers = 1; - } - -#if defined(USE_WINSOCK) -#define toolong(x) (x == -1) && (SOCKERRNO == WSAEFAULT) -#elif defined(ENAMETOOLONG) -#define toolong(x) (x == -1) && ((SOCKERRNO == ENAMETOOLONG) || \ - (SOCKERRNO == EINVAL)) -#else -#define toolong(x) (x == -1) && (SOCKERRNO == EINVAL) -#endif - - if (channel->ndomains == -1) { - /* Derive a default domain search list from the kernel hostname, - * or set it to empty if the hostname isn't helpful. - */ -#ifndef HAVE_GETHOSTNAME - channel->ndomains = 0; /* default to none */ -#else - GETHOSTNAME_TYPE_ARG2 lenv = 64; - size_t len = 64; - int res; - channel->ndomains = 0; /* default to none */ - - hostname = ares_malloc(len); - if(!hostname) { - rc = ARES_ENOMEM; - goto error; - } - - do { - res = gethostname(hostname, lenv); - - if(toolong(res)) { - char *p; - len *= 2; - lenv *= 2; - p = ares_realloc(hostname, len); - if(!p) { - rc = ARES_ENOMEM; - goto error; - } - hostname = p; - continue; - } - else if(res) { - /* Lets not treat a gethostname failure as critical, since we - * are ok if gethostname doesn't even exist */ - *hostname = '\0'; - break; - } - - } while (res != 0); - - dot = strchr(hostname, '.'); - if (dot) { - /* a dot was found */ - channel->domains = ares_malloc(sizeof(char *)); - if (!channel->domains) { - rc = ARES_ENOMEM; - goto error; - } - channel->domains[0] = ares_strdup(dot + 1); - if (!channel->domains[0]) { - rc = ARES_ENOMEM; - goto error; - } - channel->ndomains = 1; - } -#endif - } - - if (channel->nsort == -1) { - channel->sortlist = NULL; - channel->nsort = 0; - } - - if (!channel->lookups) { - channel->lookups = ares_strdup("fb"); - if (!channel->lookups) - rc = ARES_ENOMEM; - } - - error: - if(rc) { - if(channel->servers) { - ares_free(channel->servers); - channel->servers = NULL; - } - - if(channel->domains && channel->domains[0]) - ares_free(channel->domains[0]); - if(channel->domains) { - ares_free(channel->domains); - channel->domains = NULL; - } - - if(channel->lookups) { - ares_free(channel->lookups); - channel->lookups = NULL; - } - - if(channel->resolvconf_path) { - ares_free(channel->resolvconf_path); - channel->resolvconf_path = NULL; - } - - if(channel->hosts_path) { - ares_free(channel->hosts_path); - channel->hosts_path = NULL; - } - } - - if(hostname) - ares_free(hostname); - - return rc; -} - -#if !defined(WIN32) && !defined(WATT32) && \ - !defined(ANDROID) && !defined(__ANDROID__) && !defined(CARES_USE_LIBRESOLV) -static int config_domain(ares_channel channel, char *str) -{ - char *q; - - /* Set a single search domain. */ - q = str; - while (*q && !ISSPACE(*q)) - q++; - *q = '\0'; - return set_search(channel, str); -} - -#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ - defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__) - /* workaround icc 9.1 optimizer issue */ -# define vqualifier volatile -#else -# define vqualifier -#endif - -static int config_lookup(ares_channel channel, const char *str, - const char *bindch, const char *altbindch, - const char *filech) -{ - char lookups[3], *l; - const char *vqualifier p; - int found; - - if (altbindch == NULL) - altbindch = bindch; - - /* Set the lookup order. Only the first letter of each work - * is relevant, and it has to be "b" for DNS or "f" for the - * host file. Ignore everything else. - */ - l = lookups; - p = str; - found = 0; - while (*p) - { - if ((*p == *bindch || *p == *altbindch || *p == *filech) && l < lookups + 2) { - if (*p == *bindch || *p == *altbindch) *l++ = 'b'; - else *l++ = 'f'; - found = 1; - } - while (*p && !ISSPACE(*p) && (*p != ',')) - p++; - while (*p && (ISSPACE(*p) || (*p == ','))) - p++; - } - if (!found) - return ARES_ENOTINITIALIZED; - *l = '\0'; - channel->lookups = ares_strdup(lookups); - return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM; -} -#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ & !CARES_USE_LIBRESOLV */ - -#ifndef WATT32 -/* Validate that the ip address matches the subnet (network base and network - * mask) specified. Addresses are specified in standard Network Byte Order as - * 16 bytes, and the netmask is 0 to 128 (bits). - */ -static int ares_ipv6_subnet_matches(const unsigned char netbase[16], - unsigned char netmask, - const unsigned char ipaddr[16]) -{ - unsigned char mask[16] = { 0 }; - unsigned char i; - - /* Misuse */ - if (netmask > 128) - return 0; - - /* Quickly set whole bytes */ - memset(mask, 0xFF, netmask / 8); - - /* Set remaining bits */ - if(netmask % 8) { - mask[netmask / 8] = (unsigned char)(0xff << (8 - (netmask % 8))); - } - - for (i=0; i<16; i++) { - if ((netbase[i] & mask[i]) != (ipaddr[i] & mask[i])) - return 0; - } - - return 1; -} - -/* Return true iff the IPv6 ipaddr is blacklisted. */ -static int ares_ipv6_server_blacklisted(const unsigned char ipaddr[16]) -{ - /* A list of blacklisted IPv6 subnets. */ - const struct { - const unsigned char netbase[16]; - unsigned char netmask; - } blacklist[] = { - /* fec0::/10 was deprecated by [RFC3879] in September 2004. Formerly a - * Site-Local scoped address prefix. These are never valid DNS servers, - * but are known to be returned at least sometimes on Windows and Android. - */ - { - { - 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }, - 10 - } - }; - size_t i; - - /* See if ipaddr matches any of the entries in the blacklist. */ - for (i = 0; i < sizeof(blacklist) / sizeof(blacklist[0]); ++i) { - if (ares_ipv6_subnet_matches( - blacklist[i].netbase, blacklist[i].netmask, ipaddr)) - return 1; - } - return 0; -} - -/* Add the IPv4 or IPv6 nameservers in str (separated by commas) to the - * servers list, updating servers and nservers as required. - * - * This will silently ignore blacklisted IPv6 nameservers as detected by - * ares_ipv6_server_blacklisted(). - * - * Returns an error code on failure, else ARES_SUCCESS. - */ -static int config_nameserver(struct server_state **servers, int *nservers, - char *str) -{ - struct ares_addr host; - struct server_state *newserv; - char *p, *txtaddr; - /* On Windows, there may be more than one nameserver specified in the same - * registry key, so we parse input as a space or comma seperated list. - */ - for (p = str; p;) - { - /* Skip whitespace and commas. */ - while (*p && (ISSPACE(*p) || (*p == ','))) - p++; - if (!*p) - /* No more input, done. */ - break; - - /* Pointer to start of IPv4 or IPv6 address part. */ - txtaddr = p; - - /* Advance past this address. */ - while (*p && !ISSPACE(*p) && (*p != ',')) - p++; - if (*p) - /* Null terminate this address. */ - *p++ = '\0'; - else - /* Reached end of input, done when this address is processed. */ - p = NULL; - - /* Convert textual address to binary format. */ - if (ares_inet_pton(AF_INET, txtaddr, &host.addrV4) == 1) - host.family = AF_INET; - else if (ares_inet_pton(AF_INET6, txtaddr, &host.addrV6) == 1 - /* Silently skip blacklisted IPv6 servers. */ - && !ares_ipv6_server_blacklisted( - (const unsigned char *)&host.addrV6)) - host.family = AF_INET6; - else - continue; - - /* Resize servers state array. */ - newserv = ares_realloc(*servers, (*nservers + 1) * - sizeof(struct server_state)); - if (!newserv) - return ARES_ENOMEM; - - /* Store address data. */ - newserv[*nservers].addr.family = host.family; - newserv[*nservers].addr.udp_port = 0; - newserv[*nservers].addr.tcp_port = 0; - if (host.family == AF_INET) - memcpy(&newserv[*nservers].addr.addrV4, &host.addrV4, - sizeof(host.addrV4)); - else - memcpy(&newserv[*nservers].addr.addrV6, &host.addrV6, - sizeof(host.addrV6)); - - /* Update arguments. */ - *servers = newserv; - *nservers += 1; - } - - return ARES_SUCCESS; -} -#endif /* !WATT32 */ - -static int config_sortlist(struct apattern **sortlist, int *nsort, - const char *str) -{ - struct apattern pat; - const char *q; - - /* Add sortlist entries. */ - while (*str && *str != ';') - { - int bits; - char ipbuf[16], ipbufpfx[32]; - /* Find just the IP */ - q = str; - while (*q && *q != '/' && *q != ';' && !ISSPACE(*q)) - q++; - if (q-str >= 16) - return ARES_EBADSTR; - memcpy(ipbuf, str, q-str); - ipbuf[q-str] = '\0'; - /* Find the prefix */ - if (*q == '/') - { - const char *str2 = q+1; - while (*q && *q != ';' && !ISSPACE(*q)) - q++; - if (q-str >= 32) - return ARES_EBADSTR; - memcpy(ipbufpfx, str, q-str); - ipbufpfx[q-str] = '\0'; - str = str2; - } - else - ipbufpfx[0] = '\0'; - /* Lets see if it is CIDR */ - /* First we'll try IPv6 */ - if ((bits = ares_inet_net_pton(AF_INET6, ipbufpfx[0] ? ipbufpfx : ipbuf, - &pat.addrV6, - sizeof(pat.addrV6))) > 0) - { - pat.type = PATTERN_CIDR; - pat.mask.bits = (unsigned short)bits; - pat.family = AF_INET6; - if (!sortlist_alloc(sortlist, nsort, &pat)) { - ares_free(*sortlist); - *sortlist = NULL; - return ARES_ENOMEM; - } - } - else if (ipbufpfx[0] && - (bits = ares_inet_net_pton(AF_INET, ipbufpfx, &pat.addrV4, - sizeof(pat.addrV4))) > 0) - { - pat.type = PATTERN_CIDR; - pat.mask.bits = (unsigned short)bits; - pat.family = AF_INET; - if (!sortlist_alloc(sortlist, nsort, &pat)) { - ares_free(*sortlist); - *sortlist = NULL; - return ARES_ENOMEM; - } - } - /* See if it is just a regular IP */ - else if (ip_addr(ipbuf, q-str, &pat.addrV4) == 0) - { - if (ipbufpfx[0]) - { - memcpy(ipbuf, str, q-str); - ipbuf[q-str] = '\0'; - if (ip_addr(ipbuf, q-str, &pat.mask.addr4) != 0) - natural_mask(&pat); - } - else - natural_mask(&pat); - pat.family = AF_INET; - pat.type = PATTERN_MASK; - if (!sortlist_alloc(sortlist, nsort, &pat)) { - ares_free(*sortlist); - *sortlist = NULL; - return ARES_ENOMEM; - } - } - else - { - while (*q && *q != ';' && !ISSPACE(*q)) - q++; - } - str = q; - while (ISSPACE(*str)) - str++; - } - - return ARES_SUCCESS; -} - -static int set_search(ares_channel channel, const char *str) -{ - size_t cnt; - - if(channel->ndomains != -1) { - /* LCOV_EXCL_START: all callers check ndomains == -1 */ - /* if we already have some domains present, free them first */ - ares__strsplit_free(channel->domains, channel->ndomains); - channel->domains = NULL; - channel->ndomains = -1; - } /* LCOV_EXCL_STOP */ - - channel->domains = ares__strsplit(str, ", ", &cnt); - channel->ndomains = (int)cnt; - if (channel->domains == NULL || channel->ndomains == 0) { - channel->domains = NULL; - channel->ndomains = -1; - } - - return ARES_SUCCESS; -} - -static int set_options(ares_channel channel, const char *str) -{ - const char *p, *q, *val; - - p = str; - while (*p) - { - q = p; - while (*q && !ISSPACE(*q)) - q++; - val = try_option(p, q, "ndots:"); - if (val && channel->ndots == -1) - channel->ndots = aresx_sltosi(strtol(val, NULL, 10)); - val = try_option(p, q, "retrans:"); - if (val && channel->timeout == -1) - channel->timeout = aresx_sltosi(strtol(val, NULL, 10)); - val = try_option(p, q, "retry:"); - if (val && channel->tries == -1) - channel->tries = aresx_sltosi(strtol(val, NULL, 10)); - val = try_option(p, q, "rotate"); - if (val && channel->rotate == -1) - channel->rotate = 1; - p = q; - while (ISSPACE(*p)) - p++; - } - - return ARES_SUCCESS; -} - -static const char *try_option(const char *p, const char *q, const char *opt) -{ - size_t len = strlen(opt); - return ((size_t)(q - p) >= len && !strncmp(p, opt, len)) ? &p[len] : NULL; -} - -#if !defined(WIN32) && !defined(WATT32) && \ - !defined(ANDROID) && !defined(__ANDROID__) && !defined(CARES_USE_LIBRESOLV) -static char *try_config(char *s, const char *opt, char scc) -{ - size_t len; - char *p; - char *q; - - if (!s || !opt) - /* no line or no option */ - return NULL; /* LCOV_EXCL_LINE */ - - /* Hash '#' character is always used as primary comment char, additionally - a not-NUL secondary comment char will be considered when specified. */ - - /* trim line comment */ - p = s; - if(scc) - while (*p && (*p != '#') && (*p != scc)) - p++; - else - while (*p && (*p != '#')) - p++; - *p = '\0'; - - /* trim trailing whitespace */ - q = p - 1; - while ((q >= s) && ISSPACE(*q)) - q--; - *++q = '\0'; - - /* skip leading whitespace */ - p = s; - while (*p && ISSPACE(*p)) - p++; - - if (!*p) - /* empty line */ - return NULL; - - if ((len = strlen(opt)) == 0) - /* empty option */ - return NULL; /* LCOV_EXCL_LINE */ - - if (strncmp(p, opt, len) != 0) - /* line and option do not match */ - return NULL; - - /* skip over given option name */ - p += len; - - if (!*p) - /* no option value */ - return NULL; /* LCOV_EXCL_LINE */ - - if ((opt[len-1] != ':') && (opt[len-1] != '=') && !ISSPACE(*p)) - /* whitespace between option name and value is mandatory - for given option names which do not end with ':' or '=' */ - return NULL; - - /* skip over whitespace */ - while (*p && ISSPACE(*p)) - p++; - - if (!*p) - /* no option value */ - return NULL; - - /* return pointer to option value */ - return p; -} -#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ */ - -static int ip_addr(const char *ipbuf, ares_ssize_t len, struct in_addr *addr) -{ - - /* Four octets and three periods yields at most 15 characters. */ - if (len > 15) - return -1; - - if (ares_inet_pton(AF_INET, ipbuf, addr) < 1) - return -1; - - return 0; -} - -static void natural_mask(struct apattern *pat) -{ - struct in_addr addr; - - /* Store a host-byte-order copy of pat in a struct in_addr. Icky, - * but portable. - */ - addr.s_addr = ntohl(pat->addrV4.s_addr); - - /* This is out of date in the CIDR world, but some people might - * still rely on it. - */ - if (IN_CLASSA(addr.s_addr)) - pat->mask.addr4.s_addr = htonl(IN_CLASSA_NET); - else if (IN_CLASSB(addr.s_addr)) - pat->mask.addr4.s_addr = htonl(IN_CLASSB_NET); - else - pat->mask.addr4.s_addr = htonl(IN_CLASSC_NET); -} - -static int sortlist_alloc(struct apattern **sortlist, int *nsort, - struct apattern *pat) -{ - struct apattern *newsort; - newsort = ares_realloc(*sortlist, (*nsort + 1) * sizeof(struct apattern)); - if (!newsort) - return 0; - newsort[*nsort] = *pat; - *sortlist = newsort; - (*nsort)++; - return 1; -} - - -void ares_set_local_ip4(ares_channel channel, unsigned int local_ip) -{ - channel->local_ip4 = local_ip; -} - -/* local_ip6 should be 16 bytes in length */ -void ares_set_local_ip6(ares_channel channel, - const unsigned char* local_ip6) -{ - memcpy(&channel->local_ip6, local_ip6, sizeof(channel->local_ip6)); -} - -/* local_dev_name should be null terminated. */ -void ares_set_local_dev(ares_channel channel, - const char* local_dev_name) -{ - strncpy(channel->local_dev_name, local_dev_name, - sizeof(channel->local_dev_name)); - channel->local_dev_name[sizeof(channel->local_dev_name) - 1] = 0; -} - - -void ares_set_socket_callback(ares_channel channel, - ares_sock_create_callback cb, - void *data) -{ - channel->sock_create_cb = cb; - channel->sock_create_cb_data = data; -} - -void ares_set_socket_configure_callback(ares_channel channel, - ares_sock_config_callback cb, - void *data) -{ - channel->sock_config_cb = cb; - channel->sock_config_cb_data = data; -} - -void ares_set_socket_functions(ares_channel channel, - const struct ares_socket_functions * funcs, - void *data) -{ - channel->sock_funcs = funcs; - channel->sock_func_cb_data = data; -} - -int ares_set_sortlist(ares_channel channel, const char *sortstr) -{ - int nsort = 0; - struct apattern *sortlist = NULL; - int status; - - if (!channel) - return ARES_ENODATA; - - status = config_sortlist(&sortlist, &nsort, sortstr); - if (status == ARES_SUCCESS && sortlist) { - if (channel->sortlist) - ares_free(channel->sortlist); - channel->sortlist = sortlist; - channel->nsort = nsort; - } - return status; -} - -void ares__init_servers_state(ares_channel channel) -{ - struct server_state *server; - int i; - - for (i = 0; i < channel->nservers; i++) - { - server = &channel->servers[i]; - server->udp_socket = ARES_SOCKET_BAD; - server->tcp_socket = ARES_SOCKET_BAD; - server->tcp_connection_generation = ++channel->tcp_connection_generation; - server->tcp_lenbuf_pos = 0; - server->tcp_buffer_pos = 0; - server->tcp_buffer = NULL; - server->tcp_length = 0; - server->qhead = NULL; - server->qtail = NULL; - ares__init_list_head(&server->queries_to_server); - server->channel = channel; - server->is_broken = 0; - } -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_iphlpapi.h b/lib/c-ares-1.19.1/src/lib/ares_iphlpapi.h deleted file mode 100644 index 343aee3ffbd..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_iphlpapi.h +++ /dev/null @@ -1,221 +0,0 @@ -#ifndef HEADER_CARES_IPHLPAPI_H -#define HEADER_CARES_IPHLPAPI_H - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004 - 2011 by Daniel Stenberg et al - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#if defined(USE_WINSOCK) - -#ifndef INET_ADDRSTRLEN -#define INET_ADDRSTRLEN 22 -#endif - -#ifndef INET6_ADDRSTRLEN -#define INET6_ADDRSTRLEN 65 -#endif - -/* ---------------------------------- */ -#if !defined(_WS2DEF_) && \ - !defined(__CSADDR_DEFINED__) && \ - !defined(__CSADDR_T_DEFINED) -/* ---------------------------------- */ - -typedef struct _SOCKET_ADDRESS { - LPSOCKADDR lpSockaddr; - INT iSockaddrLength; -} SOCKET_ADDRESS, *PSOCKET_ADDRESS; - -typedef struct _CSADDR_INFO { - SOCKET_ADDRESS LocalAddr; - SOCKET_ADDRESS RemoteAddr; - INT iSocketType; - INT iProtocol; -} CSADDR_INFO, *PCSADDR_INFO; - -/* --------------------------------- */ -#endif /* ! _WS2DEF_ && \ */ -/* ! __CSADDR_DEFINED__ && \ */ -/* ! __CSADDR_T_DEFINED */ -/* --------------------------------- */ - -/* ------------------------------- */ -#if !defined(IP_ADAPTER_DDNS_ENABLED) -/* ------------------------------- */ - -#define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x0001 -#define IP_ADAPTER_ADDRESS_TRANSIENT 0x0002 - -#define IP_ADAPTER_DDNS_ENABLED 0x0001 -#define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x0002 -#define IP_ADAPTER_DHCP_ENABLED 0x0004 -#define IP_ADAPTER_RECEIVE_ONLY 0x0008 -#define IP_ADAPTER_NO_MULTICAST 0x0010 -#define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x0020 - -#define GAA_FLAG_SKIP_UNICAST 0x0001 -#define GAA_FLAG_SKIP_ANYCAST 0x0002 -#define GAA_FLAG_SKIP_MULTICAST 0x0004 -#define GAA_FLAG_SKIP_DNS_SERVER 0x0008 -#define GAA_FLAG_INCLUDE_PREFIX 0x0010 -#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020 - -typedef enum { - IpPrefixOriginOther = 0, - IpPrefixOriginManual, - IpPrefixOriginWellKnown, - IpPrefixOriginDhcp, - IpPrefixOriginRouterAdvertisement -} IP_PREFIX_ORIGIN; - -typedef enum { - IpSuffixOriginOther = 0, - IpSuffixOriginManual, - IpSuffixOriginWellKnown, - IpSuffixOriginDhcp, - IpSuffixOriginLinkLayerAddress, - IpSuffixOriginRandom -} IP_SUFFIX_ORIGIN; - -typedef enum { - IpDadStateInvalid = 0, - IpDadStateTentative, - IpDadStateDuplicate, - IpDadStateDeprecated, - IpDadStatePreferred -} IP_DAD_STATE; - -typedef enum { - IfOperStatusUp = 1, - IfOperStatusDown, - IfOperStatusTesting, - IfOperStatusUnknown, - IfOperStatusDormant, - IfOperStatusNotPresent, - IfOperStatusLowerLayerDown -} IF_OPER_STATUS; - -typedef enum { - ScopeLevelInterface = 0x0001, - ScopeLevelLink = 0x0002, - ScopeLevelSubnet = 0x0003, - ScopeLevelAdmin = 0x0004, - ScopeLevelSite = 0x0005, - ScopeLevelOrganization = 0x0008, - ScopeLevelGlobal = 0x000E -} SCOPE_LEVEL; - -typedef struct _IP_ADAPTER_UNICAST_ADDRESS { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Flags; - } s; - } u; - struct _IP_ADAPTER_UNICAST_ADDRESS *Next; - SOCKET_ADDRESS Address; - IP_PREFIX_ORIGIN PrefixOrigin; - IP_SUFFIX_ORIGIN SuffixOrigin; - IP_DAD_STATE DadState; - ULONG ValidLifetime; - ULONG PreferredLifetime; - ULONG LeaseLifetime; -} IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS; - -typedef struct _IP_ADAPTER_ANYCAST_ADDRESS { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Flags; - } s; - } u; - struct _IP_ADAPTER_ANYCAST_ADDRESS *Next; - SOCKET_ADDRESS Address; -} IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS; - -typedef struct _IP_ADAPTER_MULTICAST_ADDRESS { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Flags; - } s; - } u; - struct _IP_ADAPTER_MULTICAST_ADDRESS *Next; - SOCKET_ADDRESS Address; -} IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS; - -typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Reserved; - } s; - } u; - struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next; - SOCKET_ADDRESS Address; -} IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS; - -typedef struct _IP_ADAPTER_PREFIX { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Flags; - } s; - } u; - struct _IP_ADAPTER_PREFIX *Next; - SOCKET_ADDRESS Address; - ULONG PrefixLength; -} IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX; - -typedef struct _IP_ADAPTER_ADDRESSES { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD IfIndex; - } s; - } u; - struct _IP_ADAPTER_ADDRESSES *Next; - PCHAR AdapterName; - PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress; - PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress; - PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress; - PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress; - PWCHAR DnsSuffix; - PWCHAR Description; - PWCHAR FriendlyName; - BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH]; - DWORD PhysicalAddressLength; - DWORD Flags; - DWORD Mtu; - DWORD IfType; - IF_OPER_STATUS OperStatus; - DWORD Ipv6IfIndex; - DWORD ZoneIndices[16]; - PIP_ADAPTER_PREFIX FirstPrefix; -} IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES; - -/* -------------------------------- */ -#endif /* ! IP_ADAPTER_DDNS_ENABLED */ -/* -------------------------------- */ - -#endif /* USE_WINSOCK */ - -#endif /* HEADER_CARES_IPHLPAPI_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_ipv6.h b/lib/c-ares-1.19.1/src/lib/ares_ipv6.h deleted file mode 100644 index fdbc21fe8f9..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_ipv6.h +++ /dev/null @@ -1,85 +0,0 @@ - -/* Copyright (C) 2005 by Dominick Meglio - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#ifndef ARES_IPV6_H -#define ARES_IPV6_H - -#ifndef HAVE_PF_INET6 -#define PF_INET6 AF_INET6 -#endif - -#ifndef HAVE_STRUCT_SOCKADDR_IN6 -struct sockaddr_in6 -{ - unsigned short sin6_family; - unsigned short sin6_port; - unsigned long sin6_flowinfo; - struct ares_in6_addr sin6_addr; - unsigned int sin6_scope_id; -}; -#endif - -typedef union -{ - struct sockaddr sa; - struct sockaddr_in sa4; - struct sockaddr_in6 sa6; -} ares_sockaddr; - -#ifndef HAVE_STRUCT_ADDRINFO -struct addrinfo -{ - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - ares_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ - char *ai_canonname; - struct sockaddr *ai_addr; - struct addrinfo *ai_next; -}; -#endif - -#ifndef NS_IN6ADDRSZ -#ifndef HAVE_STRUCT_IN6_ADDR -/* We cannot have it set to zero, so we pick a fixed value here */ -#define NS_IN6ADDRSZ 16 -#else -#define NS_IN6ADDRSZ sizeof(struct in6_addr) -#endif -#endif - -#ifndef NS_INADDRSZ -#define NS_INADDRSZ sizeof(struct in_addr) -#endif - -#ifndef NS_INT16SZ -#define NS_INT16SZ 2 -#endif - -#ifndef IF_NAMESIZE -#ifdef IFNAMSIZ -#define IF_NAMESIZE IFNAMSIZ -#else -#define IF_NAMESIZE 256 -#endif -#endif - -/* Defined in inet_net_pton.c for no particular reason. */ -extern const struct ares_in6_addr ares_in6addr_any; /* :: */ - - -#endif /* ARES_IPV6_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_library_init.c b/lib/c-ares-1.19.1/src/lib/ares_library_init.c deleted file mode 100644 index bbfcbeec178..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_library_init.c +++ /dev/null @@ -1,113 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2009 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include "ares.h" -#include "ares_private.h" - -/* library-private global and unique instance vars */ - -#if defined(ANDROID) || defined(__ANDROID__) -#include "ares_android.h" -#endif - -/* library-private global vars with source visibility restricted to this file */ - -static unsigned int ares_initialized; -static int ares_init_flags; - -/* library-private global vars with visibility across the whole library */ - -/* Some systems may return either NULL or a valid pointer on malloc(0). c-ares should - * never call malloc(0) so lets return NULL so we're more likely to find an issue if it - * were to occur. */ - -static void *default_malloc(size_t size) { if (size == 0) { return NULL; } return malloc(size); } - -#if defined(WIN32) -/* We need indirections to handle Windows DLL rules. */ -static void *default_realloc(void *p, size_t size) { return realloc(p, size); } -static void default_free(void *p) { free(p); } -#else -# define default_realloc realloc -# define default_free free -#endif -void *(*ares_malloc)(size_t size) = default_malloc; -void *(*ares_realloc)(void *ptr, size_t size) = default_realloc; -void (*ares_free)(void *ptr) = default_free; - -int ares_library_init(int flags) -{ - if (ares_initialized) - { - ares_initialized++; - return ARES_SUCCESS; - } - ares_initialized++; - - /* NOTE: ARES_LIB_INIT_WIN32 flag no longer used */ - - ares_init_flags = flags; - - return ARES_SUCCESS; -} - -int ares_library_init_mem(int flags, - void *(*amalloc)(size_t size), - void (*afree)(void *ptr), - void *(*arealloc)(void *ptr, size_t size)) -{ - if (amalloc) - ares_malloc = amalloc; - if (arealloc) - ares_realloc = arealloc; - if (afree) - ares_free = afree; - return ares_library_init(flags); -} - - -void ares_library_cleanup(void) -{ - if (!ares_initialized) - return; - ares_initialized--; - if (ares_initialized) - return; - - /* NOTE: ARES_LIB_INIT_WIN32 flag no longer used */ - -#if defined(ANDROID) || defined(__ANDROID__) - ares_library_cleanup_android(); -#endif - - ares_init_flags = ARES_LIB_INIT_NONE; - ares_malloc = malloc; - ares_realloc = realloc; - ares_free = free; -} - - -int ares_library_initialized(void) -{ -#ifdef USE_WINSOCK - if (!ares_initialized) - return ARES_ENOTINITIALIZED; -#endif - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_llist.c b/lib/c-ares-1.19.1/src/lib/ares_llist.c deleted file mode 100644 index 36ca84c43e4..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_llist.c +++ /dev/null @@ -1,63 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include "ares.h" -#include "ares_private.h" - -/* Routines for managing doubly-linked circular linked lists with a - * dummy head. - */ - -/* Initialize a new head node */ -void ares__init_list_head(struct list_node* head) { - head->prev = head; - head->next = head; - head->data = NULL; -} - -/* Initialize a list node */ -void ares__init_list_node(struct list_node* node, void* d) { - node->prev = NULL; - node->next = NULL; - node->data = d; -} - -/* Returns true iff the given list is empty */ -int ares__is_list_empty(struct list_node* head) { - return ((head->next == head) && (head->prev == head)); -} - -/* Inserts new_node before old_node */ -void ares__insert_in_list(struct list_node* new_node, - struct list_node* old_node) { - new_node->next = old_node; - new_node->prev = old_node->prev; - old_node->prev->next = new_node; - old_node->prev = new_node; -} - -/* Removes the node from the list it's in, if any */ -void ares__remove_from_list(struct list_node* node) { - if (node->next != NULL) { - node->prev->next = node->next; - node->next->prev = node->prev; - node->prev = NULL; - node->next = NULL; - } -} - diff --git a/lib/c-ares-1.19.1/src/lib/ares_llist.h b/lib/c-ares-1.19.1/src/lib/ares_llist.h deleted file mode 100644 index 20f4d1ce426..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_llist.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __ARES_LLIST_H -#define __ARES_LLIST_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - - -/* Node definition for circular, doubly-linked list */ -struct list_node { - struct list_node *prev; - struct list_node *next; - void* data; -}; - -void ares__init_list_head(struct list_node* head); - -void ares__init_list_node(struct list_node* node, void* d); - -int ares__is_list_empty(struct list_node* head); - -void ares__insert_in_list(struct list_node* new_node, - struct list_node* old_node); - -void ares__remove_from_list(struct list_node* node); - -#endif /* __ARES_LLIST_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_mkquery.c b/lib/c-ares-1.19.1/src/lib/ares_mkquery.c deleted file mode 100644 index 5aea914bd0e..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_mkquery.c +++ /dev/null @@ -1,24 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include "ares.h" - -int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id, - int rd, unsigned char **buf, int *buflen) -{ - return ares_create_query(name, dnsclass, type, id, rd, buf, buflen, 0); -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_nowarn.c b/lib/c-ares-1.19.1/src/lib/ares_nowarn.c deleted file mode 100644 index f63d9135ecc..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_nowarn.c +++ /dev/null @@ -1,260 +0,0 @@ - -/* Copyright (C) 2010-2013 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - - -#include "ares_setup.h" - -#ifdef HAVE_ASSERT_H -# include -#endif - -#ifdef HAVE_LIMITS_H -#include -#endif - -#if defined(__INTEL_COMPILER) && defined(__unix__) - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#endif /* __INTEL_COMPILER && __unix__ */ - -#define BUILDING_ARES_NOWARN_C 1 - -#include "ares_nowarn.h" - -#ifndef HAVE_LIMITS_H -/* systems without we guess have 16 bit shorts, 32bit ints and - 32bit longs */ -# define CARES_MASK_SSHORT 0x7FFF -# define CARES_MASK_USHORT 0xFFFF -# define CARES_MASK_SINT 0x7FFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFF -# define CARES_MASK_SLONG 0x7FFFFFFFL -# define CARES_MASK_ULONG 0xFFFFFFFFUL -#else -# define CARES_MASK_SSHORT SHRT_MAX -# define CARES_MASK_USHORT USHRT_MAX -# define CARES_MASK_SINT INT_MAX -# define CARES_MASK_UINT UINT_MAX -# define CARES_MASK_SLONG LONG_MAX -# define CARES_MASK_ULONG ULONG_MAX -#endif - -/* -** unsigned size_t to signed long -*/ - -long aresx_uztosl(size_t uznum) -{ -#ifdef __INTEL_COMPILER -# pragma warning(push) -# pragma warning(disable:810) /* conversion may lose significant bits */ -#endif - - return (long)(uznum & (size_t) CARES_MASK_SLONG); - -#ifdef __INTEL_COMPILER -# pragma warning(pop) -#endif -} - -/* -** unsigned size_t to signed int -*/ - -int aresx_uztosi(size_t uznum) -{ -#ifdef __INTEL_COMPILER -# pragma warning(push) -# pragma warning(disable:810) /* conversion may lose significant bits */ -#endif - - return (int)(uznum & (size_t) CARES_MASK_SINT); - -#ifdef __INTEL_COMPILER -# pragma warning(pop) -#endif -} - -/* -** unsigned size_t to signed short -*/ - -short aresx_uztoss(size_t uznum) -{ -#ifdef __INTEL_COMPILER -# pragma warning(push) -# pragma warning(disable:810) /* conversion may lose significant bits */ -#endif - - return (short)(uznum & (size_t) CARES_MASK_SSHORT); - -#ifdef __INTEL_COMPILER -# pragma warning(pop) -#endif -} - -/* -** signed int to signed short -*/ - -short aresx_sitoss(int sinum) -{ -#ifdef __INTEL_COMPILER -# pragma warning(push) -# pragma warning(disable:810) /* conversion may lose significant bits */ -#endif - - DEBUGASSERT(sinum >= 0); - return (short)(sinum & (int) CARES_MASK_SSHORT); - -#ifdef __INTEL_COMPILER -# pragma warning(pop) -#endif -} - -/* -** signed long to signed int -*/ - -int aresx_sltosi(long slnum) -{ -#ifdef __INTEL_COMPILER -# pragma warning(push) -# pragma warning(disable:810) /* conversion may lose significant bits */ -#endif - - DEBUGASSERT(slnum >= 0); - return (int)(slnum & (long) CARES_MASK_SINT); - -#ifdef __INTEL_COMPILER -# pragma warning(pop) -#endif -} - -/* -** signed ares_ssize_t to signed int -*/ - -int aresx_sztosi(ares_ssize_t sznum) -{ -#ifdef __INTEL_COMPILER -# pragma warning(push) -# pragma warning(disable:810) /* conversion may lose significant bits */ -#endif - - DEBUGASSERT(sznum >= 0); - return (int)(sznum & (ares_ssize_t) CARES_MASK_SINT); - -#ifdef __INTEL_COMPILER -# pragma warning(pop) -#endif -} - -/* -** signed ares_ssize_t to unsigned int -*/ - -unsigned int aresx_sztoui(ares_ssize_t sznum) -{ -#ifdef __INTEL_COMPILER -# pragma warning(push) -# pragma warning(disable:810) /* conversion may lose significant bits */ -#endif - - DEBUGASSERT(sznum >= 0); - return (unsigned int)(sznum & (ares_ssize_t) CARES_MASK_UINT); - -#ifdef __INTEL_COMPILER -# pragma warning(pop) -#endif -} - -/* -** signed int to unsigned short -*/ - -unsigned short aresx_sitous(int sinum) -{ -#ifdef __INTEL_COMPILER -# pragma warning(push) -# pragma warning(disable:810) /* conversion may lose significant bits */ -#endif - - DEBUGASSERT(sinum >= 0); - return (unsigned short)(sinum & (int) CARES_MASK_USHORT); - -#ifdef __INTEL_COMPILER -# pragma warning(pop) -#endif -} - -#if defined(__INTEL_COMPILER) && defined(__unix__) - -int aresx_FD_ISSET(int fd, fd_set *fdset) -{ - #pragma warning(push) - #pragma warning(disable:1469) /* clobber ignored */ - return FD_ISSET(fd, fdset); - #pragma warning(pop) -} - -void aresx_FD_SET(int fd, fd_set *fdset) -{ - #pragma warning(push) - #pragma warning(disable:1469) /* clobber ignored */ - FD_SET(fd, fdset); - #pragma warning(pop) -} - -void aresx_FD_ZERO(fd_set *fdset) -{ - #pragma warning(push) - #pragma warning(disable:593) /* variable was set but never used */ - FD_ZERO(fdset); - #pragma warning(pop) -} - -unsigned short aresx_htons(unsigned short usnum) -{ -#if (__INTEL_COMPILER == 910) && defined(__i386__) - return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF)); -#else - #pragma warning(push) - #pragma warning(disable:810) /* conversion may lose significant bits */ - return htons(usnum); - #pragma warning(pop) -#endif -} - -unsigned short aresx_ntohs(unsigned short usnum) -{ -#if (__INTEL_COMPILER == 910) && defined(__i386__) - return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF)); -#else - #pragma warning(push) - #pragma warning(disable:810) /* conversion may lose significant bits */ - return ntohs(usnum); - #pragma warning(pop) -#endif -} - -#endif /* __INTEL_COMPILER && __unix__ */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_nowarn.h b/lib/c-ares-1.19.1/src/lib/ares_nowarn.h deleted file mode 100644 index 505e6220981..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_nowarn.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef HEADER_CARES_NOWARN_H -#define HEADER_CARES_NOWARN_H - - -/* Copyright (C) 2010-2012 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -long aresx_uztosl(size_t uznum); -int aresx_uztosi(size_t uznum); -short aresx_uztoss(size_t uznum); - -short aresx_sitoss(int sinum); - -int aresx_sltosi(long slnum); - -int aresx_sztosi(ares_ssize_t sznum); - -unsigned int aresx_sztoui(ares_ssize_t sznum); - -unsigned short aresx_sitous(int sinum); - -#if defined(__INTEL_COMPILER) && defined(__unix__) - -int aresx_FD_ISSET(int fd, fd_set *fdset); - -void aresx_FD_SET(int fd, fd_set *fdset); - -void aresx_FD_ZERO(fd_set *fdset); - -unsigned short aresx_htons(unsigned short usnum); - -unsigned short aresx_ntohs(unsigned short usnum); - -#ifndef BUILDING_ARES_NOWARN_C -# undef FD_ISSET -# define FD_ISSET(a,b) aresx_FD_ISSET((a),(b)) -# undef FD_SET -# define FD_SET(a,b) aresx_FD_SET((a),(b)) -# undef FD_ZERO -# define FD_ZERO(a) aresx_FD_ZERO((a)) -# undef htons -# define htons(a) aresx_htons((a)) -# undef ntohs -# define ntohs(a) aresx_ntohs((a)) -#endif - -#endif /* __INTEL_COMPILER && __unix__ */ - -#endif /* HEADER_CARES_NOWARN_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_options.c b/lib/c-ares-1.19.1/src/lib/ares_options.c deleted file mode 100644 index de49de46259..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_options.c +++ /dev/null @@ -1,406 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2008-2013 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - - -#include "ares_setup.h" - -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares.h" -#include "ares_data.h" -#include "ares_inet_net_pton.h" -#include "ares_private.h" - - -int ares_get_servers(ares_channel channel, - struct ares_addr_node **servers) -{ - struct ares_addr_node *srvr_head = NULL; - struct ares_addr_node *srvr_last = NULL; - struct ares_addr_node *srvr_curr; - int status = ARES_SUCCESS; - int i; - - if (!channel) - return ARES_ENODATA; - - for (i = 0; i < channel->nservers; i++) - { - /* Allocate storage for this server node appending it to the list */ - srvr_curr = ares_malloc_data(ARES_DATATYPE_ADDR_NODE); - if (!srvr_curr) - { - status = ARES_ENOMEM; - break; - } - if (srvr_last) - { - srvr_last->next = srvr_curr; - } - else - { - srvr_head = srvr_curr; - } - srvr_last = srvr_curr; - - /* Fill this server node data */ - srvr_curr->family = channel->servers[i].addr.family; - if (srvr_curr->family == AF_INET) - memcpy(&srvr_curr->addrV4, &channel->servers[i].addr.addrV4, - sizeof(srvr_curr->addrV4)); - else - memcpy(&srvr_curr->addrV6, &channel->servers[i].addr.addrV6, - sizeof(srvr_curr->addrV6)); - } - - if (status != ARES_SUCCESS) - { - if (srvr_head) - { - ares_free_data(srvr_head); - srvr_head = NULL; - } - } - - *servers = srvr_head; - - return status; -} - -int ares_get_servers_ports(ares_channel channel, - struct ares_addr_port_node **servers) -{ - struct ares_addr_port_node *srvr_head = NULL; - struct ares_addr_port_node *srvr_last = NULL; - struct ares_addr_port_node *srvr_curr; - int status = ARES_SUCCESS; - int i; - - if (!channel) - return ARES_ENODATA; - - for (i = 0; i < channel->nservers; i++) - { - /* Allocate storage for this server node appending it to the list */ - srvr_curr = ares_malloc_data(ARES_DATATYPE_ADDR_PORT_NODE); - if (!srvr_curr) - { - status = ARES_ENOMEM; - break; - } - if (srvr_last) - { - srvr_last->next = srvr_curr; - } - else - { - srvr_head = srvr_curr; - } - srvr_last = srvr_curr; - - /* Fill this server node data */ - srvr_curr->family = channel->servers[i].addr.family; - srvr_curr->udp_port = ntohs((unsigned short)channel->servers[i].addr.udp_port); - srvr_curr->tcp_port = ntohs((unsigned short)channel->servers[i].addr.tcp_port); - if (srvr_curr->family == AF_INET) - memcpy(&srvr_curr->addrV4, &channel->servers[i].addr.addrV4, - sizeof(srvr_curr->addrV4)); - else - memcpy(&srvr_curr->addrV6, &channel->servers[i].addr.addrV6, - sizeof(srvr_curr->addrV6)); - } - - if (status != ARES_SUCCESS) - { - if (srvr_head) - { - ares_free_data(srvr_head); - srvr_head = NULL; - } - } - - *servers = srvr_head; - - return status; -} - -int ares_set_servers(ares_channel channel, - struct ares_addr_node *servers) -{ - struct ares_addr_node *srvr; - int num_srvrs = 0; - int i; - - if (ares_library_initialized() != ARES_SUCCESS) - return ARES_ENOTINITIALIZED; /* LCOV_EXCL_LINE: n/a on non-WinSock */ - - if (!channel) - return ARES_ENODATA; - - if (!ares__is_list_empty(&channel->all_queries)) - return ARES_ENOTIMP; - - ares__destroy_servers_state(channel); - - for (srvr = servers; srvr; srvr = srvr->next) - { - num_srvrs++; - } - - if (num_srvrs > 0) - { - /* Allocate storage for servers state */ - channel->servers = ares_malloc(num_srvrs * sizeof(struct server_state)); - if (!channel->servers) - { - return ARES_ENOMEM; - } - channel->nservers = num_srvrs; - /* Fill servers state address data */ - for (i = 0, srvr = servers; srvr; i++, srvr = srvr->next) - { - channel->servers[i].addr.family = srvr->family; - channel->servers[i].addr.udp_port = 0; - channel->servers[i].addr.tcp_port = 0; - if (srvr->family == AF_INET) - memcpy(&channel->servers[i].addr.addrV4, &srvr->addrV4, - sizeof(srvr->addrV4)); - else - memcpy(&channel->servers[i].addr.addrV6, &srvr->addrV6, - sizeof(srvr->addrV6)); - } - /* Initialize servers state remaining data */ - ares__init_servers_state(channel); - } - - return ARES_SUCCESS; -} - -int ares_set_servers_ports(ares_channel channel, - struct ares_addr_port_node *servers) -{ - struct ares_addr_port_node *srvr; - int num_srvrs = 0; - int i; - - if (ares_library_initialized() != ARES_SUCCESS) - return ARES_ENOTINITIALIZED; /* LCOV_EXCL_LINE: n/a on non-WinSock */ - - if (!channel) - return ARES_ENODATA; - - if (!ares__is_list_empty(&channel->all_queries)) - return ARES_ENOTIMP; - - ares__destroy_servers_state(channel); - - for (srvr = servers; srvr; srvr = srvr->next) - { - num_srvrs++; - } - - if (num_srvrs > 0) - { - /* Allocate storage for servers state */ - channel->servers = ares_malloc(num_srvrs * sizeof(struct server_state)); - if (!channel->servers) - { - return ARES_ENOMEM; - } - channel->nservers = num_srvrs; - /* Fill servers state address data */ - for (i = 0, srvr = servers; srvr; i++, srvr = srvr->next) - { - channel->servers[i].addr.family = srvr->family; - channel->servers[i].addr.udp_port = htons((unsigned short)srvr->udp_port); - channel->servers[i].addr.tcp_port = htons((unsigned short)srvr->tcp_port); - if (srvr->family == AF_INET) - memcpy(&channel->servers[i].addr.addrV4, &srvr->addrV4, - sizeof(srvr->addrV4)); - else - memcpy(&channel->servers[i].addr.addrV6, &srvr->addrV6, - sizeof(srvr->addrV6)); - } - /* Initialize servers state remaining data */ - ares__init_servers_state(channel); - } - - return ARES_SUCCESS; -} - -/* Incomming string format: host[:port][,host[:port]]... */ -/* IPv6 addresses with ports require square brackets [fe80::1%lo0]:53 */ -static int set_servers_csv(ares_channel channel, - const char* _csv, int use_port) -{ - size_t i; - char* csv = NULL; - char* ptr; - char* start_host; - int cc = 0; - int rv = ARES_SUCCESS; - struct ares_addr_port_node *servers = NULL; - struct ares_addr_port_node *last = NULL; - - if (ares_library_initialized() != ARES_SUCCESS) - return ARES_ENOTINITIALIZED; /* LCOV_EXCL_LINE: n/a on non-WinSock */ - - if (!channel) - return ARES_ENODATA; - - i = strlen(_csv); - if (i == 0) - return ARES_SUCCESS; /* blank all servers */ - - csv = ares_malloc(i + 2); - if (!csv) - return ARES_ENOMEM; - - strcpy(csv, _csv); - if (csv[i-1] != ',') { /* make parsing easier by ensuring ending ',' */ - csv[i] = ','; - csv[i+1] = 0; - } - - start_host = csv; - for (ptr = csv; *ptr; ptr++) { - if (*ptr == ':') { - /* count colons to determine if we have an IPv6 number or IPv4 with - port */ - cc++; - } - else if (*ptr == '[') { - /* move start_host if an open square bracket is found wrapping an IPv6 - address */ - start_host = ptr + 1; - } - else if (*ptr == ',') { - char* pp = ptr - 1; - char* p = ptr; - int port = 0; - struct in_addr in4; - struct ares_in6_addr in6; - struct ares_addr_port_node *s = NULL; - - *ptr = 0; /* null terminate host:port string */ - /* Got an entry..see if the port was specified. */ - if (cc > 0) { - while (pp > start_host) { - /* a single close square bracket followed by a colon, ']:' indicates - an IPv6 address with port */ - if ((*pp == ']') && (*p == ':')) - break; /* found port */ - /* a single colon, ':' indicates an IPv4 address with port */ - if ((*pp == ':') && (cc == 1)) - break; /* found port */ - if (!(ISDIGIT(*pp) || (*pp == ':'))) { - /* Found end of digits before we found :, so wasn't a port */ - /* must allow ':' for IPv6 case of ']:' indicates we found a port */ - pp = p = ptr; - break; - } - pp--; - p--; - } - if ((pp != start_host) && ((pp + 1) < ptr)) { - /* Found it. Parse over the port number */ - /* when an IPv6 address is wrapped with square brackets the port - starts at pp + 2 */ - if (*pp == ']') - p++; /* move p before ':' */ - /* p will point to the start of the port */ - port = (int)strtol(p, NULL, 10); - *pp = 0; /* null terminate host */ - } - } - /* resolve host, try ipv4 first, rslt is in network byte order */ - rv = ares_inet_pton(AF_INET, start_host, &in4); - if (!rv) { - /* Ok, try IPv6 then */ - rv = ares_inet_pton(AF_INET6, start_host, &in6); - if (!rv) { - rv = ARES_EBADSTR; - goto out; - } - /* was ipv6, add new server */ - s = ares_malloc(sizeof(*s)); - if (!s) { - rv = ARES_ENOMEM; - goto out; - } - s->family = AF_INET6; - memcpy(&s->addr, &in6, sizeof(struct ares_in6_addr)); - } - else { - /* was ipv4, add new server */ - s = ares_malloc(sizeof(*s)); - if (!s) { - rv = ARES_ENOMEM; - goto out; - } - s->family = AF_INET; - memcpy(&s->addr, &in4, sizeof(struct in_addr)); - } - if (s) { - s->udp_port = use_port ? port: 0; - s->tcp_port = s->udp_port; - s->next = NULL; - if (last) { - last->next = s; - /* need to move last to maintain the linked list */ - last = last->next; - } - else { - servers = s; - last = s; - } - } - - /* Set up for next one */ - start_host = ptr + 1; - cc = 0; - } - } - - rv = ares_set_servers_ports(channel, servers); - - out: - if (csv) - ares_free(csv); - while (servers) { - struct ares_addr_port_node *s = servers; - servers = servers->next; - ares_free(s); - } - - return rv; -} - -int ares_set_servers_csv(ares_channel channel, - const char* _csv) -{ - return set_servers_csv(channel, _csv, FALSE); -} - -int ares_set_servers_ports_csv(ares_channel channel, - const char* _csv) -{ - return set_servers_csv(channel, _csv, TRUE); -} - diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_a_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_a_reply.c deleted file mode 100644 index ee903c7510e..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_a_reply.c +++ /dev/null @@ -1,90 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2019 by Andrew Selivanov - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#ifdef HAVE_LIMITS_H -# include -#endif - -#include "ares.h" -#include "ares_dns.h" -#include "ares_private.h" - -int ares_parse_a_reply(const unsigned char *abuf, int alen, - struct hostent **host, struct ares_addrttl *addrttls, - int *naddrttls) -{ - struct ares_addrinfo ai; - char *question_hostname = NULL; - int status; - int req_naddrttls = 0; - - if (naddrttls) - { - req_naddrttls = *naddrttls; - *naddrttls = 0; - } - - memset(&ai, 0, sizeof(ai)); - - status = ares__parse_into_addrinfo(abuf, alen, 0, 0, &ai); - if (status != ARES_SUCCESS && status != ARES_ENODATA) - { - goto fail; - } - - if (host != NULL) - { - status = ares__addrinfo2hostent(&ai, AF_INET, host); - if (status != ARES_SUCCESS && status != ARES_ENODATA) - { - goto fail; - } - } - - if (addrttls != NULL && req_naddrttls) - { - ares__addrinfo2addrttl(&ai, AF_INET, req_naddrttls, addrttls, - NULL, naddrttls); - } - - -fail: - ares__freeaddrinfo_cnames(ai.cnames); - ares__freeaddrinfo_nodes(ai.nodes); - ares_free(ai.name); - ares_free(question_hostname); - - return status; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_aaaa_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_aaaa_reply.c deleted file mode 100644 index 091065d3176..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_aaaa_reply.c +++ /dev/null @@ -1,92 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright 2005 Dominick Meglio - * Copyright (C) 2019 by Andrew Selivanov - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#ifdef HAVE_LIMITS_H -# include -#endif - -#include "ares.h" -#include "ares_dns.h" -#include "ares_inet_net_pton.h" -#include "ares_private.h" - -int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, - struct hostent **host, struct ares_addr6ttl *addrttls, - int *naddrttls) -{ - struct ares_addrinfo ai; - char *question_hostname = NULL; - int status; - int req_naddrttls = 0; - - if (naddrttls) - { - req_naddrttls = *naddrttls; - *naddrttls = 0; - } - - memset(&ai, 0, sizeof(ai)); - - status = ares__parse_into_addrinfo(abuf, alen, 0, 0, &ai); - if (status != ARES_SUCCESS && status != ARES_ENODATA) - { - goto fail; - } - - if (host != NULL) - { - status = ares__addrinfo2hostent(&ai, AF_INET6, host); - if (status != ARES_SUCCESS && status != ARES_ENODATA) - { - goto fail; - } - } - - if (addrttls != NULL && req_naddrttls) - { - ares__addrinfo2addrttl(&ai, AF_INET6, req_naddrttls, NULL, - addrttls, naddrttls); - } - -fail: - ares__freeaddrinfo_cnames(ai.cnames); - ares__freeaddrinfo_nodes(ai.nodes); - ares_free(question_hostname); - ares_free(ai.name); - - return status; -} - diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_caa_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_caa_reply.c deleted file mode 100644 index f6d4d3c61f4..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_caa_reply.c +++ /dev/null @@ -1,199 +0,0 @@ - -/* Copyright 2020 by - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#include "ares.h" -#include "ares_dns.h" -#include "ares_data.h" -#include "ares_private.h" - -int -ares_parse_caa_reply (const unsigned char *abuf, int alen, - struct ares_caa_reply **caa_out) -{ - unsigned int qdcount, ancount, i; - const unsigned char *aptr; - const unsigned char *strptr; - int status, rr_type, rr_class, rr_len; - long len; - char *hostname = NULL, *rr_name = NULL; - struct ares_caa_reply *caa_head = NULL; - struct ares_caa_reply *caa_last = NULL; - struct ares_caa_reply *caa_curr; - - /* Set *caa_out to NULL for all failure cases. */ - *caa_out = NULL; - - /* Give up if abuf doesn't have room for a header. */ - if (alen < HFIXEDSZ) - return ARES_EBADRESP; - - /* Fetch the question and answer count from the header. */ - qdcount = DNS_HEADER_QDCOUNT (abuf); - ancount = DNS_HEADER_ANCOUNT (abuf); - if (qdcount != 1) - return ARES_EBADRESP; - if (ancount == 0) - return ARES_ENODATA; - - /* Expand the name from the question, and skip past the question. */ - aptr = abuf + HFIXEDSZ; - status = ares_expand_name (aptr, abuf, alen, &hostname, &len); - if (status != ARES_SUCCESS) - return status; - - if (aptr + len + QFIXEDSZ > abuf + alen) - { - ares_free (hostname); - return ARES_EBADRESP; - } - aptr += len + QFIXEDSZ; - - /* Examine each answer resource record (RR) in turn. */ - for (i = 0; i < ancount; i++) - { - /* Decode the RR up to the data field. */ - status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); - if (status != ARES_SUCCESS) - { - break; - } - aptr += len; - if (aptr + RRFIXEDSZ > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - rr_type = DNS_RR_TYPE (aptr); - rr_class = DNS_RR_CLASS (aptr); - rr_len = DNS_RR_LEN (aptr); - aptr += RRFIXEDSZ; - if (aptr + rr_len > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - - /* Check if we are really looking at a CAA record */ - if ((rr_class == C_IN || rr_class == C_CHAOS) && rr_type == T_CAA) - { - strptr = aptr; - - /* Allocate storage for this CAA answer appending it to the list */ - caa_curr = ares_malloc_data(ARES_DATATYPE_CAA_REPLY); - if (!caa_curr) - { - status = ARES_ENOMEM; - break; - } - if (caa_last) - { - caa_last->next = caa_curr; - } - else - { - caa_head = caa_curr; - } - caa_last = caa_curr; - if (rr_len < 2) - { - status = ARES_EBADRESP; - break; - } - caa_curr->critical = (int)*strptr++; - caa_curr->plength = (int)*strptr++; - if (caa_curr->plength <= 0 || (int)caa_curr->plength >= rr_len - 2) - { - status = ARES_EBADRESP; - break; - } - caa_curr->property = ares_malloc (caa_curr->plength + 1/* Including null byte */); - if (caa_curr->property == NULL) - { - status = ARES_ENOMEM; - break; - } - memcpy ((char *) caa_curr->property, strptr, caa_curr->plength); - /* Make sure we NULL-terminate */ - caa_curr->property[caa_curr->plength] = 0; - strptr += caa_curr->plength; - - caa_curr->length = rr_len - caa_curr->plength - 2; - if (caa_curr->length <= 0) - { - status = ARES_EBADRESP; - break; - } - caa_curr->value = ares_malloc (caa_curr->length + 1/* Including null byte */); - if (caa_curr->value == NULL) - { - status = ARES_ENOMEM; - break; - } - memcpy ((char *) caa_curr->value, strptr, caa_curr->length); - /* Make sure we NULL-terminate */ - caa_curr->value[caa_curr->length] = 0; - } - - /* Propagate any failures */ - if (status != ARES_SUCCESS) - { - break; - } - - /* Don't lose memory in the next iteration */ - ares_free (rr_name); - rr_name = NULL; - - /* Move on to the next record */ - aptr += rr_len; - } - - if (hostname) - ares_free (hostname); - if (rr_name) - ares_free (rr_name); - - /* clean up on error */ - if (status != ARES_SUCCESS) - { - if (caa_head) - ares_free_data (caa_head); - return status; - } - - /* everything looks fine, return the data */ - *caa_out = caa_head; - - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_mx_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_mx_reply.c deleted file mode 100644 index a497f558738..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_mx_reply.c +++ /dev/null @@ -1,164 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2010 Jeremy Lal - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_dns.h" -#include "ares_data.h" -#include "ares_private.h" - -int -ares_parse_mx_reply (const unsigned char *abuf, int alen, - struct ares_mx_reply **mx_out) -{ - unsigned int qdcount, ancount, i; - const unsigned char *aptr, *vptr; - int status, rr_type, rr_class, rr_len; - long len; - char *hostname = NULL, *rr_name = NULL; - struct ares_mx_reply *mx_head = NULL; - struct ares_mx_reply *mx_last = NULL; - struct ares_mx_reply *mx_curr; - - /* Set *mx_out to NULL for all failure cases. */ - *mx_out = NULL; - - /* Give up if abuf doesn't have room for a header. */ - if (alen < HFIXEDSZ) - return ARES_EBADRESP; - - /* Fetch the question and answer count from the header. */ - qdcount = DNS_HEADER_QDCOUNT (abuf); - ancount = DNS_HEADER_ANCOUNT (abuf); - if (qdcount != 1) - return ARES_EBADRESP; - if (ancount == 0) - return ARES_ENODATA; - - /* Expand the name from the question, and skip past the question. */ - aptr = abuf + HFIXEDSZ; - status = ares_expand_name (aptr, abuf, alen, &hostname, &len); - if (status != ARES_SUCCESS) - return status; - - if (aptr + len + QFIXEDSZ > abuf + alen) - { - ares_free (hostname); - return ARES_EBADRESP; - } - aptr += len + QFIXEDSZ; - - /* Examine each answer resource record (RR) in turn. */ - for (i = 0; i < ancount; i++) - { - /* Decode the RR up to the data field. */ - status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); - if (status != ARES_SUCCESS) - { - break; - } - aptr += len; - if (aptr + RRFIXEDSZ > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - rr_type = DNS_RR_TYPE (aptr); - rr_class = DNS_RR_CLASS (aptr); - rr_len = DNS_RR_LEN (aptr); - aptr += RRFIXEDSZ; - if (aptr + rr_len > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - - /* Check if we are really looking at a MX record */ - if (rr_class == C_IN && rr_type == T_MX) - { - /* parse the MX record itself */ - if (rr_len < 2) - { - status = ARES_EBADRESP; - break; - } - - /* Allocate storage for this MX answer appending it to the list */ - mx_curr = ares_malloc_data(ARES_DATATYPE_MX_REPLY); - if (!mx_curr) - { - status = ARES_ENOMEM; - break; - } - if (mx_last) - { - mx_last->next = mx_curr; - } - else - { - mx_head = mx_curr; - } - mx_last = mx_curr; - - vptr = aptr; - mx_curr->priority = DNS__16BIT(vptr); - vptr += sizeof(unsigned short); - - status = ares_expand_name (vptr, abuf, alen, &mx_curr->host, &len); - if (status != ARES_SUCCESS) - break; - } - - /* Don't lose memory in the next iteration */ - ares_free (rr_name); - rr_name = NULL; - - /* Move on to the next record */ - aptr += rr_len; - } - - if (hostname) - ares_free (hostname); - if (rr_name) - ares_free (rr_name); - - /* clean up on error */ - if (status != ARES_SUCCESS) - { - if (mx_head) - ares_free_data (mx_head); - return status; - } - - /* everything looks fine, return the data */ - *mx_out = mx_head; - - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_naptr_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_naptr_reply.c deleted file mode 100644 index dd984c0fea8..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_naptr_reply.c +++ /dev/null @@ -1,183 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2009 by Jakub Hrozek - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_dns.h" -#include "ares_data.h" -#include "ares_private.h" - -int -ares_parse_naptr_reply (const unsigned char *abuf, int alen, - struct ares_naptr_reply **naptr_out) -{ - unsigned int qdcount, ancount, i; - const unsigned char *aptr, *vptr; - int status, rr_type, rr_class, rr_len; - long len; - char *hostname = NULL, *rr_name = NULL; - struct ares_naptr_reply *naptr_head = NULL; - struct ares_naptr_reply *naptr_last = NULL; - struct ares_naptr_reply *naptr_curr; - - /* Set *naptr_out to NULL for all failure cases. */ - *naptr_out = NULL; - - /* Give up if abuf doesn't have room for a header. */ - if (alen < HFIXEDSZ) - return ARES_EBADRESP; - - /* Fetch the question and answer count from the header. */ - qdcount = DNS_HEADER_QDCOUNT (abuf); - ancount = DNS_HEADER_ANCOUNT (abuf); - if (qdcount != 1) - return ARES_EBADRESP; - if (ancount == 0) - return ARES_ENODATA; - - /* Expand the name from the question, and skip past the question. */ - aptr = abuf + HFIXEDSZ; - status = ares_expand_name (aptr, abuf, alen, &hostname, &len); - if (status != ARES_SUCCESS) - return status; - - if (aptr + len + QFIXEDSZ > abuf + alen) - { - ares_free (hostname); - return ARES_EBADRESP; - } - aptr += len + QFIXEDSZ; - - /* Examine each answer resource record (RR) in turn. */ - for (i = 0; i < ancount; i++) - { - /* Decode the RR up to the data field. */ - status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); - if (status != ARES_SUCCESS) - { - break; - } - aptr += len; - if (aptr + RRFIXEDSZ > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - rr_type = DNS_RR_TYPE (aptr); - rr_class = DNS_RR_CLASS (aptr); - rr_len = DNS_RR_LEN (aptr); - aptr += RRFIXEDSZ; - if (aptr + rr_len > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - - /* Check if we are really looking at a NAPTR record */ - if (rr_class == C_IN && rr_type == T_NAPTR) - { - /* parse the NAPTR record itself */ - - /* RR must contain at least 7 bytes = 2 x int16 + 3 x name */ - if (rr_len < 7) - { - status = ARES_EBADRESP; - break; - } - - /* Allocate storage for this NAPTR answer appending it to the list */ - naptr_curr = ares_malloc_data(ARES_DATATYPE_NAPTR_REPLY); - if (!naptr_curr) - { - status = ARES_ENOMEM; - break; - } - if (naptr_last) - { - naptr_last->next = naptr_curr; - } - else - { - naptr_head = naptr_curr; - } - naptr_last = naptr_curr; - - vptr = aptr; - naptr_curr->order = DNS__16BIT(vptr); - vptr += sizeof(unsigned short); - naptr_curr->preference = DNS__16BIT(vptr); - vptr += sizeof(unsigned short); - - status = ares_expand_string(vptr, abuf, alen, &naptr_curr->flags, &len); - if (status != ARES_SUCCESS) - break; - vptr += len; - - status = ares_expand_string(vptr, abuf, alen, &naptr_curr->service, &len); - if (status != ARES_SUCCESS) - break; - vptr += len; - - status = ares_expand_string(vptr, abuf, alen, &naptr_curr->regexp, &len); - if (status != ARES_SUCCESS) - break; - vptr += len; - - status = ares_expand_name(vptr, abuf, alen, &naptr_curr->replacement, &len); - if (status != ARES_SUCCESS) - break; - } - - /* Don't lose memory in the next iteration */ - ares_free (rr_name); - rr_name = NULL; - - /* Move on to the next record */ - aptr += rr_len; - } - - if (hostname) - ares_free (hostname); - if (rr_name) - ares_free (rr_name); - - /* clean up on error */ - if (status != ARES_SUCCESS) - { - if (naptr_head) - ares_free_data (naptr_head); - return status; - } - - /* everything looks fine, return the data */ - *naptr_out = naptr_head; - - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_ns_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_ns_reply.c deleted file mode 100644 index 47d12994c96..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_ns_reply.c +++ /dev/null @@ -1,177 +0,0 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -/* - * ares_parse_ns_reply created by Vlad Dinulescu - * on behalf of AVIRA Gmbh - http://www.avira.com - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_dns.h" -#include "ares_private.h" - -int ares_parse_ns_reply( const unsigned char* abuf, int alen, - struct hostent** host ) -{ - unsigned int qdcount, ancount; - int status, i, rr_type, rr_class, rr_len; - int nameservers_num; - long len; - const unsigned char *aptr; - char* hostname, *rr_name, *rr_data, **nameservers; - struct hostent *hostent; - - /* Set *host to NULL for all failure cases. */ - *host = NULL; - - /* Give up if abuf doesn't have room for a header. */ - if ( alen < HFIXEDSZ ) - return ARES_EBADRESP; - - /* Fetch the question and answer count from the header. */ - qdcount = DNS_HEADER_QDCOUNT( abuf ); - ancount = DNS_HEADER_ANCOUNT( abuf ); - if ( qdcount != 1 ) - return ARES_EBADRESP; - - /* Expand the name from the question, and skip past the question. */ - aptr = abuf + HFIXEDSZ; - status = ares__expand_name_for_response( aptr, abuf, alen, &hostname, &len, 0); - if ( status != ARES_SUCCESS ) - return status; - if ( aptr + len + QFIXEDSZ > abuf + alen ) - { - ares_free( hostname ); - return ARES_EBADRESP; - } - aptr += len + QFIXEDSZ; - - /* Allocate nameservers array; ancount gives an upper bound */ - nameservers = ares_malloc( ( ancount + 1 ) * sizeof( char * ) ); - if ( !nameservers ) - { - ares_free( hostname ); - return ARES_ENOMEM; - } - nameservers_num = 0; - - /* Examine each answer resource record (RR) in turn. */ - for ( i = 0; i < ( int ) ancount; i++ ) - { - /* Decode the RR up to the data field. */ - status = ares__expand_name_for_response( aptr, abuf, alen, &rr_name, &len, 0); - if ( status != ARES_SUCCESS ) - break; - aptr += len; - if ( aptr + RRFIXEDSZ > abuf + alen ) - { - status = ARES_EBADRESP; - ares_free(rr_name); - break; - } - rr_type = DNS_RR_TYPE( aptr ); - rr_class = DNS_RR_CLASS( aptr ); - rr_len = DNS_RR_LEN( aptr ); - aptr += RRFIXEDSZ; - if (aptr + rr_len > abuf + alen) - { - ares_free(rr_name); - status = ARES_EBADRESP; - break; - } - - if ( rr_class == C_IN && rr_type == T_NS ) - { - /* Decode the RR data and add it to the nameservers list */ - status = ares__expand_name_for_response( aptr, abuf, alen, &rr_data, - &len, 1); - if ( status != ARES_SUCCESS ) - { - ares_free(rr_name); - break; - } - - nameservers[nameservers_num] = ares_malloc(strlen(rr_data)+1); - - if (nameservers[nameservers_num]==NULL) - { - ares_free(rr_name); - ares_free(rr_data); - status=ARES_ENOMEM; - break; - } - strcpy(nameservers[nameservers_num],rr_data); - ares_free(rr_data); - - nameservers_num++; - } - - ares_free( rr_name ); - - aptr += rr_len; - if ( aptr > abuf + alen ) - { /* LCOV_EXCL_START: already checked above */ - status = ARES_EBADRESP; - break; - } /* LCOV_EXCL_STOP */ - } - - if ( status == ARES_SUCCESS && nameservers_num == 0 ) - { - status = ARES_ENODATA; - } - if ( status == ARES_SUCCESS ) - { - /* We got our answer. Allocate memory to build the host entry. */ - nameservers[nameservers_num] = NULL; - hostent = ares_malloc( sizeof( struct hostent ) ); - if ( hostent ) - { - hostent->h_addr_list = ares_malloc( 1 * sizeof( char * ) ); - if ( hostent->h_addr_list ) - { - /* Fill in the hostent and return successfully. */ - hostent->h_name = hostname; - hostent->h_aliases = nameservers; - hostent->h_addrtype = AF_INET; - hostent->h_length = sizeof( struct in_addr ); - hostent->h_addr_list[0] = NULL; - *host = hostent; - return ARES_SUCCESS; - } - ares_free( hostent ); - } - status = ARES_ENOMEM; - } - for ( i = 0; i < nameservers_num; i++ ) - ares_free( nameservers[i] ); - ares_free( nameservers ); - ares_free( hostname ); - return status; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_ptr_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_ptr_reply.c deleted file mode 100644 index ae78edf1951..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_ptr_reply.c +++ /dev/null @@ -1,228 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#include "ares.h" -#include "ares_dns.h" -#include "ares_nowarn.h" -#include "ares_private.h" - -int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, - int addrlen, int family, struct hostent **host) -{ - unsigned int qdcount, ancount; - int status, i, rr_type, rr_class, rr_len; - long len; - const unsigned char *aptr; - char *ptrname, *hostname, *rr_name, *rr_data; - struct hostent *hostent = NULL; - int aliascnt = 0; - int alias_alloc = 8; - char ** aliases; - size_t rr_data_len; - - /* Set *host to NULL for all failure cases. */ - *host = NULL; - - /* Give up if abuf doesn't have room for a header. */ - if (alen < HFIXEDSZ) - return ARES_EBADRESP; - - /* Fetch the question and answer count from the header. */ - qdcount = DNS_HEADER_QDCOUNT(abuf); - ancount = DNS_HEADER_ANCOUNT(abuf); - if (qdcount != 1) - return ARES_EBADRESP; - - /* Expand the name from the question, and skip past the question. */ - aptr = abuf + HFIXEDSZ; - status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len, 0); - if (status != ARES_SUCCESS) - return status; - if (aptr + len + QFIXEDSZ > abuf + alen) - { - ares_free(ptrname); - return ARES_EBADRESP; - } - aptr += len + QFIXEDSZ; - - /* Examine each answer resource record (RR) in turn. */ - hostname = NULL; - aliases = ares_malloc(alias_alloc * sizeof(char *)); - if (!aliases) - { - ares_free(ptrname); - return ARES_ENOMEM; - } - for (i = 0; i < (int)ancount; i++) - { - /* Decode the RR up to the data field. */ - status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len, 0); - if (status != ARES_SUCCESS) - break; - aptr += len; - if (aptr + RRFIXEDSZ > abuf + alen) - { - ares_free(rr_name); - status = ARES_EBADRESP; - break; - } - rr_type = DNS_RR_TYPE(aptr); - rr_class = DNS_RR_CLASS(aptr); - rr_len = DNS_RR_LEN(aptr); - aptr += RRFIXEDSZ; - if (aptr + rr_len > abuf + alen) - { - ares_free(rr_name); - status = ARES_EBADRESP; - break; - } - - if (rr_class == C_IN && rr_type == T_PTR - && strcasecmp(rr_name, ptrname) == 0) - { - /* Decode the RR data and set hostname to it. */ - status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, - &len, 1); - if (status != ARES_SUCCESS) - { - ares_free(rr_name); - break; - } - if (hostname) - ares_free(hostname); - hostname = rr_data; - rr_data_len = strlen(rr_data)+1; - aliases[aliascnt] = ares_malloc(rr_data_len * sizeof(char)); - if (!aliases[aliascnt]) - { - ares_free(rr_name); - status = ARES_ENOMEM; - break; - } - strncpy(aliases[aliascnt], rr_data, rr_data_len); - aliascnt++; - if (aliascnt >= alias_alloc) { - char **ptr; - alias_alloc *= 2; - ptr = ares_realloc(aliases, alias_alloc * sizeof(char *)); - if(!ptr) { - ares_free(rr_name); - status = ARES_ENOMEM; - break; - } - aliases = ptr; - } - } - - if (rr_class == C_IN && rr_type == T_CNAME) - { - /* Decode the RR data and replace ptrname with it. */ - status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, - &len, 1); - if (status != ARES_SUCCESS) - { - ares_free(rr_name); - break; - } - ares_free(ptrname); - ptrname = rr_data; - } - - ares_free(rr_name); - aptr += rr_len; - if (aptr > abuf + alen) - { /* LCOV_EXCL_START: already checked above */ - status = ARES_EBADRESP; - break; - } /* LCOV_EXCL_STOP */ - } - - if (status == ARES_SUCCESS && !hostname) - status = ARES_ENODATA; - if (status == ARES_SUCCESS) - { - /* If we don't reach the end, we must have failed due to out of memory */ - status = ARES_ENOMEM; - - /* We got our answer. Allocate memory to build the host entry. */ - hostent = ares_malloc(sizeof(*hostent)); - if (!hostent) - goto fail; - - /* If we don't memset here, cleanups may fail */ - memset(hostent, 0, sizeof(*hostent)); - - hostent->h_addr_list = ares_malloc(2 * sizeof(char *)); - if (!hostent->h_addr_list) - goto fail; - - - if (addr && addrlen) { - hostent->h_addr_list[0] = ares_malloc(addrlen); - if (!hostent->h_addr_list[0]) - goto fail; - } else { - hostent->h_addr_list[0] = NULL; - } - - hostent->h_aliases = ares_malloc((aliascnt+1) * sizeof (char *)); - if (!hostent->h_aliases) - goto fail; - - /* Fill in the hostent and return successfully. */ - hostent->h_name = hostname; - for (i=0 ; ih_aliases[i] = aliases[i]; - hostent->h_aliases[aliascnt] = NULL; - hostent->h_addrtype = aresx_sitoss(family); - hostent->h_length = aresx_sitoss(addrlen); - if (addr && addrlen) - memcpy(hostent->h_addr_list[0], addr, addrlen); - hostent->h_addr_list[1] = NULL; - *host = hostent; - ares_free(aliases); - ares_free(ptrname); - - return ARES_SUCCESS; - } - -fail: - ares_free_hostent(hostent); - - for (i=0 ; i - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_dns.h" -#include "ares_data.h" -#include "ares_private.h" - -int -ares_parse_soa_reply(const unsigned char *abuf, int alen, - struct ares_soa_reply **soa_out) -{ - const unsigned char *aptr; - long len; - char *qname = NULL, *rr_name = NULL; - struct ares_soa_reply *soa = NULL; - int qdcount, ancount, qclass; - int status, i, rr_type, rr_class, rr_len; - - if (alen < HFIXEDSZ) - return ARES_EBADRESP; - - /* parse message header */ - qdcount = DNS_HEADER_QDCOUNT(abuf); - ancount = DNS_HEADER_ANCOUNT(abuf); - - if (qdcount != 1) - return ARES_EBADRESP; - if (ancount == 0) - return ARES_EBADRESP; - - aptr = abuf + HFIXEDSZ; - - /* query name */ - status = ares__expand_name_for_response(aptr, abuf, alen, &qname, &len, 0); - if (status != ARES_SUCCESS) - goto failed_stat; - - if (alen <= len + HFIXEDSZ + 1) - goto failed; - aptr += len; - - qclass = DNS_QUESTION_TYPE(aptr); - - /* skip qtype & qclass */ - if (aptr + QFIXEDSZ > abuf + alen) - goto failed; - aptr += QFIXEDSZ; - - /* qclass of SOA with multiple answers */ - if (qclass == T_SOA && ancount > 1) - goto failed; - - /* examine all the records, break and return if found soa */ - for (i = 0; i < ancount; i++) - { - rr_name = NULL; - status = ares__expand_name_for_response (aptr, abuf, alen, &rr_name, &len, 0); - if (status != ARES_SUCCESS) - { - ares_free(rr_name); - goto failed_stat; - } - - aptr += len; - if ( aptr + RRFIXEDSZ > abuf + alen ) - { - ares_free(rr_name); - status = ARES_EBADRESP; - goto failed_stat; - } - rr_type = DNS_RR_TYPE( aptr ); - rr_class = DNS_RR_CLASS( aptr ); - rr_len = DNS_RR_LEN( aptr ); - aptr += RRFIXEDSZ; - if (aptr + rr_len > abuf + alen) - { - ares_free(rr_name); - status = ARES_EBADRESP; - goto failed_stat; - } - if ( rr_class == C_IN && rr_type == T_SOA ) - { - /* allocate result struct */ - soa = ares_malloc_data(ARES_DATATYPE_SOA_REPLY); - if (!soa) - { - ares_free(rr_name); - status = ARES_ENOMEM; - goto failed_stat; - } - - /* nsname */ - status = ares__expand_name_for_response(aptr, abuf, alen, &soa->nsname, - &len, 0); - if (status != ARES_SUCCESS) - { - ares_free(rr_name); - goto failed_stat; - } - aptr += len; - - /* hostmaster */ - status = ares__expand_name_for_response(aptr, abuf, alen, - &soa->hostmaster, &len, 0); - if (status != ARES_SUCCESS) - { - ares_free(rr_name); - goto failed_stat; - } - aptr += len; - - /* integer fields */ - if (aptr + 5 * 4 > abuf + alen) - { - ares_free(rr_name); - goto failed; - } - soa->serial = DNS__32BIT(aptr + 0 * 4); - soa->refresh = DNS__32BIT(aptr + 1 * 4); - soa->retry = DNS__32BIT(aptr + 2 * 4); - soa->expire = DNS__32BIT(aptr + 3 * 4); - soa->minttl = DNS__32BIT(aptr + 4 * 4); - - ares_free(qname); - ares_free(rr_name); - - *soa_out = soa; - - return ARES_SUCCESS; - } - aptr += rr_len; - - ares_free(rr_name); - - if (aptr > abuf + alen) - goto failed_stat; - } - /* no SOA record found */ - status = ARES_EBADRESP; - goto failed_stat; -failed: - status = ARES_EBADRESP; - -failed_stat: - if (soa) - ares_free_data(soa); - if (qname) - ares_free(qname); - return status; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_srv_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_srv_reply.c deleted file mode 100644 index 0d8f4d2098b..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_srv_reply.c +++ /dev/null @@ -1,168 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2009 by Jakub Hrozek - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_dns.h" -#include "ares_data.h" -#include "ares_private.h" - -int -ares_parse_srv_reply (const unsigned char *abuf, int alen, - struct ares_srv_reply **srv_out) -{ - unsigned int qdcount, ancount, i; - const unsigned char *aptr, *vptr; - int status, rr_type, rr_class, rr_len; - long len; - char *hostname = NULL, *rr_name = NULL; - struct ares_srv_reply *srv_head = NULL; - struct ares_srv_reply *srv_last = NULL; - struct ares_srv_reply *srv_curr; - - /* Set *srv_out to NULL for all failure cases. */ - *srv_out = NULL; - - /* Give up if abuf doesn't have room for a header. */ - if (alen < HFIXEDSZ) - return ARES_EBADRESP; - - /* Fetch the question and answer count from the header. */ - qdcount = DNS_HEADER_QDCOUNT (abuf); - ancount = DNS_HEADER_ANCOUNT (abuf); - if (qdcount != 1) - return ARES_EBADRESP; - if (ancount == 0) - return ARES_ENODATA; - - /* Expand the name from the question, and skip past the question. */ - aptr = abuf + HFIXEDSZ; - status = ares_expand_name (aptr, abuf, alen, &hostname, &len); - if (status != ARES_SUCCESS) - return status; - - if (aptr + len + QFIXEDSZ > abuf + alen) - { - ares_free (hostname); - return ARES_EBADRESP; - } - aptr += len + QFIXEDSZ; - - /* Examine each answer resource record (RR) in turn. */ - for (i = 0; i < ancount; i++) - { - /* Decode the RR up to the data field. */ - status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); - if (status != ARES_SUCCESS) - { - break; - } - aptr += len; - if (aptr + RRFIXEDSZ > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - rr_type = DNS_RR_TYPE (aptr); - rr_class = DNS_RR_CLASS (aptr); - rr_len = DNS_RR_LEN (aptr); - aptr += RRFIXEDSZ; - if (aptr + rr_len > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - - /* Check if we are really looking at a SRV record */ - if (rr_class == C_IN && rr_type == T_SRV) - { - /* parse the SRV record itself */ - if (rr_len < 6) - { - status = ARES_EBADRESP; - break; - } - - /* Allocate storage for this SRV answer appending it to the list */ - srv_curr = ares_malloc_data(ARES_DATATYPE_SRV_REPLY); - if (!srv_curr) - { - status = ARES_ENOMEM; - break; - } - if (srv_last) - { - srv_last->next = srv_curr; - } - else - { - srv_head = srv_curr; - } - srv_last = srv_curr; - - vptr = aptr; - srv_curr->priority = DNS__16BIT(vptr); - vptr += sizeof(unsigned short); - srv_curr->weight = DNS__16BIT(vptr); - vptr += sizeof(unsigned short); - srv_curr->port = DNS__16BIT(vptr); - vptr += sizeof(unsigned short); - - status = ares_expand_name (vptr, abuf, alen, &srv_curr->host, &len); - if (status != ARES_SUCCESS) - break; - } - - /* Don't lose memory in the next iteration */ - ares_free (rr_name); - rr_name = NULL; - - /* Move on to the next record */ - aptr += rr_len; - } - - if (hostname) - ares_free (hostname); - if (rr_name) - ares_free (rr_name); - - /* clean up on error */ - if (status != ARES_SUCCESS) - { - if (srv_head) - ares_free_data (srv_head); - return status; - } - - /* everything looks fine, return the data */ - *srv_out = srv_head; - - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_txt_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_txt_reply.c deleted file mode 100644 index 6848a092bbc..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_txt_reply.c +++ /dev/null @@ -1,214 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2009 by Jakub Hrozek - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#include "ares.h" -#include "ares_dns.h" -#include "ares_data.h" -#include "ares_private.h" - -static int -ares__parse_txt_reply (const unsigned char *abuf, int alen, - int ex, void **txt_out) -{ - size_t substr_len; - unsigned int qdcount, ancount, i; - const unsigned char *aptr; - const unsigned char *strptr; - int status, rr_type, rr_class, rr_len; - long len; - char *hostname = NULL, *rr_name = NULL; - struct ares_txt_ext *txt_head = NULL; - struct ares_txt_ext *txt_last = NULL; - struct ares_txt_ext *txt_curr; - - /* Set *txt_out to NULL for all failure cases. */ - *txt_out = NULL; - - /* Give up if abuf doesn't have room for a header. */ - if (alen < HFIXEDSZ) - return ARES_EBADRESP; - - /* Fetch the question and answer count from the header. */ - qdcount = DNS_HEADER_QDCOUNT (abuf); - ancount = DNS_HEADER_ANCOUNT (abuf); - if (qdcount != 1) - return ARES_EBADRESP; - if (ancount == 0) - return ARES_ENODATA; - - /* Expand the name from the question, and skip past the question. */ - aptr = abuf + HFIXEDSZ; - status = ares_expand_name (aptr, abuf, alen, &hostname, &len); - if (status != ARES_SUCCESS) - return status; - - if (aptr + len + QFIXEDSZ > abuf + alen) - { - ares_free (hostname); - return ARES_EBADRESP; - } - aptr += len + QFIXEDSZ; - - /* Examine each answer resource record (RR) in turn. */ - for (i = 0; i < ancount; i++) - { - /* Decode the RR up to the data field. */ - status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); - if (status != ARES_SUCCESS) - { - break; - } - aptr += len; - if (aptr + RRFIXEDSZ > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - rr_type = DNS_RR_TYPE (aptr); - rr_class = DNS_RR_CLASS (aptr); - rr_len = DNS_RR_LEN (aptr); - aptr += RRFIXEDSZ; - if (aptr + rr_len > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - - /* Check if we are really looking at a TXT record */ - if ((rr_class == C_IN || rr_class == C_CHAOS) && rr_type == T_TXT) - { - /* - * There may be multiple substrings in a single TXT record. Each - * substring may be up to 255 characters in length, with a - * "length byte" indicating the size of the substring payload. - * RDATA contains both the length-bytes and payloads of all - * substrings contained therein. - */ - - strptr = aptr; - while (strptr < (aptr + rr_len)) - { - substr_len = (unsigned char)*strptr; - if (strptr + substr_len + 1 > aptr + rr_len) - { - status = ARES_EBADRESP; - break; - } - - /* Allocate storage for this TXT answer appending it to the list */ - txt_curr = ares_malloc_data(ex ? ARES_DATATYPE_TXT_EXT : - ARES_DATATYPE_TXT_REPLY); - if (!txt_curr) - { - status = ARES_ENOMEM; - break; - } - if (txt_last) - { - txt_last->next = txt_curr; - } - else - { - txt_head = txt_curr; - } - txt_last = txt_curr; - - if (ex) - txt_curr->record_start = (strptr == aptr); - txt_curr->length = substr_len; - txt_curr->txt = ares_malloc (substr_len + 1/* Including null byte */); - if (txt_curr->txt == NULL) - { - status = ARES_ENOMEM; - break; - } - - ++strptr; - memcpy ((char *) txt_curr->txt, strptr, substr_len); - - /* Make sure we NULL-terminate */ - txt_curr->txt[substr_len] = 0; - - strptr += substr_len; - } - } - - /* Propagate any failures */ - if (status != ARES_SUCCESS) - { - break; - } - - /* Don't lose memory in the next iteration */ - ares_free (rr_name); - rr_name = NULL; - - /* Move on to the next record */ - aptr += rr_len; - } - - if (hostname) - ares_free (hostname); - if (rr_name) - ares_free (rr_name); - - /* clean up on error */ - if (status != ARES_SUCCESS) - { - if (txt_head) - ares_free_data (txt_head); - return status; - } - - /* everything looks fine, return the data */ - *txt_out = txt_head; - - return ARES_SUCCESS; -} - -int -ares_parse_txt_reply (const unsigned char *abuf, int alen, - struct ares_txt_reply **txt_out) -{ - return ares__parse_txt_reply(abuf, alen, 0, (void **) txt_out); -} - - -int -ares_parse_txt_reply_ext (const unsigned char *abuf, int alen, - struct ares_txt_ext **txt_out) -{ - return ares__parse_txt_reply(abuf, alen, 1, (void **) txt_out); -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_parse_uri_reply.c b/lib/c-ares-1.19.1/src/lib/ares_parse_uri_reply.c deleted file mode 100644 index d79b5c4d85c..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_parse_uri_reply.c +++ /dev/null @@ -1,184 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2009 by Jakub Hrozek - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_dns.h" -#include "ares_data.h" -#include "ares_private.h" - -/* AIX portability check */ -#ifndef T_URI -# define T_URI 256 /* uri selection */ -#endif - -int -ares_parse_uri_reply (const unsigned char *abuf, int alen, - struct ares_uri_reply **uri_out) -{ - unsigned int qdcount, ancount, i; - const unsigned char *aptr, *vptr; - int status, rr_type, rr_class, rr_len, rr_ttl; - long len; - char *uri_str = NULL, *rr_name = NULL; - struct ares_uri_reply *uri_head = NULL; - struct ares_uri_reply *uri_last = NULL; - struct ares_uri_reply *uri_curr; - - /* Set *uri_out to NULL for all failure cases. */ - *uri_out = NULL; - - /* Give up if abuf doesn't have room for a header. */ - if (alen < HFIXEDSZ){ - return ARES_EBADRESP; - } - - /* Fetch the question and answer count from the header. */ - qdcount = DNS_HEADER_QDCOUNT (abuf); - ancount = DNS_HEADER_ANCOUNT (abuf); - if (qdcount != 1) { - return ARES_EBADRESP; - } - if (ancount == 0) { - return ARES_ENODATA; - } - /* Expand the name from the question, and skip past the question. */ - aptr = abuf + HFIXEDSZ; - - status = ares_expand_name (aptr, abuf, alen, &uri_str, &len); - if (status != ARES_SUCCESS){ - return status; - } - if (aptr + len + QFIXEDSZ > abuf + alen) - { - ares_free (uri_str); - return ARES_EBADRESP; - } - aptr += len + QFIXEDSZ; - - /* Examine each answer resource record (RR) in turn. */ - for (i = 0; i < ancount; i++) - { - /* Decode the RR up to the data field. */ - status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); - if (status != ARES_SUCCESS) - { - break; - } - aptr += len; - if (aptr + RRFIXEDSZ > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - - rr_type = DNS_RR_TYPE (aptr); - rr_class = DNS_RR_CLASS (aptr); - rr_ttl = DNS_RR_TTL(aptr); - rr_len = DNS_RR_LEN (aptr); - aptr += RRFIXEDSZ; - - if (aptr + rr_len > abuf + alen) - { - status = ARES_EBADRESP; - break; - } - - /* Check if we are really looking at a URI record */ - if (rr_class == C_IN && rr_type == T_URI) - { - /* parse the URI record itself */ - if (rr_len < 5) - { - status = ARES_EBADRESP; - break; - } - /* Allocate storage for this URI answer appending it to the list */ - uri_curr = ares_malloc_data(ARES_DATATYPE_URI_REPLY); - if (!uri_curr) - { - status = ARES_ENOMEM; - break; - } - if (uri_last) - { - uri_last->next = uri_curr; - } - else - { - uri_head = uri_curr; - } - uri_last = uri_curr; - - vptr = aptr; - uri_curr->priority = DNS__16BIT(vptr); - vptr += sizeof(unsigned short); - uri_curr->weight = DNS__16BIT(vptr); - vptr += sizeof(unsigned short); - uri_curr->uri = (char *)ares_malloc(rr_len-3); - if (!uri_curr->uri) - { - status = ARES_ENOMEM; - break; - } - uri_curr->uri = strncpy(uri_curr->uri, (const char *)vptr, rr_len-4); - uri_curr->uri[rr_len-4]='\0'; - uri_curr->ttl = rr_ttl; - - if (status != ARES_SUCCESS) - break; - } - - /* Don't lose memory in the next iteration */ - ares_free (rr_name); - rr_name = NULL; - - /* Move on to the next record */ - aptr += rr_len; - } - - if (uri_str) - ares_free (uri_str); - if (rr_name) - ares_free (rr_name); - - /* clean up on error */ - if (status != ARES_SUCCESS) - { - if (uri_head) - ares_free_data (uri_head); - return status; - } - - /* everything looks fine, return the data */ - *uri_out = uri_head; - - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_platform.c b/lib/c-ares-1.19.1/src/lib/ares_platform.c deleted file mode 100644 index 6c749dccb24..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_platform.c +++ /dev/null @@ -1,11042 +0,0 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004 - 2011 by Daniel Stenberg et al - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include "ares.h" -#include "ares_platform.h" -#include "ares_nowarn.h" -#include "ares_private.h" - -#if defined(WIN32) && !defined(MSDOS) - -#define V_PLATFORM_WIN32s 0 -#define V_PLATFORM_WIN32_WINDOWS 1 -#define V_PLATFORM_WIN32_NT 2 -#define V_PLATFORM_WIN32_CE 3 - -win_platform ares__getplatform(void) -{ - OSVERSIONINFOEX OsvEx; - - memset(&OsvEx, 0, sizeof(OsvEx)); - OsvEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4996) /* warning C4996: 'GetVersionExW': was declared deprecated */ -#endif - if (!GetVersionEx((void *)&OsvEx)) - { - memset(&OsvEx, 0, sizeof(OsvEx)); - OsvEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx((void *)&OsvEx)) - return WIN_UNKNOWN; - } -#ifdef _MSC_VER -#pragma warning(pop) -#endif - - switch(OsvEx.dwPlatformId) - { - case V_PLATFORM_WIN32s: - return WIN_3X; - - case V_PLATFORM_WIN32_WINDOWS: - return WIN_9X; - - case V_PLATFORM_WIN32_NT: - return WIN_NT; - - case V_PLATFORM_WIN32_CE: - return WIN_CE; - - default: - return WIN_UNKNOWN; - } -} - -#endif /* WIN32 && ! MSDOS */ - -#if defined(_WIN32_WCE) - -/* IANA Well Known Ports are in range 0-1023 */ -#define USE_IANA_WELL_KNOWN_PORTS 1 - -/* IANA Registered Ports are in range 1024-49151 */ -#define USE_IANA_REGISTERED_PORTS 1 - -struct pvt_servent { - char *s_name; - char **s_aliases; - unsigned short s_port; - char *s_proto; -}; - -/* - * Ref: http://www.iana.org/assignments/port-numbers - */ - -static struct pvt_servent IANAports[] = { -#ifdef USE_IANA_WELL_KNOWN_PORTS -{"tcpmux", {NULL}, 1, "tcp"}, -{"tcpmux", {NULL}, 1, "udp"}, -{"compressnet", {NULL}, 2, "tcp"}, -{"compressnet", {NULL}, 2, "udp"}, -{"compressnet", {NULL}, 3, "tcp"}, -{"compressnet", {NULL}, 3, "udp"}, -{"rje", {NULL}, 5, "tcp"}, -{"rje", {NULL}, 5, "udp"}, -{"echo", {NULL}, 7, "tcp"}, -{"echo", {NULL}, 7, "udp"}, -{"discard", {NULL}, 9, "tcp"}, -{"discard", {NULL}, 9, "udp"}, -{"discard", {NULL}, 9, "sctp"}, -{"discard", {NULL}, 9, "dccp"}, -{"systat", {NULL}, 11, "tcp"}, -{"systat", {NULL}, 11, "udp"}, -{"daytime", {NULL}, 13, "tcp"}, -{"daytime", {NULL}, 13, "udp"}, -{"qotd", {NULL}, 17, "tcp"}, -{"qotd", {NULL}, 17, "udp"}, -{"msp", {NULL}, 18, "tcp"}, -{"msp", {NULL}, 18, "udp"}, -{"chargen", {NULL}, 19, "tcp"}, -{"chargen", {NULL}, 19, "udp"}, -{"ftp-data", {NULL}, 20, "tcp"}, -{"ftp-data", {NULL}, 20, "udp"}, -{"ftp-data", {NULL}, 20, "sctp"}, -{"ftp", {NULL}, 21, "tcp"}, -{"ftp", {NULL}, 21, "udp"}, -{"ftp", {NULL}, 21, "sctp"}, -{"ssh", {NULL}, 22, "tcp"}, -{"ssh", {NULL}, 22, "udp"}, -{"ssh", {NULL}, 22, "sctp"}, -{"telnet", {NULL}, 23, "tcp"}, -{"telnet", {NULL}, 23, "udp"}, -{"smtp", {NULL}, 25, "tcp"}, -{"smtp", {NULL}, 25, "udp"}, -{"nsw-fe", {NULL}, 27, "tcp"}, -{"nsw-fe", {NULL}, 27, "udp"}, -{"msg-icp", {NULL}, 29, "tcp"}, -{"msg-icp", {NULL}, 29, "udp"}, -{"msg-auth", {NULL}, 31, "tcp"}, -{"msg-auth", {NULL}, 31, "udp"}, -{"dsp", {NULL}, 33, "tcp"}, -{"dsp", {NULL}, 33, "udp"}, -{"time", {NULL}, 37, "tcp"}, -{"time", {NULL}, 37, "udp"}, -{"rap", {NULL}, 38, "tcp"}, -{"rap", {NULL}, 38, "udp"}, -{"rlp", {NULL}, 39, "tcp"}, -{"rlp", {NULL}, 39, "udp"}, -{"graphics", {NULL}, 41, "tcp"}, -{"graphics", {NULL}, 41, "udp"}, -{"name", {NULL}, 42, "tcp"}, -{"name", {NULL}, 42, "udp"}, -{"nameserver", {NULL}, 42, "tcp"}, -{"nameserver", {NULL}, 42, "udp"}, -{"nicname", {NULL}, 43, "tcp"}, -{"nicname", {NULL}, 43, "udp"}, -{"mpm-flags", {NULL}, 44, "tcp"}, -{"mpm-flags", {NULL}, 44, "udp"}, -{"mpm", {NULL}, 45, "tcp"}, -{"mpm", {NULL}, 45, "udp"}, -{"mpm-snd", {NULL}, 46, "tcp"}, -{"mpm-snd", {NULL}, 46, "udp"}, -{"ni-ftp", {NULL}, 47, "tcp"}, -{"ni-ftp", {NULL}, 47, "udp"}, -{"auditd", {NULL}, 48, "tcp"}, -{"auditd", {NULL}, 48, "udp"}, -{"tacacs", {NULL}, 49, "tcp"}, -{"tacacs", {NULL}, 49, "udp"}, -{"re-mail-ck", {NULL}, 50, "tcp"}, -{"re-mail-ck", {NULL}, 50, "udp"}, -{"la-maint", {NULL}, 51, "tcp"}, -{"la-maint", {NULL}, 51, "udp"}, -{"xns-time", {NULL}, 52, "tcp"}, -{"xns-time", {NULL}, 52, "udp"}, -{"domain", {NULL}, 53, "tcp"}, -{"domain", {NULL}, 53, "udp"}, -{"xns-ch", {NULL}, 54, "tcp"}, -{"xns-ch", {NULL}, 54, "udp"}, -{"isi-gl", {NULL}, 55, "tcp"}, -{"isi-gl", {NULL}, 55, "udp"}, -{"xns-auth", {NULL}, 56, "tcp"}, -{"xns-auth", {NULL}, 56, "udp"}, -{"xns-mail", {NULL}, 58, "tcp"}, -{"xns-mail", {NULL}, 58, "udp"}, -{"ni-mail", {NULL}, 61, "tcp"}, -{"ni-mail", {NULL}, 61, "udp"}, -{"acas", {NULL}, 62, "tcp"}, -{"acas", {NULL}, 62, "udp"}, -{"whois++", {NULL}, 63, "tcp"}, -{"whois++", {NULL}, 63, "udp"}, -{"covia", {NULL}, 64, "tcp"}, -{"covia", {NULL}, 64, "udp"}, -{"tacacs-ds", {NULL}, 65, "tcp"}, -{"tacacs-ds", {NULL}, 65, "udp"}, -{"sql*net", {NULL}, 66, "tcp"}, -{"sql*net", {NULL}, 66, "udp"}, -{"bootps", {NULL}, 67, "tcp"}, -{"bootps", {NULL}, 67, "udp"}, -{"bootpc", {NULL}, 68, "tcp"}, -{"bootpc", {NULL}, 68, "udp"}, -{"tftp", {NULL}, 69, "tcp"}, -{"tftp", {NULL}, 69, "udp"}, -{"gopher", {NULL}, 70, "tcp"}, -{"gopher", {NULL}, 70, "udp"}, -{"netrjs-1", {NULL}, 71, "tcp"}, -{"netrjs-1", {NULL}, 71, "udp"}, -{"netrjs-2", {NULL}, 72, "tcp"}, -{"netrjs-2", {NULL}, 72, "udp"}, -{"netrjs-3", {NULL}, 73, "tcp"}, -{"netrjs-3", {NULL}, 73, "udp"}, -{"netrjs-4", {NULL}, 74, "tcp"}, -{"netrjs-4", {NULL}, 74, "udp"}, -{"deos", {NULL}, 76, "tcp"}, -{"deos", {NULL}, 76, "udp"}, -{"vettcp", {NULL}, 78, "tcp"}, -{"vettcp", {NULL}, 78, "udp"}, -{"finger", {NULL}, 79, "tcp"}, -{"finger", {NULL}, 79, "udp"}, -{"http", {NULL}, 80, "tcp"}, -{"http", {NULL}, 80, "udp"}, -{"www", {NULL}, 80, "tcp"}, -{"www", {NULL}, 80, "udp"}, -{"www-http", {NULL}, 80, "tcp"}, -{"www-http", {NULL}, 80, "udp"}, -{"http", {NULL}, 80, "sctp"}, -{"xfer", {NULL}, 82, "tcp"}, -{"xfer", {NULL}, 82, "udp"}, -{"mit-ml-dev", {NULL}, 83, "tcp"}, -{"mit-ml-dev", {NULL}, 83, "udp"}, -{"ctf", {NULL}, 84, "tcp"}, -{"ctf", {NULL}, 84, "udp"}, -{"mit-ml-dev", {NULL}, 85, "tcp"}, -{"mit-ml-dev", {NULL}, 85, "udp"}, -{"mfcobol", {NULL}, 86, "tcp"}, -{"mfcobol", {NULL}, 86, "udp"}, -{"kerberos", {NULL}, 88, "tcp"}, -{"kerberos", {NULL}, 88, "udp"}, -{"su-mit-tg", {NULL}, 89, "tcp"}, -{"su-mit-tg", {NULL}, 89, "udp"}, -{"dnsix", {NULL}, 90, "tcp"}, -{"dnsix", {NULL}, 90, "udp"}, -{"mit-dov", {NULL}, 91, "tcp"}, -{"mit-dov", {NULL}, 91, "udp"}, -{"npp", {NULL}, 92, "tcp"}, -{"npp", {NULL}, 92, "udp"}, -{"dcp", {NULL}, 93, "tcp"}, -{"dcp", {NULL}, 93, "udp"}, -{"objcall", {NULL}, 94, "tcp"}, -{"objcall", {NULL}, 94, "udp"}, -{"supdup", {NULL}, 95, "tcp"}, -{"supdup", {NULL}, 95, "udp"}, -{"dixie", {NULL}, 96, "tcp"}, -{"dixie", {NULL}, 96, "udp"}, -{"swift-rvf", {NULL}, 97, "tcp"}, -{"swift-rvf", {NULL}, 97, "udp"}, -{"tacnews", {NULL}, 98, "tcp"}, -{"tacnews", {NULL}, 98, "udp"}, -{"metagram", {NULL}, 99, "tcp"}, -{"metagram", {NULL}, 99, "udp"}, -{"newacct", {NULL}, 100, "tcp"}, -{"hostname", {NULL}, 101, "tcp"}, -{"hostname", {NULL}, 101, "udp"}, -{"iso-tsap", {NULL}, 102, "tcp"}, -{"iso-tsap", {NULL}, 102, "udp"}, -{"gppitnp", {NULL}, 103, "tcp"}, -{"gppitnp", {NULL}, 103, "udp"}, -{"acr-nema", {NULL}, 104, "tcp"}, -{"acr-nema", {NULL}, 104, "udp"}, -{"cso", {NULL}, 105, "tcp"}, -{"cso", {NULL}, 105, "udp"}, -{"csnet-ns", {NULL}, 105, "tcp"}, -{"csnet-ns", {NULL}, 105, "udp"}, -{"3com-tsmux", {NULL}, 106, "tcp"}, -{"3com-tsmux", {NULL}, 106, "udp"}, -{"rtelnet", {NULL}, 107, "tcp"}, -{"rtelnet", {NULL}, 107, "udp"}, -{"snagas", {NULL}, 108, "tcp"}, -{"snagas", {NULL}, 108, "udp"}, -{"pop2", {NULL}, 109, "tcp"}, -{"pop2", {NULL}, 109, "udp"}, -{"pop3", {NULL}, 110, "tcp"}, -{"pop3", {NULL}, 110, "udp"}, -{"sunrpc", {NULL}, 111, "tcp"}, -{"sunrpc", {NULL}, 111, "udp"}, -{"mcidas", {NULL}, 112, "tcp"}, -{"mcidas", {NULL}, 112, "udp"}, -{"ident", {NULL}, 113, "tcp"}, -{"auth", {NULL}, 113, "tcp"}, -{"auth", {NULL}, 113, "udp"}, -{"sftp", {NULL}, 115, "tcp"}, -{"sftp", {NULL}, 115, "udp"}, -{"ansanotify", {NULL}, 116, "tcp"}, -{"ansanotify", {NULL}, 116, "udp"}, -{"uucp-path", {NULL}, 117, "tcp"}, -{"uucp-path", {NULL}, 117, "udp"}, -{"sqlserv", {NULL}, 118, "tcp"}, -{"sqlserv", {NULL}, 118, "udp"}, -{"nntp", {NULL}, 119, "tcp"}, -{"nntp", {NULL}, 119, "udp"}, -{"cfdptkt", {NULL}, 120, "tcp"}, -{"cfdptkt", {NULL}, 120, "udp"}, -{"erpc", {NULL}, 121, "tcp"}, -{"erpc", {NULL}, 121, "udp"}, -{"smakynet", {NULL}, 122, "tcp"}, -{"smakynet", {NULL}, 122, "udp"}, -{"ntp", {NULL}, 123, "tcp"}, -{"ntp", {NULL}, 123, "udp"}, -{"ansatrader", {NULL}, 124, "tcp"}, -{"ansatrader", {NULL}, 124, "udp"}, -{"locus-map", {NULL}, 125, "tcp"}, -{"locus-map", {NULL}, 125, "udp"}, -{"nxedit", {NULL}, 126, "tcp"}, -{"nxedit", {NULL}, 126, "udp"}, -{"locus-con", {NULL}, 127, "tcp"}, -{"locus-con", {NULL}, 127, "udp"}, -{"gss-xlicen", {NULL}, 128, "tcp"}, -{"gss-xlicen", {NULL}, 128, "udp"}, -{"pwdgen", {NULL}, 129, "tcp"}, -{"pwdgen", {NULL}, 129, "udp"}, -{"cisco-fna", {NULL}, 130, "tcp"}, -{"cisco-fna", {NULL}, 130, "udp"}, -{"cisco-tna", {NULL}, 131, "tcp"}, -{"cisco-tna", {NULL}, 131, "udp"}, -{"cisco-sys", {NULL}, 132, "tcp"}, -{"cisco-sys", {NULL}, 132, "udp"}, -{"statsrv", {NULL}, 133, "tcp"}, -{"statsrv", {NULL}, 133, "udp"}, -{"ingres-net", {NULL}, 134, "tcp"}, -{"ingres-net", {NULL}, 134, "udp"}, -{"epmap", {NULL}, 135, "tcp"}, -{"epmap", {NULL}, 135, "udp"}, -{"profile", {NULL}, 136, "tcp"}, -{"profile", {NULL}, 136, "udp"}, -{"netbios-ns", {NULL}, 137, "tcp"}, -{"netbios-ns", {NULL}, 137, "udp"}, -{"netbios-dgm", {NULL}, 138, "tcp"}, -{"netbios-dgm", {NULL}, 138, "udp"}, -{"netbios-ssn", {NULL}, 139, "tcp"}, -{"netbios-ssn", {NULL}, 139, "udp"}, -{"emfis-data", {NULL}, 140, "tcp"}, -{"emfis-data", {NULL}, 140, "udp"}, -{"emfis-cntl", {NULL}, 141, "tcp"}, -{"emfis-cntl", {NULL}, 141, "udp"}, -{"bl-idm", {NULL}, 142, "tcp"}, -{"bl-idm", {NULL}, 142, "udp"}, -{"imap", {NULL}, 143, "tcp"}, -{"imap", {NULL}, 143, "udp"}, -{"uma", {NULL}, 144, "tcp"}, -{"uma", {NULL}, 144, "udp"}, -{"uaac", {NULL}, 145, "tcp"}, -{"uaac", {NULL}, 145, "udp"}, -{"iso-tp0", {NULL}, 146, "tcp"}, -{"iso-tp0", {NULL}, 146, "udp"}, -{"iso-ip", {NULL}, 147, "tcp"}, -{"iso-ip", {NULL}, 147, "udp"}, -{"jargon", {NULL}, 148, "tcp"}, -{"jargon", {NULL}, 148, "udp"}, -{"aed-512", {NULL}, 149, "tcp"}, -{"aed-512", {NULL}, 149, "udp"}, -{"sql-net", {NULL}, 150, "tcp"}, -{"sql-net", {NULL}, 150, "udp"}, -{"hems", {NULL}, 151, "tcp"}, -{"hems", {NULL}, 151, "udp"}, -{"bftp", {NULL}, 152, "tcp"}, -{"bftp", {NULL}, 152, "udp"}, -{"sgmp", {NULL}, 153, "tcp"}, -{"sgmp", {NULL}, 153, "udp"}, -{"netsc-prod", {NULL}, 154, "tcp"}, -{"netsc-prod", {NULL}, 154, "udp"}, -{"netsc-dev", {NULL}, 155, "tcp"}, -{"netsc-dev", {NULL}, 155, "udp"}, -{"sqlsrv", {NULL}, 156, "tcp"}, -{"sqlsrv", {NULL}, 156, "udp"}, -{"knet-cmp", {NULL}, 157, "tcp"}, -{"knet-cmp", {NULL}, 157, "udp"}, -{"pcmail-srv", {NULL}, 158, "tcp"}, -{"pcmail-srv", {NULL}, 158, "udp"}, -{"nss-routing", {NULL}, 159, "tcp"}, -{"nss-routing", {NULL}, 159, "udp"}, -{"sgmp-traps", {NULL}, 160, "tcp"}, -{"sgmp-traps", {NULL}, 160, "udp"}, -{"snmp", {NULL}, 161, "tcp"}, -{"snmp", {NULL}, 161, "udp"}, -{"snmptrap", {NULL}, 162, "tcp"}, -{"snmptrap", {NULL}, 162, "udp"}, -{"cmip-man", {NULL}, 163, "tcp"}, -{"cmip-man", {NULL}, 163, "udp"}, -{"cmip-agent", {NULL}, 164, "tcp"}, -{"cmip-agent", {NULL}, 164, "udp"}, -{"xns-courier", {NULL}, 165, "tcp"}, -{"xns-courier", {NULL}, 165, "udp"}, -{"s-net", {NULL}, 166, "tcp"}, -{"s-net", {NULL}, 166, "udp"}, -{"namp", {NULL}, 167, "tcp"}, -{"namp", {NULL}, 167, "udp"}, -{"rsvd", {NULL}, 168, "tcp"}, -{"rsvd", {NULL}, 168, "udp"}, -{"send", {NULL}, 169, "tcp"}, -{"send", {NULL}, 169, "udp"}, -{"print-srv", {NULL}, 170, "tcp"}, -{"print-srv", {NULL}, 170, "udp"}, -{"multiplex", {NULL}, 171, "tcp"}, -{"multiplex", {NULL}, 171, "udp"}, -{"cl/1", {NULL}, 172, "tcp"}, -{"cl/1", {NULL}, 172, "udp"}, -{"xyplex-mux", {NULL}, 173, "tcp"}, -{"xyplex-mux", {NULL}, 173, "udp"}, -{"mailq", {NULL}, 174, "tcp"}, -{"mailq", {NULL}, 174, "udp"}, -{"vmnet", {NULL}, 175, "tcp"}, -{"vmnet", {NULL}, 175, "udp"}, -{"genrad-mux", {NULL}, 176, "tcp"}, -{"genrad-mux", {NULL}, 176, "udp"}, -{"xdmcp", {NULL}, 177, "tcp"}, -{"xdmcp", {NULL}, 177, "udp"}, -{"nextstep", {NULL}, 178, "tcp"}, -{"nextstep", {NULL}, 178, "udp"}, -{"bgp", {NULL}, 179, "tcp"}, -{"bgp", {NULL}, 179, "udp"}, -{"bgp", {NULL}, 179, "sctp"}, -{"ris", {NULL}, 180, "tcp"}, -{"ris", {NULL}, 180, "udp"}, -{"unify", {NULL}, 181, "tcp"}, -{"unify", {NULL}, 181, "udp"}, -{"audit", {NULL}, 182, "tcp"}, -{"audit", {NULL}, 182, "udp"}, -{"ocbinder", {NULL}, 183, "tcp"}, -{"ocbinder", {NULL}, 183, "udp"}, -{"ocserver", {NULL}, 184, "tcp"}, -{"ocserver", {NULL}, 184, "udp"}, -{"remote-kis", {NULL}, 185, "tcp"}, -{"remote-kis", {NULL}, 185, "udp"}, -{"kis", {NULL}, 186, "tcp"}, -{"kis", {NULL}, 186, "udp"}, -{"aci", {NULL}, 187, "tcp"}, -{"aci", {NULL}, 187, "udp"}, -{"mumps", {NULL}, 188, "tcp"}, -{"mumps", {NULL}, 188, "udp"}, -{"qft", {NULL}, 189, "tcp"}, -{"qft", {NULL}, 189, "udp"}, -{"gacp", {NULL}, 190, "tcp"}, -{"gacp", {NULL}, 190, "udp"}, -{"prospero", {NULL}, 191, "tcp"}, -{"prospero", {NULL}, 191, "udp"}, -{"osu-nms", {NULL}, 192, "tcp"}, -{"osu-nms", {NULL}, 192, "udp"}, -{"srmp", {NULL}, 193, "tcp"}, -{"srmp", {NULL}, 193, "udp"}, -{"irc", {NULL}, 194, "tcp"}, -{"irc", {NULL}, 194, "udp"}, -{"dn6-nlm-aud", {NULL}, 195, "tcp"}, -{"dn6-nlm-aud", {NULL}, 195, "udp"}, -{"dn6-smm-red", {NULL}, 196, "tcp"}, -{"dn6-smm-red", {NULL}, 196, "udp"}, -{"dls", {NULL}, 197, "tcp"}, -{"dls", {NULL}, 197, "udp"}, -{"dls-mon", {NULL}, 198, "tcp"}, -{"dls-mon", {NULL}, 198, "udp"}, -{"smux", {NULL}, 199, "tcp"}, -{"smux", {NULL}, 199, "udp"}, -{"src", {NULL}, 200, "tcp"}, -{"src", {NULL}, 200, "udp"}, -{"at-rtmp", {NULL}, 201, "tcp"}, -{"at-rtmp", {NULL}, 201, "udp"}, -{"at-nbp", {NULL}, 202, "tcp"}, -{"at-nbp", {NULL}, 202, "udp"}, -{"at-3", {NULL}, 203, "tcp"}, -{"at-3", {NULL}, 203, "udp"}, -{"at-echo", {NULL}, 204, "tcp"}, -{"at-echo", {NULL}, 204, "udp"}, -{"at-5", {NULL}, 205, "tcp"}, -{"at-5", {NULL}, 205, "udp"}, -{"at-zis", {NULL}, 206, "tcp"}, -{"at-zis", {NULL}, 206, "udp"}, -{"at-7", {NULL}, 207, "tcp"}, -{"at-7", {NULL}, 207, "udp"}, -{"at-8", {NULL}, 208, "tcp"}, -{"at-8", {NULL}, 208, "udp"}, -{"qmtp", {NULL}, 209, "tcp"}, -{"qmtp", {NULL}, 209, "udp"}, -{"z39.50", {NULL}, 210, "tcp"}, -{"z39.50", {NULL}, 210, "udp"}, -{"914c/g", {NULL}, 211, "tcp"}, -{"914c/g", {NULL}, 211, "udp"}, -{"anet", {NULL}, 212, "tcp"}, -{"anet", {NULL}, 212, "udp"}, -{"ipx", {NULL}, 213, "tcp"}, -{"ipx", {NULL}, 213, "udp"}, -{"vmpwscs", {NULL}, 214, "tcp"}, -{"vmpwscs", {NULL}, 214, "udp"}, -{"softpc", {NULL}, 215, "tcp"}, -{"softpc", {NULL}, 215, "udp"}, -{"CAIlic", {NULL}, 216, "tcp"}, -{"CAIlic", {NULL}, 216, "udp"}, -{"dbase", {NULL}, 217, "tcp"}, -{"dbase", {NULL}, 217, "udp"}, -{"mpp", {NULL}, 218, "tcp"}, -{"mpp", {NULL}, 218, "udp"}, -{"uarps", {NULL}, 219, "tcp"}, -{"uarps", {NULL}, 219, "udp"}, -{"imap3", {NULL}, 220, "tcp"}, -{"imap3", {NULL}, 220, "udp"}, -{"fln-spx", {NULL}, 221, "tcp"}, -{"fln-spx", {NULL}, 221, "udp"}, -{"rsh-spx", {NULL}, 222, "tcp"}, -{"rsh-spx", {NULL}, 222, "udp"}, -{"cdc", {NULL}, 223, "tcp"}, -{"cdc", {NULL}, 223, "udp"}, -{"masqdialer", {NULL}, 224, "tcp"}, -{"masqdialer", {NULL}, 224, "udp"}, -{"direct", {NULL}, 242, "tcp"}, -{"direct", {NULL}, 242, "udp"}, -{"sur-meas", {NULL}, 243, "tcp"}, -{"sur-meas", {NULL}, 243, "udp"}, -{"inbusiness", {NULL}, 244, "tcp"}, -{"inbusiness", {NULL}, 244, "udp"}, -{"link", {NULL}, 245, "tcp"}, -{"link", {NULL}, 245, "udp"}, -{"dsp3270", {NULL}, 246, "tcp"}, -{"dsp3270", {NULL}, 246, "udp"}, -{"subntbcst_tftp", {NULL}, 247, "tcp"}, -{"subntbcst_tftp", {NULL}, 247, "udp"}, -{"bhfhs", {NULL}, 248, "tcp"}, -{"bhfhs", {NULL}, 248, "udp"}, -{"rap", {NULL}, 256, "tcp"}, -{"rap", {NULL}, 256, "udp"}, -{"set", {NULL}, 257, "tcp"}, -{"set", {NULL}, 257, "udp"}, -{"esro-gen", {NULL}, 259, "tcp"}, -{"esro-gen", {NULL}, 259, "udp"}, -{"openport", {NULL}, 260, "tcp"}, -{"openport", {NULL}, 260, "udp"}, -{"nsiiops", {NULL}, 261, "tcp"}, -{"nsiiops", {NULL}, 261, "udp"}, -{"arcisdms", {NULL}, 262, "tcp"}, -{"arcisdms", {NULL}, 262, "udp"}, -{"hdap", {NULL}, 263, "tcp"}, -{"hdap", {NULL}, 263, "udp"}, -{"bgmp", {NULL}, 264, "tcp"}, -{"bgmp", {NULL}, 264, "udp"}, -{"x-bone-ctl", {NULL}, 265, "tcp"}, -{"x-bone-ctl", {NULL}, 265, "udp"}, -{"sst", {NULL}, 266, "tcp"}, -{"sst", {NULL}, 266, "udp"}, -{"td-service", {NULL}, 267, "tcp"}, -{"td-service", {NULL}, 267, "udp"}, -{"td-replica", {NULL}, 268, "tcp"}, -{"td-replica", {NULL}, 268, "udp"}, -{"manet", {NULL}, 269, "tcp"}, -{"manet", {NULL}, 269, "udp"}, -{"gist", {NULL}, 270, "udp"}, -{"http-mgmt", {NULL}, 280, "tcp"}, -{"http-mgmt", {NULL}, 280, "udp"}, -{"personal-link", {NULL}, 281, "tcp"}, -{"personal-link", {NULL}, 281, "udp"}, -{"cableport-ax", {NULL}, 282, "tcp"}, -{"cableport-ax", {NULL}, 282, "udp"}, -{"rescap", {NULL}, 283, "tcp"}, -{"rescap", {NULL}, 283, "udp"}, -{"corerjd", {NULL}, 284, "tcp"}, -{"corerjd", {NULL}, 284, "udp"}, -{"fxp", {NULL}, 286, "tcp"}, -{"fxp", {NULL}, 286, "udp"}, -{"k-block", {NULL}, 287, "tcp"}, -{"k-block", {NULL}, 287, "udp"}, -{"novastorbakcup", {NULL}, 308, "tcp"}, -{"novastorbakcup", {NULL}, 308, "udp"}, -{"entrusttime", {NULL}, 309, "tcp"}, -{"entrusttime", {NULL}, 309, "udp"}, -{"bhmds", {NULL}, 310, "tcp"}, -{"bhmds", {NULL}, 310, "udp"}, -{"asip-webadmin", {NULL}, 311, "tcp"}, -{"asip-webadmin", {NULL}, 311, "udp"}, -{"vslmp", {NULL}, 312, "tcp"}, -{"vslmp", {NULL}, 312, "udp"}, -{"magenta-logic", {NULL}, 313, "tcp"}, -{"magenta-logic", {NULL}, 313, "udp"}, -{"opalis-robot", {NULL}, 314, "tcp"}, -{"opalis-robot", {NULL}, 314, "udp"}, -{"dpsi", {NULL}, 315, "tcp"}, -{"dpsi", {NULL}, 315, "udp"}, -{"decauth", {NULL}, 316, "tcp"}, -{"decauth", {NULL}, 316, "udp"}, -{"zannet", {NULL}, 317, "tcp"}, -{"zannet", {NULL}, 317, "udp"}, -{"pkix-timestamp", {NULL}, 318, "tcp"}, -{"pkix-timestamp", {NULL}, 318, "udp"}, -{"ptp-event", {NULL}, 319, "tcp"}, -{"ptp-event", {NULL}, 319, "udp"}, -{"ptp-general", {NULL}, 320, "tcp"}, -{"ptp-general", {NULL}, 320, "udp"}, -{"pip", {NULL}, 321, "tcp"}, -{"pip", {NULL}, 321, "udp"}, -{"rtsps", {NULL}, 322, "tcp"}, -{"rtsps", {NULL}, 322, "udp"}, -{"texar", {NULL}, 333, "tcp"}, -{"texar", {NULL}, 333, "udp"}, -{"pdap", {NULL}, 344, "tcp"}, -{"pdap", {NULL}, 344, "udp"}, -{"pawserv", {NULL}, 345, "tcp"}, -{"pawserv", {NULL}, 345, "udp"}, -{"zserv", {NULL}, 346, "tcp"}, -{"zserv", {NULL}, 346, "udp"}, -{"fatserv", {NULL}, 347, "tcp"}, -{"fatserv", {NULL}, 347, "udp"}, -{"csi-sgwp", {NULL}, 348, "tcp"}, -{"csi-sgwp", {NULL}, 348, "udp"}, -{"mftp", {NULL}, 349, "tcp"}, -{"mftp", {NULL}, 349, "udp"}, -{"matip-type-a", {NULL}, 350, "tcp"}, -{"matip-type-a", {NULL}, 350, "udp"}, -{"matip-type-b", {NULL}, 351, "tcp"}, -{"matip-type-b", {NULL}, 351, "udp"}, -{"bhoetty", {NULL}, 351, "tcp"}, -{"bhoetty", {NULL}, 351, "udp"}, -{"dtag-ste-sb", {NULL}, 352, "tcp"}, -{"dtag-ste-sb", {NULL}, 352, "udp"}, -{"bhoedap4", {NULL}, 352, "tcp"}, -{"bhoedap4", {NULL}, 352, "udp"}, -{"ndsauth", {NULL}, 353, "tcp"}, -{"ndsauth", {NULL}, 353, "udp"}, -{"bh611", {NULL}, 354, "tcp"}, -{"bh611", {NULL}, 354, "udp"}, -{"datex-asn", {NULL}, 355, "tcp"}, -{"datex-asn", {NULL}, 355, "udp"}, -{"cloanto-net-1", {NULL}, 356, "tcp"}, -{"cloanto-net-1", {NULL}, 356, "udp"}, -{"bhevent", {NULL}, 357, "tcp"}, -{"bhevent", {NULL}, 357, "udp"}, -{"shrinkwrap", {NULL}, 358, "tcp"}, -{"shrinkwrap", {NULL}, 358, "udp"}, -{"nsrmp", {NULL}, 359, "tcp"}, -{"nsrmp", {NULL}, 359, "udp"}, -{"scoi2odialog", {NULL}, 360, "tcp"}, -{"scoi2odialog", {NULL}, 360, "udp"}, -{"semantix", {NULL}, 361, "tcp"}, -{"semantix", {NULL}, 361, "udp"}, -{"srssend", {NULL}, 362, "tcp"}, -{"srssend", {NULL}, 362, "udp"}, -{"rsvp_tunnel", {NULL}, 363, "tcp"}, -{"rsvp_tunnel", {NULL}, 363, "udp"}, -{"aurora-cmgr", {NULL}, 364, "tcp"}, -{"aurora-cmgr", {NULL}, 364, "udp"}, -{"dtk", {NULL}, 365, "tcp"}, -{"dtk", {NULL}, 365, "udp"}, -{"odmr", {NULL}, 366, "tcp"}, -{"odmr", {NULL}, 366, "udp"}, -{"mortgageware", {NULL}, 367, "tcp"}, -{"mortgageware", {NULL}, 367, "udp"}, -{"qbikgdp", {NULL}, 368, "tcp"}, -{"qbikgdp", {NULL}, 368, "udp"}, -{"rpc2portmap", {NULL}, 369, "tcp"}, -{"rpc2portmap", {NULL}, 369, "udp"}, -{"codaauth2", {NULL}, 370, "tcp"}, -{"codaauth2", {NULL}, 370, "udp"}, -{"clearcase", {NULL}, 371, "tcp"}, -{"clearcase", {NULL}, 371, "udp"}, -{"ulistproc", {NULL}, 372, "tcp"}, -{"ulistproc", {NULL}, 372, "udp"}, -{"legent-1", {NULL}, 373, "tcp"}, -{"legent-1", {NULL}, 373, "udp"}, -{"legent-2", {NULL}, 374, "tcp"}, -{"legent-2", {NULL}, 374, "udp"}, -{"hassle", {NULL}, 375, "tcp"}, -{"hassle", {NULL}, 375, "udp"}, -{"nip", {NULL}, 376, "tcp"}, -{"nip", {NULL}, 376, "udp"}, -{"tnETOS", {NULL}, 377, "tcp"}, -{"tnETOS", {NULL}, 377, "udp"}, -{"dsETOS", {NULL}, 378, "tcp"}, -{"dsETOS", {NULL}, 378, "udp"}, -{"is99c", {NULL}, 379, "tcp"}, -{"is99c", {NULL}, 379, "udp"}, -{"is99s", {NULL}, 380, "tcp"}, -{"is99s", {NULL}, 380, "udp"}, -{"hp-collector", {NULL}, 381, "tcp"}, -{"hp-collector", {NULL}, 381, "udp"}, -{"hp-managed-node", {NULL}, 382, "tcp"}, -{"hp-managed-node", {NULL}, 382, "udp"}, -{"hp-alarm-mgr", {NULL}, 383, "tcp"}, -{"hp-alarm-mgr", {NULL}, 383, "udp"}, -{"arns", {NULL}, 384, "tcp"}, -{"arns", {NULL}, 384, "udp"}, -{"ibm-app", {NULL}, 385, "tcp"}, -{"ibm-app", {NULL}, 385, "udp"}, -{"asa", {NULL}, 386, "tcp"}, -{"asa", {NULL}, 386, "udp"}, -{"aurp", {NULL}, 387, "tcp"}, -{"aurp", {NULL}, 387, "udp"}, -{"unidata-ldm", {NULL}, 388, "tcp"}, -{"unidata-ldm", {NULL}, 388, "udp"}, -{"ldap", {NULL}, 389, "tcp"}, -{"ldap", {NULL}, 389, "udp"}, -{"uis", {NULL}, 390, "tcp"}, -{"uis", {NULL}, 390, "udp"}, -{"synotics-relay", {NULL}, 391, "tcp"}, -{"synotics-relay", {NULL}, 391, "udp"}, -{"synotics-broker", {NULL}, 392, "tcp"}, -{"synotics-broker", {NULL}, 392, "udp"}, -{"meta5", {NULL}, 393, "tcp"}, -{"meta5", {NULL}, 393, "udp"}, -{"embl-ndt", {NULL}, 394, "tcp"}, -{"embl-ndt", {NULL}, 394, "udp"}, -{"netcp", {NULL}, 395, "tcp"}, -{"netcp", {NULL}, 395, "udp"}, -{"netware-ip", {NULL}, 396, "tcp"}, -{"netware-ip", {NULL}, 396, "udp"}, -{"mptn", {NULL}, 397, "tcp"}, -{"mptn", {NULL}, 397, "udp"}, -{"kryptolan", {NULL}, 398, "tcp"}, -{"kryptolan", {NULL}, 398, "udp"}, -{"iso-tsap-c2", {NULL}, 399, "tcp"}, -{"iso-tsap-c2", {NULL}, 399, "udp"}, -{"osb-sd", {NULL}, 400, "tcp"}, -{"osb-sd", {NULL}, 400, "udp"}, -{"ups", {NULL}, 401, "tcp"}, -{"ups", {NULL}, 401, "udp"}, -{"genie", {NULL}, 402, "tcp"}, -{"genie", {NULL}, 402, "udp"}, -{"decap", {NULL}, 403, "tcp"}, -{"decap", {NULL}, 403, "udp"}, -{"nced", {NULL}, 404, "tcp"}, -{"nced", {NULL}, 404, "udp"}, -{"ncld", {NULL}, 405, "tcp"}, -{"ncld", {NULL}, 405, "udp"}, -{"imsp", {NULL}, 406, "tcp"}, -{"imsp", {NULL}, 406, "udp"}, -{"timbuktu", {NULL}, 407, "tcp"}, -{"timbuktu", {NULL}, 407, "udp"}, -{"prm-sm", {NULL}, 408, "tcp"}, -{"prm-sm", {NULL}, 408, "udp"}, -{"prm-nm", {NULL}, 409, "tcp"}, -{"prm-nm", {NULL}, 409, "udp"}, -{"decladebug", {NULL}, 410, "tcp"}, -{"decladebug", {NULL}, 410, "udp"}, -{"rmt", {NULL}, 411, "tcp"}, -{"rmt", {NULL}, 411, "udp"}, -{"synoptics-trap", {NULL}, 412, "tcp"}, -{"synoptics-trap", {NULL}, 412, "udp"}, -{"smsp", {NULL}, 413, "tcp"}, -{"smsp", {NULL}, 413, "udp"}, -{"infoseek", {NULL}, 414, "tcp"}, -{"infoseek", {NULL}, 414, "udp"}, -{"bnet", {NULL}, 415, "tcp"}, -{"bnet", {NULL}, 415, "udp"}, -{"silverplatter", {NULL}, 416, "tcp"}, -{"silverplatter", {NULL}, 416, "udp"}, -{"onmux", {NULL}, 417, "tcp"}, -{"onmux", {NULL}, 417, "udp"}, -{"hyper-g", {NULL}, 418, "tcp"}, -{"hyper-g", {NULL}, 418, "udp"}, -{"ariel1", {NULL}, 419, "tcp"}, -{"ariel1", {NULL}, 419, "udp"}, -{"smpte", {NULL}, 420, "tcp"}, -{"smpte", {NULL}, 420, "udp"}, -{"ariel2", {NULL}, 421, "tcp"}, -{"ariel2", {NULL}, 421, "udp"}, -{"ariel3", {NULL}, 422, "tcp"}, -{"ariel3", {NULL}, 422, "udp"}, -{"opc-job-start", {NULL}, 423, "tcp"}, -{"opc-job-start", {NULL}, 423, "udp"}, -{"opc-job-track", {NULL}, 424, "tcp"}, -{"opc-job-track", {NULL}, 424, "udp"}, -{"icad-el", {NULL}, 425, "tcp"}, -{"icad-el", {NULL}, 425, "udp"}, -{"smartsdp", {NULL}, 426, "tcp"}, -{"smartsdp", {NULL}, 426, "udp"}, -{"svrloc", {NULL}, 427, "tcp"}, -{"svrloc", {NULL}, 427, "udp"}, -{"ocs_cmu", {NULL}, 428, "tcp"}, -{"ocs_cmu", {NULL}, 428, "udp"}, -{"ocs_amu", {NULL}, 429, "tcp"}, -{"ocs_amu", {NULL}, 429, "udp"}, -{"utmpsd", {NULL}, 430, "tcp"}, -{"utmpsd", {NULL}, 430, "udp"}, -{"utmpcd", {NULL}, 431, "tcp"}, -{"utmpcd", {NULL}, 431, "udp"}, -{"iasd", {NULL}, 432, "tcp"}, -{"iasd", {NULL}, 432, "udp"}, -{"nnsp", {NULL}, 433, "tcp"}, -{"nnsp", {NULL}, 433, "udp"}, -{"mobileip-agent", {NULL}, 434, "tcp"}, -{"mobileip-agent", {NULL}, 434, "udp"}, -{"mobilip-mn", {NULL}, 435, "tcp"}, -{"mobilip-mn", {NULL}, 435, "udp"}, -{"dna-cml", {NULL}, 436, "tcp"}, -{"dna-cml", {NULL}, 436, "udp"}, -{"comscm", {NULL}, 437, "tcp"}, -{"comscm", {NULL}, 437, "udp"}, -{"dsfgw", {NULL}, 438, "tcp"}, -{"dsfgw", {NULL}, 438, "udp"}, -{"dasp", {NULL}, 439, "tcp"}, -{"dasp", {NULL}, 439, "udp"}, -{"sgcp", {NULL}, 440, "tcp"}, -{"sgcp", {NULL}, 440, "udp"}, -{"decvms-sysmgt", {NULL}, 441, "tcp"}, -{"decvms-sysmgt", {NULL}, 441, "udp"}, -{"cvc_hostd", {NULL}, 442, "tcp"}, -{"cvc_hostd", {NULL}, 442, "udp"}, -{"https", {NULL}, 443, "tcp"}, -{"https", {NULL}, 443, "udp"}, -{"https", {NULL}, 443, "sctp"}, -{"snpp", {NULL}, 444, "tcp"}, -{"snpp", {NULL}, 444, "udp"}, -{"microsoft-ds", {NULL}, 445, "tcp"}, -{"microsoft-ds", {NULL}, 445, "udp"}, -{"ddm-rdb", {NULL}, 446, "tcp"}, -{"ddm-rdb", {NULL}, 446, "udp"}, -{"ddm-dfm", {NULL}, 447, "tcp"}, -{"ddm-dfm", {NULL}, 447, "udp"}, -{"ddm-ssl", {NULL}, 448, "tcp"}, -{"ddm-ssl", {NULL}, 448, "udp"}, -{"as-servermap", {NULL}, 449, "tcp"}, -{"as-servermap", {NULL}, 449, "udp"}, -{"tserver", {NULL}, 450, "tcp"}, -{"tserver", {NULL}, 450, "udp"}, -{"sfs-smp-net", {NULL}, 451, "tcp"}, -{"sfs-smp-net", {NULL}, 451, "udp"}, -{"sfs-config", {NULL}, 452, "tcp"}, -{"sfs-config", {NULL}, 452, "udp"}, -{"creativeserver", {NULL}, 453, "tcp"}, -{"creativeserver", {NULL}, 453, "udp"}, -{"contentserver", {NULL}, 454, "tcp"}, -{"contentserver", {NULL}, 454, "udp"}, -{"creativepartnr", {NULL}, 455, "tcp"}, -{"creativepartnr", {NULL}, 455, "udp"}, -{"macon-tcp", {NULL}, 456, "tcp"}, -{"macon-udp", {NULL}, 456, "udp"}, -{"scohelp", {NULL}, 457, "tcp"}, -{"scohelp", {NULL}, 457, "udp"}, -{"appleqtc", {NULL}, 458, "tcp"}, -{"appleqtc", {NULL}, 458, "udp"}, -{"ampr-rcmd", {NULL}, 459, "tcp"}, -{"ampr-rcmd", {NULL}, 459, "udp"}, -{"skronk", {NULL}, 460, "tcp"}, -{"skronk", {NULL}, 460, "udp"}, -{"datasurfsrv", {NULL}, 461, "tcp"}, -{"datasurfsrv", {NULL}, 461, "udp"}, -{"datasurfsrvsec", {NULL}, 462, "tcp"}, -{"datasurfsrvsec", {NULL}, 462, "udp"}, -{"alpes", {NULL}, 463, "tcp"}, -{"alpes", {NULL}, 463, "udp"}, -{"kpasswd", {NULL}, 464, "tcp"}, -{"kpasswd", {NULL}, 464, "udp"}, -{"urd", {NULL}, 465, "tcp"}, -{"igmpv3lite", {NULL}, 465, "udp"}, -{"digital-vrc", {NULL}, 466, "tcp"}, -{"digital-vrc", {NULL}, 466, "udp"}, -{"mylex-mapd", {NULL}, 467, "tcp"}, -{"mylex-mapd", {NULL}, 467, "udp"}, -{"photuris", {NULL}, 468, "tcp"}, -{"photuris", {NULL}, 468, "udp"}, -{"rcp", {NULL}, 469, "tcp"}, -{"rcp", {NULL}, 469, "udp"}, -{"scx-proxy", {NULL}, 470, "tcp"}, -{"scx-proxy", {NULL}, 470, "udp"}, -{"mondex", {NULL}, 471, "tcp"}, -{"mondex", {NULL}, 471, "udp"}, -{"ljk-login", {NULL}, 472, "tcp"}, -{"ljk-login", {NULL}, 472, "udp"}, -{"hybrid-pop", {NULL}, 473, "tcp"}, -{"hybrid-pop", {NULL}, 473, "udp"}, -{"tn-tl-w1", {NULL}, 474, "tcp"}, -{"tn-tl-w2", {NULL}, 474, "udp"}, -{"tcpnethaspsrv", {NULL}, 475, "tcp"}, -{"tcpnethaspsrv", {NULL}, 475, "udp"}, -{"tn-tl-fd1", {NULL}, 476, "tcp"}, -{"tn-tl-fd1", {NULL}, 476, "udp"}, -{"ss7ns", {NULL}, 477, "tcp"}, -{"ss7ns", {NULL}, 477, "udp"}, -{"spsc", {NULL}, 478, "tcp"}, -{"spsc", {NULL}, 478, "udp"}, -{"iafserver", {NULL}, 479, "tcp"}, -{"iafserver", {NULL}, 479, "udp"}, -{"iafdbase", {NULL}, 480, "tcp"}, -{"iafdbase", {NULL}, 480, "udp"}, -{"ph", {NULL}, 481, "tcp"}, -{"ph", {NULL}, 481, "udp"}, -{"bgs-nsi", {NULL}, 482, "tcp"}, -{"bgs-nsi", {NULL}, 482, "udp"}, -{"ulpnet", {NULL}, 483, "tcp"}, -{"ulpnet", {NULL}, 483, "udp"}, -{"integra-sme", {NULL}, 484, "tcp"}, -{"integra-sme", {NULL}, 484, "udp"}, -{"powerburst", {NULL}, 485, "tcp"}, -{"powerburst", {NULL}, 485, "udp"}, -{"avian", {NULL}, 486, "tcp"}, -{"avian", {NULL}, 486, "udp"}, -{"saft", {NULL}, 487, "tcp"}, -{"saft", {NULL}, 487, "udp"}, -{"gss-http", {NULL}, 488, "tcp"}, -{"gss-http", {NULL}, 488, "udp"}, -{"nest-protocol", {NULL}, 489, "tcp"}, -{"nest-protocol", {NULL}, 489, "udp"}, -{"micom-pfs", {NULL}, 490, "tcp"}, -{"micom-pfs", {NULL}, 490, "udp"}, -{"go-login", {NULL}, 491, "tcp"}, -{"go-login", {NULL}, 491, "udp"}, -{"ticf-1", {NULL}, 492, "tcp"}, -{"ticf-1", {NULL}, 492, "udp"}, -{"ticf-2", {NULL}, 493, "tcp"}, -{"ticf-2", {NULL}, 493, "udp"}, -{"pov-ray", {NULL}, 494, "tcp"}, -{"pov-ray", {NULL}, 494, "udp"}, -{"intecourier", {NULL}, 495, "tcp"}, -{"intecourier", {NULL}, 495, "udp"}, -{"pim-rp-disc", {NULL}, 496, "tcp"}, -{"pim-rp-disc", {NULL}, 496, "udp"}, -{"dantz", {NULL}, 497, "tcp"}, -{"dantz", {NULL}, 497, "udp"}, -{"siam", {NULL}, 498, "tcp"}, -{"siam", {NULL}, 498, "udp"}, -{"iso-ill", {NULL}, 499, "tcp"}, -{"iso-ill", {NULL}, 499, "udp"}, -{"isakmp", {NULL}, 500, "tcp"}, -{"isakmp", {NULL}, 500, "udp"}, -{"stmf", {NULL}, 501, "tcp"}, -{"stmf", {NULL}, 501, "udp"}, -{"asa-appl-proto", {NULL}, 502, "tcp"}, -{"asa-appl-proto", {NULL}, 502, "udp"}, -{"intrinsa", {NULL}, 503, "tcp"}, -{"intrinsa", {NULL}, 503, "udp"}, -{"citadel", {NULL}, 504, "tcp"}, -{"citadel", {NULL}, 504, "udp"}, -{"mailbox-lm", {NULL}, 505, "tcp"}, -{"mailbox-lm", {NULL}, 505, "udp"}, -{"ohimsrv", {NULL}, 506, "tcp"}, -{"ohimsrv", {NULL}, 506, "udp"}, -{"crs", {NULL}, 507, "tcp"}, -{"crs", {NULL}, 507, "udp"}, -{"xvttp", {NULL}, 508, "tcp"}, -{"xvttp", {NULL}, 508, "udp"}, -{"snare", {NULL}, 509, "tcp"}, -{"snare", {NULL}, 509, "udp"}, -{"fcp", {NULL}, 510, "tcp"}, -{"fcp", {NULL}, 510, "udp"}, -{"passgo", {NULL}, 511, "tcp"}, -{"passgo", {NULL}, 511, "udp"}, -{"exec", {NULL}, 512, "tcp"}, -{"comsat", {NULL}, 512, "udp"}, -{"biff", {NULL}, 512, "udp"}, -{"login", {NULL}, 513, "tcp"}, -{"who", {NULL}, 513, "udp"}, -{"shell", {NULL}, 514, "tcp"}, -{"syslog", {NULL}, 514, "udp"}, -{"printer", {NULL}, 515, "tcp"}, -{"printer", {NULL}, 515, "udp"}, -{"videotex", {NULL}, 516, "tcp"}, -{"videotex", {NULL}, 516, "udp"}, -{"talk", {NULL}, 517, "tcp"}, -{"talk", {NULL}, 517, "udp"}, -{"ntalk", {NULL}, 518, "tcp"}, -{"ntalk", {NULL}, 518, "udp"}, -{"utime", {NULL}, 519, "tcp"}, -{"utime", {NULL}, 519, "udp"}, -{"efs", {NULL}, 520, "tcp"}, -{"router", {NULL}, 520, "udp"}, -{"ripng", {NULL}, 521, "tcp"}, -{"ripng", {NULL}, 521, "udp"}, -{"ulp", {NULL}, 522, "tcp"}, -{"ulp", {NULL}, 522, "udp"}, -{"ibm-db2", {NULL}, 523, "tcp"}, -{"ibm-db2", {NULL}, 523, "udp"}, -{"ncp", {NULL}, 524, "tcp"}, -{"ncp", {NULL}, 524, "udp"}, -{"timed", {NULL}, 525, "tcp"}, -{"timed", {NULL}, 525, "udp"}, -{"tempo", {NULL}, 526, "tcp"}, -{"tempo", {NULL}, 526, "udp"}, -{"stx", {NULL}, 527, "tcp"}, -{"stx", {NULL}, 527, "udp"}, -{"custix", {NULL}, 528, "tcp"}, -{"custix", {NULL}, 528, "udp"}, -{"irc-serv", {NULL}, 529, "tcp"}, -{"irc-serv", {NULL}, 529, "udp"}, -{"courier", {NULL}, 530, "tcp"}, -{"courier", {NULL}, 530, "udp"}, -{"conference", {NULL}, 531, "tcp"}, -{"conference", {NULL}, 531, "udp"}, -{"netnews", {NULL}, 532, "tcp"}, -{"netnews", {NULL}, 532, "udp"}, -{"netwall", {NULL}, 533, "tcp"}, -{"netwall", {NULL}, 533, "udp"}, -{"windream", {NULL}, 534, "tcp"}, -{"windream", {NULL}, 534, "udp"}, -{"iiop", {NULL}, 535, "tcp"}, -{"iiop", {NULL}, 535, "udp"}, -{"opalis-rdv", {NULL}, 536, "tcp"}, -{"opalis-rdv", {NULL}, 536, "udp"}, -{"nmsp", {NULL}, 537, "tcp"}, -{"nmsp", {NULL}, 537, "udp"}, -{"gdomap", {NULL}, 538, "tcp"}, -{"gdomap", {NULL}, 538, "udp"}, -{"apertus-ldp", {NULL}, 539, "tcp"}, -{"apertus-ldp", {NULL}, 539, "udp"}, -{"uucp", {NULL}, 540, "tcp"}, -{"uucp", {NULL}, 540, "udp"}, -{"uucp-rlogin", {NULL}, 541, "tcp"}, -{"uucp-rlogin", {NULL}, 541, "udp"}, -{"commerce", {NULL}, 542, "tcp"}, -{"commerce", {NULL}, 542, "udp"}, -{"klogin", {NULL}, 543, "tcp"}, -{"klogin", {NULL}, 543, "udp"}, -{"kshell", {NULL}, 544, "tcp"}, -{"kshell", {NULL}, 544, "udp"}, -{"appleqtcsrvr", {NULL}, 545, "tcp"}, -{"appleqtcsrvr", {NULL}, 545, "udp"}, -{"dhcpv6-client", {NULL}, 546, "tcp"}, -{"dhcpv6-client", {NULL}, 546, "udp"}, -{"dhcpv6-server", {NULL}, 547, "tcp"}, -{"dhcpv6-server", {NULL}, 547, "udp"}, -{"afpovertcp", {NULL}, 548, "tcp"}, -{"afpovertcp", {NULL}, 548, "udp"}, -{"idfp", {NULL}, 549, "tcp"}, -{"idfp", {NULL}, 549, "udp"}, -{"new-rwho", {NULL}, 550, "tcp"}, -{"new-rwho", {NULL}, 550, "udp"}, -{"cybercash", {NULL}, 551, "tcp"}, -{"cybercash", {NULL}, 551, "udp"}, -{"devshr-nts", {NULL}, 552, "tcp"}, -{"devshr-nts", {NULL}, 552, "udp"}, -{"pirp", {NULL}, 553, "tcp"}, -{"pirp", {NULL}, 553, "udp"}, -{"rtsp", {NULL}, 554, "tcp"}, -{"rtsp", {NULL}, 554, "udp"}, -{"dsf", {NULL}, 555, "tcp"}, -{"dsf", {NULL}, 555, "udp"}, -{"remotefs", {NULL}, 556, "tcp"}, -{"remotefs", {NULL}, 556, "udp"}, -{"openvms-sysipc", {NULL}, 557, "tcp"}, -{"openvms-sysipc", {NULL}, 557, "udp"}, -{"sdnskmp", {NULL}, 558, "tcp"}, -{"sdnskmp", {NULL}, 558, "udp"}, -{"teedtap", {NULL}, 559, "tcp"}, -{"teedtap", {NULL}, 559, "udp"}, -{"rmonitor", {NULL}, 560, "tcp"}, -{"rmonitor", {NULL}, 560, "udp"}, -{"monitor", {NULL}, 561, "tcp"}, -{"monitor", {NULL}, 561, "udp"}, -{"chshell", {NULL}, 562, "tcp"}, -{"chshell", {NULL}, 562, "udp"}, -{"nntps", {NULL}, 563, "tcp"}, -{"nntps", {NULL}, 563, "udp"}, -{"9pfs", {NULL}, 564, "tcp"}, -{"9pfs", {NULL}, 564, "udp"}, -{"whoami", {NULL}, 565, "tcp"}, -{"whoami", {NULL}, 565, "udp"}, -{"streettalk", {NULL}, 566, "tcp"}, -{"streettalk", {NULL}, 566, "udp"}, -{"banyan-rpc", {NULL}, 567, "tcp"}, -{"banyan-rpc", {NULL}, 567, "udp"}, -{"ms-shuttle", {NULL}, 568, "tcp"}, -{"ms-shuttle", {NULL}, 568, "udp"}, -{"ms-rome", {NULL}, 569, "tcp"}, -{"ms-rome", {NULL}, 569, "udp"}, -{"meter", {NULL}, 570, "tcp"}, -{"meter", {NULL}, 570, "udp"}, -{"meter", {NULL}, 571, "tcp"}, -{"meter", {NULL}, 571, "udp"}, -{"sonar", {NULL}, 572, "tcp"}, -{"sonar", {NULL}, 572, "udp"}, -{"banyan-vip", {NULL}, 573, "tcp"}, -{"banyan-vip", {NULL}, 573, "udp"}, -{"ftp-agent", {NULL}, 574, "tcp"}, -{"ftp-agent", {NULL}, 574, "udp"}, -{"vemmi", {NULL}, 575, "tcp"}, -{"vemmi", {NULL}, 575, "udp"}, -{"ipcd", {NULL}, 576, "tcp"}, -{"ipcd", {NULL}, 576, "udp"}, -{"vnas", {NULL}, 577, "tcp"}, -{"vnas", {NULL}, 577, "udp"}, -{"ipdd", {NULL}, 578, "tcp"}, -{"ipdd", {NULL}, 578, "udp"}, -{"decbsrv", {NULL}, 579, "tcp"}, -{"decbsrv", {NULL}, 579, "udp"}, -{"sntp-heartbeat", {NULL}, 580, "tcp"}, -{"sntp-heartbeat", {NULL}, 580, "udp"}, -{"bdp", {NULL}, 581, "tcp"}, -{"bdp", {NULL}, 581, "udp"}, -{"scc-security", {NULL}, 582, "tcp"}, -{"scc-security", {NULL}, 582, "udp"}, -{"philips-vc", {NULL}, 583, "tcp"}, -{"philips-vc", {NULL}, 583, "udp"}, -{"keyserver", {NULL}, 584, "tcp"}, -{"keyserver", {NULL}, 584, "udp"}, -{"password-chg", {NULL}, 586, "tcp"}, -{"password-chg", {NULL}, 586, "udp"}, -{"submission", {NULL}, 587, "tcp"}, -{"submission", {NULL}, 587, "udp"}, -{"cal", {NULL}, 588, "tcp"}, -{"cal", {NULL}, 588, "udp"}, -{"eyelink", {NULL}, 589, "tcp"}, -{"eyelink", {NULL}, 589, "udp"}, -{"tns-cml", {NULL}, 590, "tcp"}, -{"tns-cml", {NULL}, 590, "udp"}, -{"http-alt", {NULL}, 591, "tcp"}, -{"http-alt", {NULL}, 591, "udp"}, -{"eudora-set", {NULL}, 592, "tcp"}, -{"eudora-set", {NULL}, 592, "udp"}, -{"http-rpc-epmap", {NULL}, 593, "tcp"}, -{"http-rpc-epmap", {NULL}, 593, "udp"}, -{"tpip", {NULL}, 594, "tcp"}, -{"tpip", {NULL}, 594, "udp"}, -{"cab-protocol", {NULL}, 595, "tcp"}, -{"cab-protocol", {NULL}, 595, "udp"}, -{"smsd", {NULL}, 596, "tcp"}, -{"smsd", {NULL}, 596, "udp"}, -{"ptcnameservice", {NULL}, 597, "tcp"}, -{"ptcnameservice", {NULL}, 597, "udp"}, -{"sco-websrvrmg3", {NULL}, 598, "tcp"}, -{"sco-websrvrmg3", {NULL}, 598, "udp"}, -{"acp", {NULL}, 599, "tcp"}, -{"acp", {NULL}, 599, "udp"}, -{"ipcserver", {NULL}, 600, "tcp"}, -{"ipcserver", {NULL}, 600, "udp"}, -{"syslog-conn", {NULL}, 601, "tcp"}, -{"syslog-conn", {NULL}, 601, "udp"}, -{"xmlrpc-beep", {NULL}, 602, "tcp"}, -{"xmlrpc-beep", {NULL}, 602, "udp"}, -{"idxp", {NULL}, 603, "tcp"}, -{"idxp", {NULL}, 603, "udp"}, -{"tunnel", {NULL}, 604, "tcp"}, -{"tunnel", {NULL}, 604, "udp"}, -{"soap-beep", {NULL}, 605, "tcp"}, -{"soap-beep", {NULL}, 605, "udp"}, -{"urm", {NULL}, 606, "tcp"}, -{"urm", {NULL}, 606, "udp"}, -{"nqs", {NULL}, 607, "tcp"}, -{"nqs", {NULL}, 607, "udp"}, -{"sift-uft", {NULL}, 608, "tcp"}, -{"sift-uft", {NULL}, 608, "udp"}, -{"npmp-trap", {NULL}, 609, "tcp"}, -{"npmp-trap", {NULL}, 609, "udp"}, -{"npmp-local", {NULL}, 610, "tcp"}, -{"npmp-local", {NULL}, 610, "udp"}, -{"npmp-gui", {NULL}, 611, "tcp"}, -{"npmp-gui", {NULL}, 611, "udp"}, -{"hmmp-ind", {NULL}, 612, "tcp"}, -{"hmmp-ind", {NULL}, 612, "udp"}, -{"hmmp-op", {NULL}, 613, "tcp"}, -{"hmmp-op", {NULL}, 613, "udp"}, -{"sshell", {NULL}, 614, "tcp"}, -{"sshell", {NULL}, 614, "udp"}, -{"sco-inetmgr", {NULL}, 615, "tcp"}, -{"sco-inetmgr", {NULL}, 615, "udp"}, -{"sco-sysmgr", {NULL}, 616, "tcp"}, -{"sco-sysmgr", {NULL}, 616, "udp"}, -{"sco-dtmgr", {NULL}, 617, "tcp"}, -{"sco-dtmgr", {NULL}, 617, "udp"}, -{"dei-icda", {NULL}, 618, "tcp"}, -{"dei-icda", {NULL}, 618, "udp"}, -{"compaq-evm", {NULL}, 619, "tcp"}, -{"compaq-evm", {NULL}, 619, "udp"}, -{"sco-websrvrmgr", {NULL}, 620, "tcp"}, -{"sco-websrvrmgr", {NULL}, 620, "udp"}, -{"escp-ip", {NULL}, 621, "tcp"}, -{"escp-ip", {NULL}, 621, "udp"}, -{"collaborator", {NULL}, 622, "tcp"}, -{"collaborator", {NULL}, 622, "udp"}, -{"oob-ws-http", {NULL}, 623, "tcp"}, -{"asf-rmcp", {NULL}, 623, "udp"}, -{"cryptoadmin", {NULL}, 624, "tcp"}, -{"cryptoadmin", {NULL}, 624, "udp"}, -{"dec_dlm", {NULL}, 625, "tcp"}, -{"dec_dlm", {NULL}, 625, "udp"}, -{"asia", {NULL}, 626, "tcp"}, -{"asia", {NULL}, 626, "udp"}, -{"passgo-tivoli", {NULL}, 627, "tcp"}, -{"passgo-tivoli", {NULL}, 627, "udp"}, -{"qmqp", {NULL}, 628, "tcp"}, -{"qmqp", {NULL}, 628, "udp"}, -{"3com-amp3", {NULL}, 629, "tcp"}, -{"3com-amp3", {NULL}, 629, "udp"}, -{"rda", {NULL}, 630, "tcp"}, -{"rda", {NULL}, 630, "udp"}, -{"ipp", {NULL}, 631, "tcp"}, -{"ipp", {NULL}, 631, "udp"}, -{"bmpp", {NULL}, 632, "tcp"}, -{"bmpp", {NULL}, 632, "udp"}, -{"servstat", {NULL}, 633, "tcp"}, -{"servstat", {NULL}, 633, "udp"}, -{"ginad", {NULL}, 634, "tcp"}, -{"ginad", {NULL}, 634, "udp"}, -{"rlzdbase", {NULL}, 635, "tcp"}, -{"rlzdbase", {NULL}, 635, "udp"}, -{"ldaps", {NULL}, 636, "tcp"}, -{"ldaps", {NULL}, 636, "udp"}, -{"lanserver", {NULL}, 637, "tcp"}, -{"lanserver", {NULL}, 637, "udp"}, -{"mcns-sec", {NULL}, 638, "tcp"}, -{"mcns-sec", {NULL}, 638, "udp"}, -{"msdp", {NULL}, 639, "tcp"}, -{"msdp", {NULL}, 639, "udp"}, -{"entrust-sps", {NULL}, 640, "tcp"}, -{"entrust-sps", {NULL}, 640, "udp"}, -{"repcmd", {NULL}, 641, "tcp"}, -{"repcmd", {NULL}, 641, "udp"}, -{"esro-emsdp", {NULL}, 642, "tcp"}, -{"esro-emsdp", {NULL}, 642, "udp"}, -{"sanity", {NULL}, 643, "tcp"}, -{"sanity", {NULL}, 643, "udp"}, -{"dwr", {NULL}, 644, "tcp"}, -{"dwr", {NULL}, 644, "udp"}, -{"pssc", {NULL}, 645, "tcp"}, -{"pssc", {NULL}, 645, "udp"}, -{"ldp", {NULL}, 646, "tcp"}, -{"ldp", {NULL}, 646, "udp"}, -{"dhcp-failover", {NULL}, 647, "tcp"}, -{"dhcp-failover", {NULL}, 647, "udp"}, -{"rrp", {NULL}, 648, "tcp"}, -{"rrp", {NULL}, 648, "udp"}, -{"cadview-3d", {NULL}, 649, "tcp"}, -{"cadview-3d", {NULL}, 649, "udp"}, -{"obex", {NULL}, 650, "tcp"}, -{"obex", {NULL}, 650, "udp"}, -{"ieee-mms", {NULL}, 651, "tcp"}, -{"ieee-mms", {NULL}, 651, "udp"}, -{"hello-port", {NULL}, 652, "tcp"}, -{"hello-port", {NULL}, 652, "udp"}, -{"repscmd", {NULL}, 653, "tcp"}, -{"repscmd", {NULL}, 653, "udp"}, -{"aodv", {NULL}, 654, "tcp"}, -{"aodv", {NULL}, 654, "udp"}, -{"tinc", {NULL}, 655, "tcp"}, -{"tinc", {NULL}, 655, "udp"}, -{"spmp", {NULL}, 656, "tcp"}, -{"spmp", {NULL}, 656, "udp"}, -{"rmc", {NULL}, 657, "tcp"}, -{"rmc", {NULL}, 657, "udp"}, -{"tenfold", {NULL}, 658, "tcp"}, -{"tenfold", {NULL}, 658, "udp"}, -{"mac-srvr-admin", {NULL}, 660, "tcp"}, -{"mac-srvr-admin", {NULL}, 660, "udp"}, -{"hap", {NULL}, 661, "tcp"}, -{"hap", {NULL}, 661, "udp"}, -{"pftp", {NULL}, 662, "tcp"}, -{"pftp", {NULL}, 662, "udp"}, -{"purenoise", {NULL}, 663, "tcp"}, -{"purenoise", {NULL}, 663, "udp"}, -{"oob-ws-https", {NULL}, 664, "tcp"}, -{"asf-secure-rmcp", {NULL}, 664, "udp"}, -{"sun-dr", {NULL}, 665, "tcp"}, -{"sun-dr", {NULL}, 665, "udp"}, -{"mdqs", {NULL}, 666, "tcp"}, -{"mdqs", {NULL}, 666, "udp"}, -{"doom", {NULL}, 666, "tcp"}, -{"doom", {NULL}, 666, "udp"}, -{"disclose", {NULL}, 667, "tcp"}, -{"disclose", {NULL}, 667, "udp"}, -{"mecomm", {NULL}, 668, "tcp"}, -{"mecomm", {NULL}, 668, "udp"}, -{"meregister", {NULL}, 669, "tcp"}, -{"meregister", {NULL}, 669, "udp"}, -{"vacdsm-sws", {NULL}, 670, "tcp"}, -{"vacdsm-sws", {NULL}, 670, "udp"}, -{"vacdsm-app", {NULL}, 671, "tcp"}, -{"vacdsm-app", {NULL}, 671, "udp"}, -{"vpps-qua", {NULL}, 672, "tcp"}, -{"vpps-qua", {NULL}, 672, "udp"}, -{"cimplex", {NULL}, 673, "tcp"}, -{"cimplex", {NULL}, 673, "udp"}, -{"acap", {NULL}, 674, "tcp"}, -{"acap", {NULL}, 674, "udp"}, -{"dctp", {NULL}, 675, "tcp"}, -{"dctp", {NULL}, 675, "udp"}, -{"vpps-via", {NULL}, 676, "tcp"}, -{"vpps-via", {NULL}, 676, "udp"}, -{"vpp", {NULL}, 677, "tcp"}, -{"vpp", {NULL}, 677, "udp"}, -{"ggf-ncp", {NULL}, 678, "tcp"}, -{"ggf-ncp", {NULL}, 678, "udp"}, -{"mrm", {NULL}, 679, "tcp"}, -{"mrm", {NULL}, 679, "udp"}, -{"entrust-aaas", {NULL}, 680, "tcp"}, -{"entrust-aaas", {NULL}, 680, "udp"}, -{"entrust-aams", {NULL}, 681, "tcp"}, -{"entrust-aams", {NULL}, 681, "udp"}, -{"xfr", {NULL}, 682, "tcp"}, -{"xfr", {NULL}, 682, "udp"}, -{"corba-iiop", {NULL}, 683, "tcp"}, -{"corba-iiop", {NULL}, 683, "udp"}, -{"corba-iiop-ssl", {NULL}, 684, "tcp"}, -{"corba-iiop-ssl", {NULL}, 684, "udp"}, -{"mdc-portmapper", {NULL}, 685, "tcp"}, -{"mdc-portmapper", {NULL}, 685, "udp"}, -{"hcp-wismar", {NULL}, 686, "tcp"}, -{"hcp-wismar", {NULL}, 686, "udp"}, -{"asipregistry", {NULL}, 687, "tcp"}, -{"asipregistry", {NULL}, 687, "udp"}, -{"realm-rusd", {NULL}, 688, "tcp"}, -{"realm-rusd", {NULL}, 688, "udp"}, -{"nmap", {NULL}, 689, "tcp"}, -{"nmap", {NULL}, 689, "udp"}, -{"vatp", {NULL}, 690, "tcp"}, -{"vatp", {NULL}, 690, "udp"}, -{"msexch-routing", {NULL}, 691, "tcp"}, -{"msexch-routing", {NULL}, 691, "udp"}, -{"hyperwave-isp", {NULL}, 692, "tcp"}, -{"hyperwave-isp", {NULL}, 692, "udp"}, -{"connendp", {NULL}, 693, "tcp"}, -{"connendp", {NULL}, 693, "udp"}, -{"ha-cluster", {NULL}, 694, "tcp"}, -{"ha-cluster", {NULL}, 694, "udp"}, -{"ieee-mms-ssl", {NULL}, 695, "tcp"}, -{"ieee-mms-ssl", {NULL}, 695, "udp"}, -{"rushd", {NULL}, 696, "tcp"}, -{"rushd", {NULL}, 696, "udp"}, -{"uuidgen", {NULL}, 697, "tcp"}, -{"uuidgen", {NULL}, 697, "udp"}, -{"olsr", {NULL}, 698, "tcp"}, -{"olsr", {NULL}, 698, "udp"}, -{"accessnetwork", {NULL}, 699, "tcp"}, -{"accessnetwork", {NULL}, 699, "udp"}, -{"epp", {NULL}, 700, "tcp"}, -{"epp", {NULL}, 700, "udp"}, -{"lmp", {NULL}, 701, "tcp"}, -{"lmp", {NULL}, 701, "udp"}, -{"iris-beep", {NULL}, 702, "tcp"}, -{"iris-beep", {NULL}, 702, "udp"}, -{"elcsd", {NULL}, 704, "tcp"}, -{"elcsd", {NULL}, 704, "udp"}, -{"agentx", {NULL}, 705, "tcp"}, -{"agentx", {NULL}, 705, "udp"}, -{"silc", {NULL}, 706, "tcp"}, -{"silc", {NULL}, 706, "udp"}, -{"borland-dsj", {NULL}, 707, "tcp"}, -{"borland-dsj", {NULL}, 707, "udp"}, -{"entrust-kmsh", {NULL}, 709, "tcp"}, -{"entrust-kmsh", {NULL}, 709, "udp"}, -{"entrust-ash", {NULL}, 710, "tcp"}, -{"entrust-ash", {NULL}, 710, "udp"}, -{"cisco-tdp", {NULL}, 711, "tcp"}, -{"cisco-tdp", {NULL}, 711, "udp"}, -{"tbrpf", {NULL}, 712, "tcp"}, -{"tbrpf", {NULL}, 712, "udp"}, -{"iris-xpc", {NULL}, 713, "tcp"}, -{"iris-xpc", {NULL}, 713, "udp"}, -{"iris-xpcs", {NULL}, 714, "tcp"}, -{"iris-xpcs", {NULL}, 714, "udp"}, -{"iris-lwz", {NULL}, 715, "tcp"}, -{"iris-lwz", {NULL}, 715, "udp"}, -{"pana", {NULL}, 716, "udp"}, -{"netviewdm1", {NULL}, 729, "tcp"}, -{"netviewdm1", {NULL}, 729, "udp"}, -{"netviewdm2", {NULL}, 730, "tcp"}, -{"netviewdm2", {NULL}, 730, "udp"}, -{"netviewdm3", {NULL}, 731, "tcp"}, -{"netviewdm3", {NULL}, 731, "udp"}, -{"netgw", {NULL}, 741, "tcp"}, -{"netgw", {NULL}, 741, "udp"}, -{"netrcs", {NULL}, 742, "tcp"}, -{"netrcs", {NULL}, 742, "udp"}, -{"flexlm", {NULL}, 744, "tcp"}, -{"flexlm", {NULL}, 744, "udp"}, -{"fujitsu-dev", {NULL}, 747, "tcp"}, -{"fujitsu-dev", {NULL}, 747, "udp"}, -{"ris-cm", {NULL}, 748, "tcp"}, -{"ris-cm", {NULL}, 748, "udp"}, -{"kerberos-adm", {NULL}, 749, "tcp"}, -{"kerberos-adm", {NULL}, 749, "udp"}, -{"rfile", {NULL}, 750, "tcp"}, -{"loadav", {NULL}, 750, "udp"}, -{"kerberos-iv", {NULL}, 750, "udp"}, -{"pump", {NULL}, 751, "tcp"}, -{"pump", {NULL}, 751, "udp"}, -{"qrh", {NULL}, 752, "tcp"}, -{"qrh", {NULL}, 752, "udp"}, -{"rrh", {NULL}, 753, "tcp"}, -{"rrh", {NULL}, 753, "udp"}, -{"tell", {NULL}, 754, "tcp"}, -{"tell", {NULL}, 754, "udp"}, -{"nlogin", {NULL}, 758, "tcp"}, -{"nlogin", {NULL}, 758, "udp"}, -{"con", {NULL}, 759, "tcp"}, -{"con", {NULL}, 759, "udp"}, -{"ns", {NULL}, 760, "tcp"}, -{"ns", {NULL}, 760, "udp"}, -{"rxe", {NULL}, 761, "tcp"}, -{"rxe", {NULL}, 761, "udp"}, -{"quotad", {NULL}, 762, "tcp"}, -{"quotad", {NULL}, 762, "udp"}, -{"cycleserv", {NULL}, 763, "tcp"}, -{"cycleserv", {NULL}, 763, "udp"}, -{"omserv", {NULL}, 764, "tcp"}, -{"omserv", {NULL}, 764, "udp"}, -{"webster", {NULL}, 765, "tcp"}, -{"webster", {NULL}, 765, "udp"}, -{"phonebook", {NULL}, 767, "tcp"}, -{"phonebook", {NULL}, 767, "udp"}, -{"vid", {NULL}, 769, "tcp"}, -{"vid", {NULL}, 769, "udp"}, -{"cadlock", {NULL}, 770, "tcp"}, -{"cadlock", {NULL}, 770, "udp"}, -{"rtip", {NULL}, 771, "tcp"}, -{"rtip", {NULL}, 771, "udp"}, -{"cycleserv2", {NULL}, 772, "tcp"}, -{"cycleserv2", {NULL}, 772, "udp"}, -{"submit", {NULL}, 773, "tcp"}, -{"notify", {NULL}, 773, "udp"}, -{"rpasswd", {NULL}, 774, "tcp"}, -{"acmaint_dbd", {NULL}, 774, "udp"}, -{"entomb", {NULL}, 775, "tcp"}, -{"acmaint_transd", {NULL}, 775, "udp"}, -{"wpages", {NULL}, 776, "tcp"}, -{"wpages", {NULL}, 776, "udp"}, -{"multiling-http", {NULL}, 777, "tcp"}, -{"multiling-http", {NULL}, 777, "udp"}, -{"wpgs", {NULL}, 780, "tcp"}, -{"wpgs", {NULL}, 780, "udp"}, -{"mdbs_daemon", {NULL}, 800, "tcp"}, -{"mdbs_daemon", {NULL}, 800, "udp"}, -{"device", {NULL}, 801, "tcp"}, -{"device", {NULL}, 801, "udp"}, -{"fcp-udp", {NULL}, 810, "tcp"}, -{"fcp-udp", {NULL}, 810, "udp"}, -{"itm-mcell-s", {NULL}, 828, "tcp"}, -{"itm-mcell-s", {NULL}, 828, "udp"}, -{"pkix-3-ca-ra", {NULL}, 829, "tcp"}, -{"pkix-3-ca-ra", {NULL}, 829, "udp"}, -{"netconf-ssh", {NULL}, 830, "tcp"}, -{"netconf-ssh", {NULL}, 830, "udp"}, -{"netconf-beep", {NULL}, 831, "tcp"}, -{"netconf-beep", {NULL}, 831, "udp"}, -{"netconfsoaphttp", {NULL}, 832, "tcp"}, -{"netconfsoaphttp", {NULL}, 832, "udp"}, -{"netconfsoapbeep", {NULL}, 833, "tcp"}, -{"netconfsoapbeep", {NULL}, 833, "udp"}, -{"dhcp-failover2", {NULL}, 847, "tcp"}, -{"dhcp-failover2", {NULL}, 847, "udp"}, -{"gdoi", {NULL}, 848, "tcp"}, -{"gdoi", {NULL}, 848, "udp"}, -{"iscsi", {NULL}, 860, "tcp"}, -{"iscsi", {NULL}, 860, "udp"}, -{"owamp-control", {NULL}, 861, "tcp"}, -{"owamp-control", {NULL}, 861, "udp"}, -{"twamp-control", {NULL}, 862, "tcp"}, -{"twamp-control", {NULL}, 862, "udp"}, -{"rsync", {NULL}, 873, "tcp"}, -{"rsync", {NULL}, 873, "udp"}, -{"iclcnet-locate", {NULL}, 886, "tcp"}, -{"iclcnet-locate", {NULL}, 886, "udp"}, -{"iclcnet_svinfo", {NULL}, 887, "tcp"}, -{"iclcnet_svinfo", {NULL}, 887, "udp"}, -{"accessbuilder", {NULL}, 888, "tcp"}, -{"accessbuilder", {NULL}, 888, "udp"}, -{"cddbp", {NULL}, 888, "tcp"}, -{"omginitialrefs", {NULL}, 900, "tcp"}, -{"omginitialrefs", {NULL}, 900, "udp"}, -{"smpnameres", {NULL}, 901, "tcp"}, -{"smpnameres", {NULL}, 901, "udp"}, -{"ideafarm-door", {NULL}, 902, "tcp"}, -{"ideafarm-door", {NULL}, 902, "udp"}, -{"ideafarm-panic", {NULL}, 903, "tcp"}, -{"ideafarm-panic", {NULL}, 903, "udp"}, -{"kink", {NULL}, 910, "tcp"}, -{"kink", {NULL}, 910, "udp"}, -{"xact-backup", {NULL}, 911, "tcp"}, -{"xact-backup", {NULL}, 911, "udp"}, -{"apex-mesh", {NULL}, 912, "tcp"}, -{"apex-mesh", {NULL}, 912, "udp"}, -{"apex-edge", {NULL}, 913, "tcp"}, -{"apex-edge", {NULL}, 913, "udp"}, -{"ftps-data", {NULL}, 989, "tcp"}, -{"ftps-data", {NULL}, 989, "udp"}, -{"ftps", {NULL}, 990, "tcp"}, -{"ftps", {NULL}, 990, "udp"}, -{"nas", {NULL}, 991, "tcp"}, -{"nas", {NULL}, 991, "udp"}, -{"telnets", {NULL}, 992, "tcp"}, -{"telnets", {NULL}, 992, "udp"}, -{"imaps", {NULL}, 993, "tcp"}, -{"imaps", {NULL}, 993, "udp"}, -{"ircs", {NULL}, 994, "tcp"}, -{"ircs", {NULL}, 994, "udp"}, -{"pop3s", {NULL}, 995, "tcp"}, -{"pop3s", {NULL}, 995, "udp"}, -{"vsinet", {NULL}, 996, "tcp"}, -{"vsinet", {NULL}, 996, "udp"}, -{"maitrd", {NULL}, 997, "tcp"}, -{"maitrd", {NULL}, 997, "udp"}, -{"busboy", {NULL}, 998, "tcp"}, -{"puparp", {NULL}, 998, "udp"}, -{"garcon", {NULL}, 999, "tcp"}, -{"applix", {NULL}, 999, "udp"}, -{"puprouter", {NULL}, 999, "tcp"}, -{"puprouter", {NULL}, 999, "udp"}, -{"cadlock2", {NULL}, 1000, "tcp"}, -{"cadlock2", {NULL}, 1000, "udp"}, -{"surf", {NULL}, 1010, "tcp"}, -{"surf", {NULL}, 1010, "udp"}, -{"exp1", {NULL}, 1021, "tcp"}, -{"exp1", {NULL}, 1021, "udp"}, -{"exp2", {NULL}, 1022, "tcp"}, -{"exp2", {NULL}, 1022, "udp"}, -#endif /* USE_IANA_WELL_KNOWN_PORTS */ -#ifdef USE_IANA_REGISTERED_PORTS -{"blackjack", {NULL}, 1025, "tcp"}, -{"blackjack", {NULL}, 1025, "udp"}, -{"cap", {NULL}, 1026, "tcp"}, -{"cap", {NULL}, 1026, "udp"}, -{"solid-mux", {NULL}, 1029, "tcp"}, -{"solid-mux", {NULL}, 1029, "udp"}, -{"iad1", {NULL}, 1030, "tcp"}, -{"iad1", {NULL}, 1030, "udp"}, -{"iad2", {NULL}, 1031, "tcp"}, -{"iad2", {NULL}, 1031, "udp"}, -{"iad3", {NULL}, 1032, "tcp"}, -{"iad3", {NULL}, 1032, "udp"}, -{"netinfo-local", {NULL}, 1033, "tcp"}, -{"netinfo-local", {NULL}, 1033, "udp"}, -{"activesync", {NULL}, 1034, "tcp"}, -{"activesync", {NULL}, 1034, "udp"}, -{"mxxrlogin", {NULL}, 1035, "tcp"}, -{"mxxrlogin", {NULL}, 1035, "udp"}, -{"nsstp", {NULL}, 1036, "tcp"}, -{"nsstp", {NULL}, 1036, "udp"}, -{"ams", {NULL}, 1037, "tcp"}, -{"ams", {NULL}, 1037, "udp"}, -{"mtqp", {NULL}, 1038, "tcp"}, -{"mtqp", {NULL}, 1038, "udp"}, -{"sbl", {NULL}, 1039, "tcp"}, -{"sbl", {NULL}, 1039, "udp"}, -{"netarx", {NULL}, 1040, "tcp"}, -{"netarx", {NULL}, 1040, "udp"}, -{"danf-ak2", {NULL}, 1041, "tcp"}, -{"danf-ak2", {NULL}, 1041, "udp"}, -{"afrog", {NULL}, 1042, "tcp"}, -{"afrog", {NULL}, 1042, "udp"}, -{"boinc-client", {NULL}, 1043, "tcp"}, -{"boinc-client", {NULL}, 1043, "udp"}, -{"dcutility", {NULL}, 1044, "tcp"}, -{"dcutility", {NULL}, 1044, "udp"}, -{"fpitp", {NULL}, 1045, "tcp"}, -{"fpitp", {NULL}, 1045, "udp"}, -{"wfremotertm", {NULL}, 1046, "tcp"}, -{"wfremotertm", {NULL}, 1046, "udp"}, -{"neod1", {NULL}, 1047, "tcp"}, -{"neod1", {NULL}, 1047, "udp"}, -{"neod2", {NULL}, 1048, "tcp"}, -{"neod2", {NULL}, 1048, "udp"}, -{"td-postman", {NULL}, 1049, "tcp"}, -{"td-postman", {NULL}, 1049, "udp"}, -{"cma", {NULL}, 1050, "tcp"}, -{"cma", {NULL}, 1050, "udp"}, -{"optima-vnet", {NULL}, 1051, "tcp"}, -{"optima-vnet", {NULL}, 1051, "udp"}, -{"ddt", {NULL}, 1052, "tcp"}, -{"ddt", {NULL}, 1052, "udp"}, -{"remote-as", {NULL}, 1053, "tcp"}, -{"remote-as", {NULL}, 1053, "udp"}, -{"brvread", {NULL}, 1054, "tcp"}, -{"brvread", {NULL}, 1054, "udp"}, -{"ansyslmd", {NULL}, 1055, "tcp"}, -{"ansyslmd", {NULL}, 1055, "udp"}, -{"vfo", {NULL}, 1056, "tcp"}, -{"vfo", {NULL}, 1056, "udp"}, -{"startron", {NULL}, 1057, "tcp"}, -{"startron", {NULL}, 1057, "udp"}, -{"nim", {NULL}, 1058, "tcp"}, -{"nim", {NULL}, 1058, "udp"}, -{"nimreg", {NULL}, 1059, "tcp"}, -{"nimreg", {NULL}, 1059, "udp"}, -{"polestar", {NULL}, 1060, "tcp"}, -{"polestar", {NULL}, 1060, "udp"}, -{"kiosk", {NULL}, 1061, "tcp"}, -{"kiosk", {NULL}, 1061, "udp"}, -{"veracity", {NULL}, 1062, "tcp"}, -{"veracity", {NULL}, 1062, "udp"}, -{"kyoceranetdev", {NULL}, 1063, "tcp"}, -{"kyoceranetdev", {NULL}, 1063, "udp"}, -{"jstel", {NULL}, 1064, "tcp"}, -{"jstel", {NULL}, 1064, "udp"}, -{"syscomlan", {NULL}, 1065, "tcp"}, -{"syscomlan", {NULL}, 1065, "udp"}, -{"fpo-fns", {NULL}, 1066, "tcp"}, -{"fpo-fns", {NULL}, 1066, "udp"}, -{"instl_boots", {NULL}, 1067, "tcp"}, -{"instl_boots", {NULL}, 1067, "udp"}, -{"instl_bootc", {NULL}, 1068, "tcp"}, -{"instl_bootc", {NULL}, 1068, "udp"}, -{"cognex-insight", {NULL}, 1069, "tcp"}, -{"cognex-insight", {NULL}, 1069, "udp"}, -{"gmrupdateserv", {NULL}, 1070, "tcp"}, -{"gmrupdateserv", {NULL}, 1070, "udp"}, -{"bsquare-voip", {NULL}, 1071, "tcp"}, -{"bsquare-voip", {NULL}, 1071, "udp"}, -{"cardax", {NULL}, 1072, "tcp"}, -{"cardax", {NULL}, 1072, "udp"}, -{"bridgecontrol", {NULL}, 1073, "tcp"}, -{"bridgecontrol", {NULL}, 1073, "udp"}, -{"warmspotMgmt", {NULL}, 1074, "tcp"}, -{"warmspotMgmt", {NULL}, 1074, "udp"}, -{"rdrmshc", {NULL}, 1075, "tcp"}, -{"rdrmshc", {NULL}, 1075, "udp"}, -{"dab-sti-c", {NULL}, 1076, "tcp"}, -{"dab-sti-c", {NULL}, 1076, "udp"}, -{"imgames", {NULL}, 1077, "tcp"}, -{"imgames", {NULL}, 1077, "udp"}, -{"avocent-proxy", {NULL}, 1078, "tcp"}, -{"avocent-proxy", {NULL}, 1078, "udp"}, -{"asprovatalk", {NULL}, 1079, "tcp"}, -{"asprovatalk", {NULL}, 1079, "udp"}, -{"socks", {NULL}, 1080, "tcp"}, -{"socks", {NULL}, 1080, "udp"}, -{"pvuniwien", {NULL}, 1081, "tcp"}, -{"pvuniwien", {NULL}, 1081, "udp"}, -{"amt-esd-prot", {NULL}, 1082, "tcp"}, -{"amt-esd-prot", {NULL}, 1082, "udp"}, -{"ansoft-lm-1", {NULL}, 1083, "tcp"}, -{"ansoft-lm-1", {NULL}, 1083, "udp"}, -{"ansoft-lm-2", {NULL}, 1084, "tcp"}, -{"ansoft-lm-2", {NULL}, 1084, "udp"}, -{"webobjects", {NULL}, 1085, "tcp"}, -{"webobjects", {NULL}, 1085, "udp"}, -{"cplscrambler-lg", {NULL}, 1086, "tcp"}, -{"cplscrambler-lg", {NULL}, 1086, "udp"}, -{"cplscrambler-in", {NULL}, 1087, "tcp"}, -{"cplscrambler-in", {NULL}, 1087, "udp"}, -{"cplscrambler-al", {NULL}, 1088, "tcp"}, -{"cplscrambler-al", {NULL}, 1088, "udp"}, -{"ff-annunc", {NULL}, 1089, "tcp"}, -{"ff-annunc", {NULL}, 1089, "udp"}, -{"ff-fms", {NULL}, 1090, "tcp"}, -{"ff-fms", {NULL}, 1090, "udp"}, -{"ff-sm", {NULL}, 1091, "tcp"}, -{"ff-sm", {NULL}, 1091, "udp"}, -{"obrpd", {NULL}, 1092, "tcp"}, -{"obrpd", {NULL}, 1092, "udp"}, -{"proofd", {NULL}, 1093, "tcp"}, -{"proofd", {NULL}, 1093, "udp"}, -{"rootd", {NULL}, 1094, "tcp"}, -{"rootd", {NULL}, 1094, "udp"}, -{"nicelink", {NULL}, 1095, "tcp"}, -{"nicelink", {NULL}, 1095, "udp"}, -{"cnrprotocol", {NULL}, 1096, "tcp"}, -{"cnrprotocol", {NULL}, 1096, "udp"}, -{"sunclustermgr", {NULL}, 1097, "tcp"}, -{"sunclustermgr", {NULL}, 1097, "udp"}, -{"rmiactivation", {NULL}, 1098, "tcp"}, -{"rmiactivation", {NULL}, 1098, "udp"}, -{"rmiregistry", {NULL}, 1099, "tcp"}, -{"rmiregistry", {NULL}, 1099, "udp"}, -{"mctp", {NULL}, 1100, "tcp"}, -{"mctp", {NULL}, 1100, "udp"}, -{"pt2-discover", {NULL}, 1101, "tcp"}, -{"pt2-discover", {NULL}, 1101, "udp"}, -{"adobeserver-1", {NULL}, 1102, "tcp"}, -{"adobeserver-1", {NULL}, 1102, "udp"}, -{"adobeserver-2", {NULL}, 1103, "tcp"}, -{"adobeserver-2", {NULL}, 1103, "udp"}, -{"xrl", {NULL}, 1104, "tcp"}, -{"xrl", {NULL}, 1104, "udp"}, -{"ftranhc", {NULL}, 1105, "tcp"}, -{"ftranhc", {NULL}, 1105, "udp"}, -{"isoipsigport-1", {NULL}, 1106, "tcp"}, -{"isoipsigport-1", {NULL}, 1106, "udp"}, -{"isoipsigport-2", {NULL}, 1107, "tcp"}, -{"isoipsigport-2", {NULL}, 1107, "udp"}, -{"ratio-adp", {NULL}, 1108, "tcp"}, -{"ratio-adp", {NULL}, 1108, "udp"}, -{"webadmstart", {NULL}, 1110, "tcp"}, -{"nfsd-keepalive", {NULL}, 1110, "udp"}, -{"lmsocialserver", {NULL}, 1111, "tcp"}, -{"lmsocialserver", {NULL}, 1111, "udp"}, -{"icp", {NULL}, 1112, "tcp"}, -{"icp", {NULL}, 1112, "udp"}, -{"ltp-deepspace", {NULL}, 1113, "tcp"}, -{"ltp-deepspace", {NULL}, 1113, "udp"}, -{"mini-sql", {NULL}, 1114, "tcp"}, -{"mini-sql", {NULL}, 1114, "udp"}, -{"ardus-trns", {NULL}, 1115, "tcp"}, -{"ardus-trns", {NULL}, 1115, "udp"}, -{"ardus-cntl", {NULL}, 1116, "tcp"}, -{"ardus-cntl", {NULL}, 1116, "udp"}, -{"ardus-mtrns", {NULL}, 1117, "tcp"}, -{"ardus-mtrns", {NULL}, 1117, "udp"}, -{"sacred", {NULL}, 1118, "tcp"}, -{"sacred", {NULL}, 1118, "udp"}, -{"bnetgame", {NULL}, 1119, "tcp"}, -{"bnetgame", {NULL}, 1119, "udp"}, -{"bnetfile", {NULL}, 1120, "tcp"}, -{"bnetfile", {NULL}, 1120, "udp"}, -{"rmpp", {NULL}, 1121, "tcp"}, -{"rmpp", {NULL}, 1121, "udp"}, -{"availant-mgr", {NULL}, 1122, "tcp"}, -{"availant-mgr", {NULL}, 1122, "udp"}, -{"murray", {NULL}, 1123, "tcp"}, -{"murray", {NULL}, 1123, "udp"}, -{"hpvmmcontrol", {NULL}, 1124, "tcp"}, -{"hpvmmcontrol", {NULL}, 1124, "udp"}, -{"hpvmmagent", {NULL}, 1125, "tcp"}, -{"hpvmmagent", {NULL}, 1125, "udp"}, -{"hpvmmdata", {NULL}, 1126, "tcp"}, -{"hpvmmdata", {NULL}, 1126, "udp"}, -{"kwdb-commn", {NULL}, 1127, "tcp"}, -{"kwdb-commn", {NULL}, 1127, "udp"}, -{"saphostctrl", {NULL}, 1128, "tcp"}, -{"saphostctrl", {NULL}, 1128, "udp"}, -{"saphostctrls", {NULL}, 1129, "tcp"}, -{"saphostctrls", {NULL}, 1129, "udp"}, -{"casp", {NULL}, 1130, "tcp"}, -{"casp", {NULL}, 1130, "udp"}, -{"caspssl", {NULL}, 1131, "tcp"}, -{"caspssl", {NULL}, 1131, "udp"}, -{"kvm-via-ip", {NULL}, 1132, "tcp"}, -{"kvm-via-ip", {NULL}, 1132, "udp"}, -{"dfn", {NULL}, 1133, "tcp"}, -{"dfn", {NULL}, 1133, "udp"}, -{"aplx", {NULL}, 1134, "tcp"}, -{"aplx", {NULL}, 1134, "udp"}, -{"omnivision", {NULL}, 1135, "tcp"}, -{"omnivision", {NULL}, 1135, "udp"}, -{"hhb-gateway", {NULL}, 1136, "tcp"}, -{"hhb-gateway", {NULL}, 1136, "udp"}, -{"trim", {NULL}, 1137, "tcp"}, -{"trim", {NULL}, 1137, "udp"}, -{"encrypted_admin", {NULL}, 1138, "tcp"}, -{"encrypted_admin", {NULL}, 1138, "udp"}, -{"evm", {NULL}, 1139, "tcp"}, -{"evm", {NULL}, 1139, "udp"}, -{"autonoc", {NULL}, 1140, "tcp"}, -{"autonoc", {NULL}, 1140, "udp"}, -{"mxomss", {NULL}, 1141, "tcp"}, -{"mxomss", {NULL}, 1141, "udp"}, -{"edtools", {NULL}, 1142, "tcp"}, -{"edtools", {NULL}, 1142, "udp"}, -{"imyx", {NULL}, 1143, "tcp"}, -{"imyx", {NULL}, 1143, "udp"}, -{"fuscript", {NULL}, 1144, "tcp"}, -{"fuscript", {NULL}, 1144, "udp"}, -{"x9-icue", {NULL}, 1145, "tcp"}, -{"x9-icue", {NULL}, 1145, "udp"}, -{"audit-transfer", {NULL}, 1146, "tcp"}, -{"audit-transfer", {NULL}, 1146, "udp"}, -{"capioverlan", {NULL}, 1147, "tcp"}, -{"capioverlan", {NULL}, 1147, "udp"}, -{"elfiq-repl", {NULL}, 1148, "tcp"}, -{"elfiq-repl", {NULL}, 1148, "udp"}, -{"bvtsonar", {NULL}, 1149, "tcp"}, -{"bvtsonar", {NULL}, 1149, "udp"}, -{"blaze", {NULL}, 1150, "tcp"}, -{"blaze", {NULL}, 1150, "udp"}, -{"unizensus", {NULL}, 1151, "tcp"}, -{"unizensus", {NULL}, 1151, "udp"}, -{"winpoplanmess", {NULL}, 1152, "tcp"}, -{"winpoplanmess", {NULL}, 1152, "udp"}, -{"c1222-acse", {NULL}, 1153, "tcp"}, -{"c1222-acse", {NULL}, 1153, "udp"}, -{"resacommunity", {NULL}, 1154, "tcp"}, -{"resacommunity", {NULL}, 1154, "udp"}, -{"nfa", {NULL}, 1155, "tcp"}, -{"nfa", {NULL}, 1155, "udp"}, -{"iascontrol-oms", {NULL}, 1156, "tcp"}, -{"iascontrol-oms", {NULL}, 1156, "udp"}, -{"iascontrol", {NULL}, 1157, "tcp"}, -{"iascontrol", {NULL}, 1157, "udp"}, -{"dbcontrol-oms", {NULL}, 1158, "tcp"}, -{"dbcontrol-oms", {NULL}, 1158, "udp"}, -{"oracle-oms", {NULL}, 1159, "tcp"}, -{"oracle-oms", {NULL}, 1159, "udp"}, -{"olsv", {NULL}, 1160, "tcp"}, -{"olsv", {NULL}, 1160, "udp"}, -{"health-polling", {NULL}, 1161, "tcp"}, -{"health-polling", {NULL}, 1161, "udp"}, -{"health-trap", {NULL}, 1162, "tcp"}, -{"health-trap", {NULL}, 1162, "udp"}, -{"sddp", {NULL}, 1163, "tcp"}, -{"sddp", {NULL}, 1163, "udp"}, -{"qsm-proxy", {NULL}, 1164, "tcp"}, -{"qsm-proxy", {NULL}, 1164, "udp"}, -{"qsm-gui", {NULL}, 1165, "tcp"}, -{"qsm-gui", {NULL}, 1165, "udp"}, -{"qsm-remote", {NULL}, 1166, "tcp"}, -{"qsm-remote", {NULL}, 1166, "udp"}, -{"cisco-ipsla", {NULL}, 1167, "tcp"}, -{"cisco-ipsla", {NULL}, 1167, "udp"}, -{"cisco-ipsla", {NULL}, 1167, "sctp"}, -{"vchat", {NULL}, 1168, "tcp"}, -{"vchat", {NULL}, 1168, "udp"}, -{"tripwire", {NULL}, 1169, "tcp"}, -{"tripwire", {NULL}, 1169, "udp"}, -{"atc-lm", {NULL}, 1170, "tcp"}, -{"atc-lm", {NULL}, 1170, "udp"}, -{"atc-appserver", {NULL}, 1171, "tcp"}, -{"atc-appserver", {NULL}, 1171, "udp"}, -{"dnap", {NULL}, 1172, "tcp"}, -{"dnap", {NULL}, 1172, "udp"}, -{"d-cinema-rrp", {NULL}, 1173, "tcp"}, -{"d-cinema-rrp", {NULL}, 1173, "udp"}, -{"fnet-remote-ui", {NULL}, 1174, "tcp"}, -{"fnet-remote-ui", {NULL}, 1174, "udp"}, -{"dossier", {NULL}, 1175, "tcp"}, -{"dossier", {NULL}, 1175, "udp"}, -{"indigo-server", {NULL}, 1176, "tcp"}, -{"indigo-server", {NULL}, 1176, "udp"}, -{"dkmessenger", {NULL}, 1177, "tcp"}, -{"dkmessenger", {NULL}, 1177, "udp"}, -{"sgi-storman", {NULL}, 1178, "tcp"}, -{"sgi-storman", {NULL}, 1178, "udp"}, -{"b2n", {NULL}, 1179, "tcp"}, -{"b2n", {NULL}, 1179, "udp"}, -{"mc-client", {NULL}, 1180, "tcp"}, -{"mc-client", {NULL}, 1180, "udp"}, -{"3comnetman", {NULL}, 1181, "tcp"}, -{"3comnetman", {NULL}, 1181, "udp"}, -{"accelenet", {NULL}, 1182, "tcp"}, -{"accelenet-data", {NULL}, 1182, "udp"}, -{"llsurfup-http", {NULL}, 1183, "tcp"}, -{"llsurfup-http", {NULL}, 1183, "udp"}, -{"llsurfup-https", {NULL}, 1184, "tcp"}, -{"llsurfup-https", {NULL}, 1184, "udp"}, -{"catchpole", {NULL}, 1185, "tcp"}, -{"catchpole", {NULL}, 1185, "udp"}, -{"mysql-cluster", {NULL}, 1186, "tcp"}, -{"mysql-cluster", {NULL}, 1186, "udp"}, -{"alias", {NULL}, 1187, "tcp"}, -{"alias", {NULL}, 1187, "udp"}, -{"hp-webadmin", {NULL}, 1188, "tcp"}, -{"hp-webadmin", {NULL}, 1188, "udp"}, -{"unet", {NULL}, 1189, "tcp"}, -{"unet", {NULL}, 1189, "udp"}, -{"commlinx-avl", {NULL}, 1190, "tcp"}, -{"commlinx-avl", {NULL}, 1190, "udp"}, -{"gpfs", {NULL}, 1191, "tcp"}, -{"gpfs", {NULL}, 1191, "udp"}, -{"caids-sensor", {NULL}, 1192, "tcp"}, -{"caids-sensor", {NULL}, 1192, "udp"}, -{"fiveacross", {NULL}, 1193, "tcp"}, -{"fiveacross", {NULL}, 1193, "udp"}, -{"openvpn", {NULL}, 1194, "tcp"}, -{"openvpn", {NULL}, 1194, "udp"}, -{"rsf-1", {NULL}, 1195, "tcp"}, -{"rsf-1", {NULL}, 1195, "udp"}, -{"netmagic", {NULL}, 1196, "tcp"}, -{"netmagic", {NULL}, 1196, "udp"}, -{"carrius-rshell", {NULL}, 1197, "tcp"}, -{"carrius-rshell", {NULL}, 1197, "udp"}, -{"cajo-discovery", {NULL}, 1198, "tcp"}, -{"cajo-discovery", {NULL}, 1198, "udp"}, -{"dmidi", {NULL}, 1199, "tcp"}, -{"dmidi", {NULL}, 1199, "udp"}, -{"scol", {NULL}, 1200, "tcp"}, -{"scol", {NULL}, 1200, "udp"}, -{"nucleus-sand", {NULL}, 1201, "tcp"}, -{"nucleus-sand", {NULL}, 1201, "udp"}, -{"caiccipc", {NULL}, 1202, "tcp"}, -{"caiccipc", {NULL}, 1202, "udp"}, -{"ssslic-mgr", {NULL}, 1203, "tcp"}, -{"ssslic-mgr", {NULL}, 1203, "udp"}, -{"ssslog-mgr", {NULL}, 1204, "tcp"}, -{"ssslog-mgr", {NULL}, 1204, "udp"}, -{"accord-mgc", {NULL}, 1205, "tcp"}, -{"accord-mgc", {NULL}, 1205, "udp"}, -{"anthony-data", {NULL}, 1206, "tcp"}, -{"anthony-data", {NULL}, 1206, "udp"}, -{"metasage", {NULL}, 1207, "tcp"}, -{"metasage", {NULL}, 1207, "udp"}, -{"seagull-ais", {NULL}, 1208, "tcp"}, -{"seagull-ais", {NULL}, 1208, "udp"}, -{"ipcd3", {NULL}, 1209, "tcp"}, -{"ipcd3", {NULL}, 1209, "udp"}, -{"eoss", {NULL}, 1210, "tcp"}, -{"eoss", {NULL}, 1210, "udp"}, -{"groove-dpp", {NULL}, 1211, "tcp"}, -{"groove-dpp", {NULL}, 1211, "udp"}, -{"lupa", {NULL}, 1212, "tcp"}, -{"lupa", {NULL}, 1212, "udp"}, -{"mpc-lifenet", {NULL}, 1213, "tcp"}, -{"mpc-lifenet", {NULL}, 1213, "udp"}, -{"kazaa", {NULL}, 1214, "tcp"}, -{"kazaa", {NULL}, 1214, "udp"}, -{"scanstat-1", {NULL}, 1215, "tcp"}, -{"scanstat-1", {NULL}, 1215, "udp"}, -{"etebac5", {NULL}, 1216, "tcp"}, -{"etebac5", {NULL}, 1216, "udp"}, -{"hpss-ndapi", {NULL}, 1217, "tcp"}, -{"hpss-ndapi", {NULL}, 1217, "udp"}, -{"aeroflight-ads", {NULL}, 1218, "tcp"}, -{"aeroflight-ads", {NULL}, 1218, "udp"}, -{"aeroflight-ret", {NULL}, 1219, "tcp"}, -{"aeroflight-ret", {NULL}, 1219, "udp"}, -{"qt-serveradmin", {NULL}, 1220, "tcp"}, -{"qt-serveradmin", {NULL}, 1220, "udp"}, -{"sweetware-apps", {NULL}, 1221, "tcp"}, -{"sweetware-apps", {NULL}, 1221, "udp"}, -{"nerv", {NULL}, 1222, "tcp"}, -{"nerv", {NULL}, 1222, "udp"}, -{"tgp", {NULL}, 1223, "tcp"}, -{"tgp", {NULL}, 1223, "udp"}, -{"vpnz", {NULL}, 1224, "tcp"}, -{"vpnz", {NULL}, 1224, "udp"}, -{"slinkysearch", {NULL}, 1225, "tcp"}, -{"slinkysearch", {NULL}, 1225, "udp"}, -{"stgxfws", {NULL}, 1226, "tcp"}, -{"stgxfws", {NULL}, 1226, "udp"}, -{"dns2go", {NULL}, 1227, "tcp"}, -{"dns2go", {NULL}, 1227, "udp"}, -{"florence", {NULL}, 1228, "tcp"}, -{"florence", {NULL}, 1228, "udp"}, -{"zented", {NULL}, 1229, "tcp"}, -{"zented", {NULL}, 1229, "udp"}, -{"periscope", {NULL}, 1230, "tcp"}, -{"periscope", {NULL}, 1230, "udp"}, -{"menandmice-lpm", {NULL}, 1231, "tcp"}, -{"menandmice-lpm", {NULL}, 1231, "udp"}, -{"univ-appserver", {NULL}, 1233, "tcp"}, -{"univ-appserver", {NULL}, 1233, "udp"}, -{"search-agent", {NULL}, 1234, "tcp"}, -{"search-agent", {NULL}, 1234, "udp"}, -{"mosaicsyssvc1", {NULL}, 1235, "tcp"}, -{"mosaicsyssvc1", {NULL}, 1235, "udp"}, -{"bvcontrol", {NULL}, 1236, "tcp"}, -{"bvcontrol", {NULL}, 1236, "udp"}, -{"tsdos390", {NULL}, 1237, "tcp"}, -{"tsdos390", {NULL}, 1237, "udp"}, -{"hacl-qs", {NULL}, 1238, "tcp"}, -{"hacl-qs", {NULL}, 1238, "udp"}, -{"nmsd", {NULL}, 1239, "tcp"}, -{"nmsd", {NULL}, 1239, "udp"}, -{"instantia", {NULL}, 1240, "tcp"}, -{"instantia", {NULL}, 1240, "udp"}, -{"nessus", {NULL}, 1241, "tcp"}, -{"nessus", {NULL}, 1241, "udp"}, -{"nmasoverip", {NULL}, 1242, "tcp"}, -{"nmasoverip", {NULL}, 1242, "udp"}, -{"serialgateway", {NULL}, 1243, "tcp"}, -{"serialgateway", {NULL}, 1243, "udp"}, -{"isbconference1", {NULL}, 1244, "tcp"}, -{"isbconference1", {NULL}, 1244, "udp"}, -{"isbconference2", {NULL}, 1245, "tcp"}, -{"isbconference2", {NULL}, 1245, "udp"}, -{"payrouter", {NULL}, 1246, "tcp"}, -{"payrouter", {NULL}, 1246, "udp"}, -{"visionpyramid", {NULL}, 1247, "tcp"}, -{"visionpyramid", {NULL}, 1247, "udp"}, -{"hermes", {NULL}, 1248, "tcp"}, -{"hermes", {NULL}, 1248, "udp"}, -{"mesavistaco", {NULL}, 1249, "tcp"}, -{"mesavistaco", {NULL}, 1249, "udp"}, -{"swldy-sias", {NULL}, 1250, "tcp"}, -{"swldy-sias", {NULL}, 1250, "udp"}, -{"servergraph", {NULL}, 1251, "tcp"}, -{"servergraph", {NULL}, 1251, "udp"}, -{"bspne-pcc", {NULL}, 1252, "tcp"}, -{"bspne-pcc", {NULL}, 1252, "udp"}, -{"q55-pcc", {NULL}, 1253, "tcp"}, -{"q55-pcc", {NULL}, 1253, "udp"}, -{"de-noc", {NULL}, 1254, "tcp"}, -{"de-noc", {NULL}, 1254, "udp"}, -{"de-cache-query", {NULL}, 1255, "tcp"}, -{"de-cache-query", {NULL}, 1255, "udp"}, -{"de-server", {NULL}, 1256, "tcp"}, -{"de-server", {NULL}, 1256, "udp"}, -{"shockwave2", {NULL}, 1257, "tcp"}, -{"shockwave2", {NULL}, 1257, "udp"}, -{"opennl", {NULL}, 1258, "tcp"}, -{"opennl", {NULL}, 1258, "udp"}, -{"opennl-voice", {NULL}, 1259, "tcp"}, -{"opennl-voice", {NULL}, 1259, "udp"}, -{"ibm-ssd", {NULL}, 1260, "tcp"}, -{"ibm-ssd", {NULL}, 1260, "udp"}, -{"mpshrsv", {NULL}, 1261, "tcp"}, -{"mpshrsv", {NULL}, 1261, "udp"}, -{"qnts-orb", {NULL}, 1262, "tcp"}, -{"qnts-orb", {NULL}, 1262, "udp"}, -{"dka", {NULL}, 1263, "tcp"}, -{"dka", {NULL}, 1263, "udp"}, -{"prat", {NULL}, 1264, "tcp"}, -{"prat", {NULL}, 1264, "udp"}, -{"dssiapi", {NULL}, 1265, "tcp"}, -{"dssiapi", {NULL}, 1265, "udp"}, -{"dellpwrappks", {NULL}, 1266, "tcp"}, -{"dellpwrappks", {NULL}, 1266, "udp"}, -{"epc", {NULL}, 1267, "tcp"}, -{"epc", {NULL}, 1267, "udp"}, -{"propel-msgsys", {NULL}, 1268, "tcp"}, -{"propel-msgsys", {NULL}, 1268, "udp"}, -{"watilapp", {NULL}, 1269, "tcp"}, -{"watilapp", {NULL}, 1269, "udp"}, -{"opsmgr", {NULL}, 1270, "tcp"}, -{"opsmgr", {NULL}, 1270, "udp"}, -{"excw", {NULL}, 1271, "tcp"}, -{"excw", {NULL}, 1271, "udp"}, -{"cspmlockmgr", {NULL}, 1272, "tcp"}, -{"cspmlockmgr", {NULL}, 1272, "udp"}, -{"emc-gateway", {NULL}, 1273, "tcp"}, -{"emc-gateway", {NULL}, 1273, "udp"}, -{"t1distproc", {NULL}, 1274, "tcp"}, -{"t1distproc", {NULL}, 1274, "udp"}, -{"ivcollector", {NULL}, 1275, "tcp"}, -{"ivcollector", {NULL}, 1275, "udp"}, -{"ivmanager", {NULL}, 1276, "tcp"}, -{"ivmanager", {NULL}, 1276, "udp"}, -{"miva-mqs", {NULL}, 1277, "tcp"}, -{"miva-mqs", {NULL}, 1277, "udp"}, -{"dellwebadmin-1", {NULL}, 1278, "tcp"}, -{"dellwebadmin-1", {NULL}, 1278, "udp"}, -{"dellwebadmin-2", {NULL}, 1279, "tcp"}, -{"dellwebadmin-2", {NULL}, 1279, "udp"}, -{"pictrography", {NULL}, 1280, "tcp"}, -{"pictrography", {NULL}, 1280, "udp"}, -{"healthd", {NULL}, 1281, "tcp"}, -{"healthd", {NULL}, 1281, "udp"}, -{"emperion", {NULL}, 1282, "tcp"}, -{"emperion", {NULL}, 1282, "udp"}, -{"productinfo", {NULL}, 1283, "tcp"}, -{"productinfo", {NULL}, 1283, "udp"}, -{"iee-qfx", {NULL}, 1284, "tcp"}, -{"iee-qfx", {NULL}, 1284, "udp"}, -{"neoiface", {NULL}, 1285, "tcp"}, -{"neoiface", {NULL}, 1285, "udp"}, -{"netuitive", {NULL}, 1286, "tcp"}, -{"netuitive", {NULL}, 1286, "udp"}, -{"routematch", {NULL}, 1287, "tcp"}, -{"routematch", {NULL}, 1287, "udp"}, -{"navbuddy", {NULL}, 1288, "tcp"}, -{"navbuddy", {NULL}, 1288, "udp"}, -{"jwalkserver", {NULL}, 1289, "tcp"}, -{"jwalkserver", {NULL}, 1289, "udp"}, -{"winjaserver", {NULL}, 1290, "tcp"}, -{"winjaserver", {NULL}, 1290, "udp"}, -{"seagulllms", {NULL}, 1291, "tcp"}, -{"seagulllms", {NULL}, 1291, "udp"}, -{"dsdn", {NULL}, 1292, "tcp"}, -{"dsdn", {NULL}, 1292, "udp"}, -{"pkt-krb-ipsec", {NULL}, 1293, "tcp"}, -{"pkt-krb-ipsec", {NULL}, 1293, "udp"}, -{"cmmdriver", {NULL}, 1294, "tcp"}, -{"cmmdriver", {NULL}, 1294, "udp"}, -{"ehtp", {NULL}, 1295, "tcp"}, -{"ehtp", {NULL}, 1295, "udp"}, -{"dproxy", {NULL}, 1296, "tcp"}, -{"dproxy", {NULL}, 1296, "udp"}, -{"sdproxy", {NULL}, 1297, "tcp"}, -{"sdproxy", {NULL}, 1297, "udp"}, -{"lpcp", {NULL}, 1298, "tcp"}, -{"lpcp", {NULL}, 1298, "udp"}, -{"hp-sci", {NULL}, 1299, "tcp"}, -{"hp-sci", {NULL}, 1299, "udp"}, -{"h323hostcallsc", {NULL}, 1300, "tcp"}, -{"h323hostcallsc", {NULL}, 1300, "udp"}, -{"ci3-software-1", {NULL}, 1301, "tcp"}, -{"ci3-software-1", {NULL}, 1301, "udp"}, -{"ci3-software-2", {NULL}, 1302, "tcp"}, -{"ci3-software-2", {NULL}, 1302, "udp"}, -{"sftsrv", {NULL}, 1303, "tcp"}, -{"sftsrv", {NULL}, 1303, "udp"}, -{"boomerang", {NULL}, 1304, "tcp"}, -{"boomerang", {NULL}, 1304, "udp"}, -{"pe-mike", {NULL}, 1305, "tcp"}, -{"pe-mike", {NULL}, 1305, "udp"}, -{"re-conn-proto", {NULL}, 1306, "tcp"}, -{"re-conn-proto", {NULL}, 1306, "udp"}, -{"pacmand", {NULL}, 1307, "tcp"}, -{"pacmand", {NULL}, 1307, "udp"}, -{"odsi", {NULL}, 1308, "tcp"}, -{"odsi", {NULL}, 1308, "udp"}, -{"jtag-server", {NULL}, 1309, "tcp"}, -{"jtag-server", {NULL}, 1309, "udp"}, -{"husky", {NULL}, 1310, "tcp"}, -{"husky", {NULL}, 1310, "udp"}, -{"rxmon", {NULL}, 1311, "tcp"}, -{"rxmon", {NULL}, 1311, "udp"}, -{"sti-envision", {NULL}, 1312, "tcp"}, -{"sti-envision", {NULL}, 1312, "udp"}, -{"bmc_patroldb", {NULL}, 1313, "tcp"}, -{"bmc_patroldb", {NULL}, 1313, "udp"}, -{"pdps", {NULL}, 1314, "tcp"}, -{"pdps", {NULL}, 1314, "udp"}, -{"els", {NULL}, 1315, "tcp"}, -{"els", {NULL}, 1315, "udp"}, -{"exbit-escp", {NULL}, 1316, "tcp"}, -{"exbit-escp", {NULL}, 1316, "udp"}, -{"vrts-ipcserver", {NULL}, 1317, "tcp"}, -{"vrts-ipcserver", {NULL}, 1317, "udp"}, -{"krb5gatekeeper", {NULL}, 1318, "tcp"}, -{"krb5gatekeeper", {NULL}, 1318, "udp"}, -{"amx-icsp", {NULL}, 1319, "tcp"}, -{"amx-icsp", {NULL}, 1319, "udp"}, -{"amx-axbnet", {NULL}, 1320, "tcp"}, -{"amx-axbnet", {NULL}, 1320, "udp"}, -{"pip", {NULL}, 1321, "tcp"}, -{"pip", {NULL}, 1321, "udp"}, -{"novation", {NULL}, 1322, "tcp"}, -{"novation", {NULL}, 1322, "udp"}, -{"brcd", {NULL}, 1323, "tcp"}, -{"brcd", {NULL}, 1323, "udp"}, -{"delta-mcp", {NULL}, 1324, "tcp"}, -{"delta-mcp", {NULL}, 1324, "udp"}, -{"dx-instrument", {NULL}, 1325, "tcp"}, -{"dx-instrument", {NULL}, 1325, "udp"}, -{"wimsic", {NULL}, 1326, "tcp"}, -{"wimsic", {NULL}, 1326, "udp"}, -{"ultrex", {NULL}, 1327, "tcp"}, -{"ultrex", {NULL}, 1327, "udp"}, -{"ewall", {NULL}, 1328, "tcp"}, -{"ewall", {NULL}, 1328, "udp"}, -{"netdb-export", {NULL}, 1329, "tcp"}, -{"netdb-export", {NULL}, 1329, "udp"}, -{"streetperfect", {NULL}, 1330, "tcp"}, -{"streetperfect", {NULL}, 1330, "udp"}, -{"intersan", {NULL}, 1331, "tcp"}, -{"intersan", {NULL}, 1331, "udp"}, -{"pcia-rxp-b", {NULL}, 1332, "tcp"}, -{"pcia-rxp-b", {NULL}, 1332, "udp"}, -{"passwrd-policy", {NULL}, 1333, "tcp"}, -{"passwrd-policy", {NULL}, 1333, "udp"}, -{"writesrv", {NULL}, 1334, "tcp"}, -{"writesrv", {NULL}, 1334, "udp"}, -{"digital-notary", {NULL}, 1335, "tcp"}, -{"digital-notary", {NULL}, 1335, "udp"}, -{"ischat", {NULL}, 1336, "tcp"}, -{"ischat", {NULL}, 1336, "udp"}, -{"menandmice-dns", {NULL}, 1337, "tcp"}, -{"menandmice-dns", {NULL}, 1337, "udp"}, -{"wmc-log-svc", {NULL}, 1338, "tcp"}, -{"wmc-log-svc", {NULL}, 1338, "udp"}, -{"kjtsiteserver", {NULL}, 1339, "tcp"}, -{"kjtsiteserver", {NULL}, 1339, "udp"}, -{"naap", {NULL}, 1340, "tcp"}, -{"naap", {NULL}, 1340, "udp"}, -{"qubes", {NULL}, 1341, "tcp"}, -{"qubes", {NULL}, 1341, "udp"}, -{"esbroker", {NULL}, 1342, "tcp"}, -{"esbroker", {NULL}, 1342, "udp"}, -{"re101", {NULL}, 1343, "tcp"}, -{"re101", {NULL}, 1343, "udp"}, -{"icap", {NULL}, 1344, "tcp"}, -{"icap", {NULL}, 1344, "udp"}, -{"vpjp", {NULL}, 1345, "tcp"}, -{"vpjp", {NULL}, 1345, "udp"}, -{"alta-ana-lm", {NULL}, 1346, "tcp"}, -{"alta-ana-lm", {NULL}, 1346, "udp"}, -{"bbn-mmc", {NULL}, 1347, "tcp"}, -{"bbn-mmc", {NULL}, 1347, "udp"}, -{"bbn-mmx", {NULL}, 1348, "tcp"}, -{"bbn-mmx", {NULL}, 1348, "udp"}, -{"sbook", {NULL}, 1349, "tcp"}, -{"sbook", {NULL}, 1349, "udp"}, -{"editbench", {NULL}, 1350, "tcp"}, -{"editbench", {NULL}, 1350, "udp"}, -{"equationbuilder", {NULL}, 1351, "tcp"}, -{"equationbuilder", {NULL}, 1351, "udp"}, -{"lotusnote", {NULL}, 1352, "tcp"}, -{"lotusnote", {NULL}, 1352, "udp"}, -{"relief", {NULL}, 1353, "tcp"}, -{"relief", {NULL}, 1353, "udp"}, -{"XSIP-network", {NULL}, 1354, "tcp"}, -{"XSIP-network", {NULL}, 1354, "udp"}, -{"intuitive-edge", {NULL}, 1355, "tcp"}, -{"intuitive-edge", {NULL}, 1355, "udp"}, -{"cuillamartin", {NULL}, 1356, "tcp"}, -{"cuillamartin", {NULL}, 1356, "udp"}, -{"pegboard", {NULL}, 1357, "tcp"}, -{"pegboard", {NULL}, 1357, "udp"}, -{"connlcli", {NULL}, 1358, "tcp"}, -{"connlcli", {NULL}, 1358, "udp"}, -{"ftsrv", {NULL}, 1359, "tcp"}, -{"ftsrv", {NULL}, 1359, "udp"}, -{"mimer", {NULL}, 1360, "tcp"}, -{"mimer", {NULL}, 1360, "udp"}, -{"linx", {NULL}, 1361, "tcp"}, -{"linx", {NULL}, 1361, "udp"}, -{"timeflies", {NULL}, 1362, "tcp"}, -{"timeflies", {NULL}, 1362, "udp"}, -{"ndm-requester", {NULL}, 1363, "tcp"}, -{"ndm-requester", {NULL}, 1363, "udp"}, -{"ndm-server", {NULL}, 1364, "tcp"}, -{"ndm-server", {NULL}, 1364, "udp"}, -{"adapt-sna", {NULL}, 1365, "tcp"}, -{"adapt-sna", {NULL}, 1365, "udp"}, -{"netware-csp", {NULL}, 1366, "tcp"}, -{"netware-csp", {NULL}, 1366, "udp"}, -{"dcs", {NULL}, 1367, "tcp"}, -{"dcs", {NULL}, 1367, "udp"}, -{"screencast", {NULL}, 1368, "tcp"}, -{"screencast", {NULL}, 1368, "udp"}, -{"gv-us", {NULL}, 1369, "tcp"}, -{"gv-us", {NULL}, 1369, "udp"}, -{"us-gv", {NULL}, 1370, "tcp"}, -{"us-gv", {NULL}, 1370, "udp"}, -{"fc-cli", {NULL}, 1371, "tcp"}, -{"fc-cli", {NULL}, 1371, "udp"}, -{"fc-ser", {NULL}, 1372, "tcp"}, -{"fc-ser", {NULL}, 1372, "udp"}, -{"chromagrafx", {NULL}, 1373, "tcp"}, -{"chromagrafx", {NULL}, 1373, "udp"}, -{"molly", {NULL}, 1374, "tcp"}, -{"molly", {NULL}, 1374, "udp"}, -{"bytex", {NULL}, 1375, "tcp"}, -{"bytex", {NULL}, 1375, "udp"}, -{"ibm-pps", {NULL}, 1376, "tcp"}, -{"ibm-pps", {NULL}, 1376, "udp"}, -{"cichlid", {NULL}, 1377, "tcp"}, -{"cichlid", {NULL}, 1377, "udp"}, -{"elan", {NULL}, 1378, "tcp"}, -{"elan", {NULL}, 1378, "udp"}, -{"dbreporter", {NULL}, 1379, "tcp"}, -{"dbreporter", {NULL}, 1379, "udp"}, -{"telesis-licman", {NULL}, 1380, "tcp"}, -{"telesis-licman", {NULL}, 1380, "udp"}, -{"apple-licman", {NULL}, 1381, "tcp"}, -{"apple-licman", {NULL}, 1381, "udp"}, -{"udt_os", {NULL}, 1382, "tcp"}, -{"udt_os", {NULL}, 1382, "udp"}, -{"gwha", {NULL}, 1383, "tcp"}, -{"gwha", {NULL}, 1383, "udp"}, -{"os-licman", {NULL}, 1384, "tcp"}, -{"os-licman", {NULL}, 1384, "udp"}, -{"atex_elmd", {NULL}, 1385, "tcp"}, -{"atex_elmd", {NULL}, 1385, "udp"}, -{"checksum", {NULL}, 1386, "tcp"}, -{"checksum", {NULL}, 1386, "udp"}, -{"cadsi-lm", {NULL}, 1387, "tcp"}, -{"cadsi-lm", {NULL}, 1387, "udp"}, -{"objective-dbc", {NULL}, 1388, "tcp"}, -{"objective-dbc", {NULL}, 1388, "udp"}, -{"iclpv-dm", {NULL}, 1389, "tcp"}, -{"iclpv-dm", {NULL}, 1389, "udp"}, -{"iclpv-sc", {NULL}, 1390, "tcp"}, -{"iclpv-sc", {NULL}, 1390, "udp"}, -{"iclpv-sas", {NULL}, 1391, "tcp"}, -{"iclpv-sas", {NULL}, 1391, "udp"}, -{"iclpv-pm", {NULL}, 1392, "tcp"}, -{"iclpv-pm", {NULL}, 1392, "udp"}, -{"iclpv-nls", {NULL}, 1393, "tcp"}, -{"iclpv-nls", {NULL}, 1393, "udp"}, -{"iclpv-nlc", {NULL}, 1394, "tcp"}, -{"iclpv-nlc", {NULL}, 1394, "udp"}, -{"iclpv-wsm", {NULL}, 1395, "tcp"}, -{"iclpv-wsm", {NULL}, 1395, "udp"}, -{"dvl-activemail", {NULL}, 1396, "tcp"}, -{"dvl-activemail", {NULL}, 1396, "udp"}, -{"audio-activmail", {NULL}, 1397, "tcp"}, -{"audio-activmail", {NULL}, 1397, "udp"}, -{"video-activmail", {NULL}, 1398, "tcp"}, -{"video-activmail", {NULL}, 1398, "udp"}, -{"cadkey-licman", {NULL}, 1399, "tcp"}, -{"cadkey-licman", {NULL}, 1399, "udp"}, -{"cadkey-tablet", {NULL}, 1400, "tcp"}, -{"cadkey-tablet", {NULL}, 1400, "udp"}, -{"goldleaf-licman", {NULL}, 1401, "tcp"}, -{"goldleaf-licman", {NULL}, 1401, "udp"}, -{"prm-sm-np", {NULL}, 1402, "tcp"}, -{"prm-sm-np", {NULL}, 1402, "udp"}, -{"prm-nm-np", {NULL}, 1403, "tcp"}, -{"prm-nm-np", {NULL}, 1403, "udp"}, -{"igi-lm", {NULL}, 1404, "tcp"}, -{"igi-lm", {NULL}, 1404, "udp"}, -{"ibm-res", {NULL}, 1405, "tcp"}, -{"ibm-res", {NULL}, 1405, "udp"}, -{"netlabs-lm", {NULL}, 1406, "tcp"}, -{"netlabs-lm", {NULL}, 1406, "udp"}, -{"dbsa-lm", {NULL}, 1407, "tcp"}, -{"dbsa-lm", {NULL}, 1407, "udp"}, -{"sophia-lm", {NULL}, 1408, "tcp"}, -{"sophia-lm", {NULL}, 1408, "udp"}, -{"here-lm", {NULL}, 1409, "tcp"}, -{"here-lm", {NULL}, 1409, "udp"}, -{"hiq", {NULL}, 1410, "tcp"}, -{"hiq", {NULL}, 1410, "udp"}, -{"af", {NULL}, 1411, "tcp"}, -{"af", {NULL}, 1411, "udp"}, -{"innosys", {NULL}, 1412, "tcp"}, -{"innosys", {NULL}, 1412, "udp"}, -{"innosys-acl", {NULL}, 1413, "tcp"}, -{"innosys-acl", {NULL}, 1413, "udp"}, -{"ibm-mqseries", {NULL}, 1414, "tcp"}, -{"ibm-mqseries", {NULL}, 1414, "udp"}, -{"dbstar", {NULL}, 1415, "tcp"}, -{"dbstar", {NULL}, 1415, "udp"}, -{"novell-lu6.2", {NULL}, 1416, "tcp"}, -{"novell-lu6.2", {NULL}, 1416, "udp"}, -{"timbuktu-srv1", {NULL}, 1417, "tcp"}, -{"timbuktu-srv1", {NULL}, 1417, "udp"}, -{"timbuktu-srv2", {NULL}, 1418, "tcp"}, -{"timbuktu-srv2", {NULL}, 1418, "udp"}, -{"timbuktu-srv3", {NULL}, 1419, "tcp"}, -{"timbuktu-srv3", {NULL}, 1419, "udp"}, -{"timbuktu-srv4", {NULL}, 1420, "tcp"}, -{"timbuktu-srv4", {NULL}, 1420, "udp"}, -{"gandalf-lm", {NULL}, 1421, "tcp"}, -{"gandalf-lm", {NULL}, 1421, "udp"}, -{"autodesk-lm", {NULL}, 1422, "tcp"}, -{"autodesk-lm", {NULL}, 1422, "udp"}, -{"essbase", {NULL}, 1423, "tcp"}, -{"essbase", {NULL}, 1423, "udp"}, -{"hybrid", {NULL}, 1424, "tcp"}, -{"hybrid", {NULL}, 1424, "udp"}, -{"zion-lm", {NULL}, 1425, "tcp"}, -{"zion-lm", {NULL}, 1425, "udp"}, -{"sais", {NULL}, 1426, "tcp"}, -{"sais", {NULL}, 1426, "udp"}, -{"mloadd", {NULL}, 1427, "tcp"}, -{"mloadd", {NULL}, 1427, "udp"}, -{"informatik-lm", {NULL}, 1428, "tcp"}, -{"informatik-lm", {NULL}, 1428, "udp"}, -{"nms", {NULL}, 1429, "tcp"}, -{"nms", {NULL}, 1429, "udp"}, -{"tpdu", {NULL}, 1430, "tcp"}, -{"tpdu", {NULL}, 1430, "udp"}, -{"rgtp", {NULL}, 1431, "tcp"}, -{"rgtp", {NULL}, 1431, "udp"}, -{"blueberry-lm", {NULL}, 1432, "tcp"}, -{"blueberry-lm", {NULL}, 1432, "udp"}, -{"ms-sql-s", {NULL}, 1433, "tcp"}, -{"ms-sql-s", {NULL}, 1433, "udp"}, -{"ms-sql-m", {NULL}, 1434, "tcp"}, -{"ms-sql-m", {NULL}, 1434, "udp"}, -{"ibm-cics", {NULL}, 1435, "tcp"}, -{"ibm-cics", {NULL}, 1435, "udp"}, -{"saism", {NULL}, 1436, "tcp"}, -{"saism", {NULL}, 1436, "udp"}, -{"tabula", {NULL}, 1437, "tcp"}, -{"tabula", {NULL}, 1437, "udp"}, -{"eicon-server", {NULL}, 1438, "tcp"}, -{"eicon-server", {NULL}, 1438, "udp"}, -{"eicon-x25", {NULL}, 1439, "tcp"}, -{"eicon-x25", {NULL}, 1439, "udp"}, -{"eicon-slp", {NULL}, 1440, "tcp"}, -{"eicon-slp", {NULL}, 1440, "udp"}, -{"cadis-1", {NULL}, 1441, "tcp"}, -{"cadis-1", {NULL}, 1441, "udp"}, -{"cadis-2", {NULL}, 1442, "tcp"}, -{"cadis-2", {NULL}, 1442, "udp"}, -{"ies-lm", {NULL}, 1443, "tcp"}, -{"ies-lm", {NULL}, 1443, "udp"}, -{"marcam-lm", {NULL}, 1444, "tcp"}, -{"marcam-lm", {NULL}, 1444, "udp"}, -{"proxima-lm", {NULL}, 1445, "tcp"}, -{"proxima-lm", {NULL}, 1445, "udp"}, -{"ora-lm", {NULL}, 1446, "tcp"}, -{"ora-lm", {NULL}, 1446, "udp"}, -{"apri-lm", {NULL}, 1447, "tcp"}, -{"apri-lm", {NULL}, 1447, "udp"}, -{"oc-lm", {NULL}, 1448, "tcp"}, -{"oc-lm", {NULL}, 1448, "udp"}, -{"peport", {NULL}, 1449, "tcp"}, -{"peport", {NULL}, 1449, "udp"}, -{"dwf", {NULL}, 1450, "tcp"}, -{"dwf", {NULL}, 1450, "udp"}, -{"infoman", {NULL}, 1451, "tcp"}, -{"infoman", {NULL}, 1451, "udp"}, -{"gtegsc-lm", {NULL}, 1452, "tcp"}, -{"gtegsc-lm", {NULL}, 1452, "udp"}, -{"genie-lm", {NULL}, 1453, "tcp"}, -{"genie-lm", {NULL}, 1453, "udp"}, -{"interhdl_elmd", {NULL}, 1454, "tcp"}, -{"interhdl_elmd", {NULL}, 1454, "udp"}, -{"esl-lm", {NULL}, 1455, "tcp"}, -{"esl-lm", {NULL}, 1455, "udp"}, -{"dca", {NULL}, 1456, "tcp"}, -{"dca", {NULL}, 1456, "udp"}, -{"valisys-lm", {NULL}, 1457, "tcp"}, -{"valisys-lm", {NULL}, 1457, "udp"}, -{"nrcabq-lm", {NULL}, 1458, "tcp"}, -{"nrcabq-lm", {NULL}, 1458, "udp"}, -{"proshare1", {NULL}, 1459, "tcp"}, -{"proshare1", {NULL}, 1459, "udp"}, -{"proshare2", {NULL}, 1460, "tcp"}, -{"proshare2", {NULL}, 1460, "udp"}, -{"ibm_wrless_lan", {NULL}, 1461, "tcp"}, -{"ibm_wrless_lan", {NULL}, 1461, "udp"}, -{"world-lm", {NULL}, 1462, "tcp"}, -{"world-lm", {NULL}, 1462, "udp"}, -{"nucleus", {NULL}, 1463, "tcp"}, -{"nucleus", {NULL}, 1463, "udp"}, -{"msl_lmd", {NULL}, 1464, "tcp"}, -{"msl_lmd", {NULL}, 1464, "udp"}, -{"pipes", {NULL}, 1465, "tcp"}, -{"pipes", {NULL}, 1465, "udp"}, -{"oceansoft-lm", {NULL}, 1466, "tcp"}, -{"oceansoft-lm", {NULL}, 1466, "udp"}, -{"csdmbase", {NULL}, 1467, "tcp"}, -{"csdmbase", {NULL}, 1467, "udp"}, -{"csdm", {NULL}, 1468, "tcp"}, -{"csdm", {NULL}, 1468, "udp"}, -{"aal-lm", {NULL}, 1469, "tcp"}, -{"aal-lm", {NULL}, 1469, "udp"}, -{"uaiact", {NULL}, 1470, "tcp"}, -{"uaiact", {NULL}, 1470, "udp"}, -{"csdmbase", {NULL}, 1471, "tcp"}, -{"csdmbase", {NULL}, 1471, "udp"}, -{"csdm", {NULL}, 1472, "tcp"}, -{"csdm", {NULL}, 1472, "udp"}, -{"openmath", {NULL}, 1473, "tcp"}, -{"openmath", {NULL}, 1473, "udp"}, -{"telefinder", {NULL}, 1474, "tcp"}, -{"telefinder", {NULL}, 1474, "udp"}, -{"taligent-lm", {NULL}, 1475, "tcp"}, -{"taligent-lm", {NULL}, 1475, "udp"}, -{"clvm-cfg", {NULL}, 1476, "tcp"}, -{"clvm-cfg", {NULL}, 1476, "udp"}, -{"ms-sna-server", {NULL}, 1477, "tcp"}, -{"ms-sna-server", {NULL}, 1477, "udp"}, -{"ms-sna-base", {NULL}, 1478, "tcp"}, -{"ms-sna-base", {NULL}, 1478, "udp"}, -{"dberegister", {NULL}, 1479, "tcp"}, -{"dberegister", {NULL}, 1479, "udp"}, -{"pacerforum", {NULL}, 1480, "tcp"}, -{"pacerforum", {NULL}, 1480, "udp"}, -{"airs", {NULL}, 1481, "tcp"}, -{"airs", {NULL}, 1481, "udp"}, -{"miteksys-lm", {NULL}, 1482, "tcp"}, -{"miteksys-lm", {NULL}, 1482, "udp"}, -{"afs", {NULL}, 1483, "tcp"}, -{"afs", {NULL}, 1483, "udp"}, -{"confluent", {NULL}, 1484, "tcp"}, -{"confluent", {NULL}, 1484, "udp"}, -{"lansource", {NULL}, 1485, "tcp"}, -{"lansource", {NULL}, 1485, "udp"}, -{"nms_topo_serv", {NULL}, 1486, "tcp"}, -{"nms_topo_serv", {NULL}, 1486, "udp"}, -{"localinfosrvr", {NULL}, 1487, "tcp"}, -{"localinfosrvr", {NULL}, 1487, "udp"}, -{"docstor", {NULL}, 1488, "tcp"}, -{"docstor", {NULL}, 1488, "udp"}, -{"dmdocbroker", {NULL}, 1489, "tcp"}, -{"dmdocbroker", {NULL}, 1489, "udp"}, -{"insitu-conf", {NULL}, 1490, "tcp"}, -{"insitu-conf", {NULL}, 1490, "udp"}, -{"stone-design-1", {NULL}, 1492, "tcp"}, -{"stone-design-1", {NULL}, 1492, "udp"}, -{"netmap_lm", {NULL}, 1493, "tcp"}, -{"netmap_lm", {NULL}, 1493, "udp"}, -{"ica", {NULL}, 1494, "tcp"}, -{"ica", {NULL}, 1494, "udp"}, -{"cvc", {NULL}, 1495, "tcp"}, -{"cvc", {NULL}, 1495, "udp"}, -{"liberty-lm", {NULL}, 1496, "tcp"}, -{"liberty-lm", {NULL}, 1496, "udp"}, -{"rfx-lm", {NULL}, 1497, "tcp"}, -{"rfx-lm", {NULL}, 1497, "udp"}, -{"sybase-sqlany", {NULL}, 1498, "tcp"}, -{"sybase-sqlany", {NULL}, 1498, "udp"}, -{"fhc", {NULL}, 1499, "tcp"}, -{"fhc", {NULL}, 1499, "udp"}, -{"vlsi-lm", {NULL}, 1500, "tcp"}, -{"vlsi-lm", {NULL}, 1500, "udp"}, -{"saiscm", {NULL}, 1501, "tcp"}, -{"saiscm", {NULL}, 1501, "udp"}, -{"shivadiscovery", {NULL}, 1502, "tcp"}, -{"shivadiscovery", {NULL}, 1502, "udp"}, -{"imtc-mcs", {NULL}, 1503, "tcp"}, -{"imtc-mcs", {NULL}, 1503, "udp"}, -{"evb-elm", {NULL}, 1504, "tcp"}, -{"evb-elm", {NULL}, 1504, "udp"}, -{"funkproxy", {NULL}, 1505, "tcp"}, -{"funkproxy", {NULL}, 1505, "udp"}, -{"utcd", {NULL}, 1506, "tcp"}, -{"utcd", {NULL}, 1506, "udp"}, -{"symplex", {NULL}, 1507, "tcp"}, -{"symplex", {NULL}, 1507, "udp"}, -{"diagmond", {NULL}, 1508, "tcp"}, -{"diagmond", {NULL}, 1508, "udp"}, -{"robcad-lm", {NULL}, 1509, "tcp"}, -{"robcad-lm", {NULL}, 1509, "udp"}, -{"mvx-lm", {NULL}, 1510, "tcp"}, -{"mvx-lm", {NULL}, 1510, "udp"}, -{"3l-l1", {NULL}, 1511, "tcp"}, -{"3l-l1", {NULL}, 1511, "udp"}, -{"wins", {NULL}, 1512, "tcp"}, -{"wins", {NULL}, 1512, "udp"}, -{"fujitsu-dtc", {NULL}, 1513, "tcp"}, -{"fujitsu-dtc", {NULL}, 1513, "udp"}, -{"fujitsu-dtcns", {NULL}, 1514, "tcp"}, -{"fujitsu-dtcns", {NULL}, 1514, "udp"}, -{"ifor-protocol", {NULL}, 1515, "tcp"}, -{"ifor-protocol", {NULL}, 1515, "udp"}, -{"vpad", {NULL}, 1516, "tcp"}, -{"vpad", {NULL}, 1516, "udp"}, -{"vpac", {NULL}, 1517, "tcp"}, -{"vpac", {NULL}, 1517, "udp"}, -{"vpvd", {NULL}, 1518, "tcp"}, -{"vpvd", {NULL}, 1518, "udp"}, -{"vpvc", {NULL}, 1519, "tcp"}, -{"vpvc", {NULL}, 1519, "udp"}, -{"atm-zip-office", {NULL}, 1520, "tcp"}, -{"atm-zip-office", {NULL}, 1520, "udp"}, -{"ncube-lm", {NULL}, 1521, "tcp"}, -{"ncube-lm", {NULL}, 1521, "udp"}, -{"ricardo-lm", {NULL}, 1522, "tcp"}, -{"ricardo-lm", {NULL}, 1522, "udp"}, -{"cichild-lm", {NULL}, 1523, "tcp"}, -{"cichild-lm", {NULL}, 1523, "udp"}, -{"ingreslock", {NULL}, 1524, "tcp"}, -{"ingreslock", {NULL}, 1524, "udp"}, -{"orasrv", {NULL}, 1525, "tcp"}, -{"orasrv", {NULL}, 1525, "udp"}, -{"prospero-np", {NULL}, 1525, "tcp"}, -{"prospero-np", {NULL}, 1525, "udp"}, -{"pdap-np", {NULL}, 1526, "tcp"}, -{"pdap-np", {NULL}, 1526, "udp"}, -{"tlisrv", {NULL}, 1527, "tcp"}, -{"tlisrv", {NULL}, 1527, "udp"}, -{"coauthor", {NULL}, 1529, "tcp"}, -{"coauthor", {NULL}, 1529, "udp"}, -{"rap-service", {NULL}, 1530, "tcp"}, -{"rap-service", {NULL}, 1530, "udp"}, -{"rap-listen", {NULL}, 1531, "tcp"}, -{"rap-listen", {NULL}, 1531, "udp"}, -{"miroconnect", {NULL}, 1532, "tcp"}, -{"miroconnect", {NULL}, 1532, "udp"}, -{"virtual-places", {NULL}, 1533, "tcp"}, -{"virtual-places", {NULL}, 1533, "udp"}, -{"micromuse-lm", {NULL}, 1534, "tcp"}, -{"micromuse-lm", {NULL}, 1534, "udp"}, -{"ampr-info", {NULL}, 1535, "tcp"}, -{"ampr-info", {NULL}, 1535, "udp"}, -{"ampr-inter", {NULL}, 1536, "tcp"}, -{"ampr-inter", {NULL}, 1536, "udp"}, -{"sdsc-lm", {NULL}, 1537, "tcp"}, -{"sdsc-lm", {NULL}, 1537, "udp"}, -{"3ds-lm", {NULL}, 1538, "tcp"}, -{"3ds-lm", {NULL}, 1538, "udp"}, -{"intellistor-lm", {NULL}, 1539, "tcp"}, -{"intellistor-lm", {NULL}, 1539, "udp"}, -{"rds", {NULL}, 1540, "tcp"}, -{"rds", {NULL}, 1540, "udp"}, -{"rds2", {NULL}, 1541, "tcp"}, -{"rds2", {NULL}, 1541, "udp"}, -{"gridgen-elmd", {NULL}, 1542, "tcp"}, -{"gridgen-elmd", {NULL}, 1542, "udp"}, -{"simba-cs", {NULL}, 1543, "tcp"}, -{"simba-cs", {NULL}, 1543, "udp"}, -{"aspeclmd", {NULL}, 1544, "tcp"}, -{"aspeclmd", {NULL}, 1544, "udp"}, -{"vistium-share", {NULL}, 1545, "tcp"}, -{"vistium-share", {NULL}, 1545, "udp"}, -{"abbaccuray", {NULL}, 1546, "tcp"}, -{"abbaccuray", {NULL}, 1546, "udp"}, -{"laplink", {NULL}, 1547, "tcp"}, -{"laplink", {NULL}, 1547, "udp"}, -{"axon-lm", {NULL}, 1548, "tcp"}, -{"axon-lm", {NULL}, 1548, "udp"}, -{"shivahose", {NULL}, 1549, "tcp"}, -{"shivasound", {NULL}, 1549, "udp"}, -{"3m-image-lm", {NULL}, 1550, "tcp"}, -{"3m-image-lm", {NULL}, 1550, "udp"}, -{"hecmtl-db", {NULL}, 1551, "tcp"}, -{"hecmtl-db", {NULL}, 1551, "udp"}, -{"pciarray", {NULL}, 1552, "tcp"}, -{"pciarray", {NULL}, 1552, "udp"}, -{"sna-cs", {NULL}, 1553, "tcp"}, -{"sna-cs", {NULL}, 1553, "udp"}, -{"caci-lm", {NULL}, 1554, "tcp"}, -{"caci-lm", {NULL}, 1554, "udp"}, -{"livelan", {NULL}, 1555, "tcp"}, -{"livelan", {NULL}, 1555, "udp"}, -{"veritas_pbx", {NULL}, 1556, "tcp"}, -{"veritas_pbx", {NULL}, 1556, "udp"}, -{"arbortext-lm", {NULL}, 1557, "tcp"}, -{"arbortext-lm", {NULL}, 1557, "udp"}, -{"xingmpeg", {NULL}, 1558, "tcp"}, -{"xingmpeg", {NULL}, 1558, "udp"}, -{"web2host", {NULL}, 1559, "tcp"}, -{"web2host", {NULL}, 1559, "udp"}, -{"asci-val", {NULL}, 1560, "tcp"}, -{"asci-val", {NULL}, 1560, "udp"}, -{"facilityview", {NULL}, 1561, "tcp"}, -{"facilityview", {NULL}, 1561, "udp"}, -{"pconnectmgr", {NULL}, 1562, "tcp"}, -{"pconnectmgr", {NULL}, 1562, "udp"}, -{"cadabra-lm", {NULL}, 1563, "tcp"}, -{"cadabra-lm", {NULL}, 1563, "udp"}, -{"pay-per-view", {NULL}, 1564, "tcp"}, -{"pay-per-view", {NULL}, 1564, "udp"}, -{"winddlb", {NULL}, 1565, "tcp"}, -{"winddlb", {NULL}, 1565, "udp"}, -{"corelvideo", {NULL}, 1566, "tcp"}, -{"corelvideo", {NULL}, 1566, "udp"}, -{"jlicelmd", {NULL}, 1567, "tcp"}, -{"jlicelmd", {NULL}, 1567, "udp"}, -{"tsspmap", {NULL}, 1568, "tcp"}, -{"tsspmap", {NULL}, 1568, "udp"}, -{"ets", {NULL}, 1569, "tcp"}, -{"ets", {NULL}, 1569, "udp"}, -{"orbixd", {NULL}, 1570, "tcp"}, -{"orbixd", {NULL}, 1570, "udp"}, -{"rdb-dbs-disp", {NULL}, 1571, "tcp"}, -{"rdb-dbs-disp", {NULL}, 1571, "udp"}, -{"chip-lm", {NULL}, 1572, "tcp"}, -{"chip-lm", {NULL}, 1572, "udp"}, -{"itscomm-ns", {NULL}, 1573, "tcp"}, -{"itscomm-ns", {NULL}, 1573, "udp"}, -{"mvel-lm", {NULL}, 1574, "tcp"}, -{"mvel-lm", {NULL}, 1574, "udp"}, -{"oraclenames", {NULL}, 1575, "tcp"}, -{"oraclenames", {NULL}, 1575, "udp"}, -{"moldflow-lm", {NULL}, 1576, "tcp"}, -{"moldflow-lm", {NULL}, 1576, "udp"}, -{"hypercube-lm", {NULL}, 1577, "tcp"}, -{"hypercube-lm", {NULL}, 1577, "udp"}, -{"jacobus-lm", {NULL}, 1578, "tcp"}, -{"jacobus-lm", {NULL}, 1578, "udp"}, -{"ioc-sea-lm", {NULL}, 1579, "tcp"}, -{"ioc-sea-lm", {NULL}, 1579, "udp"}, -{"tn-tl-r1", {NULL}, 1580, "tcp"}, -{"tn-tl-r2", {NULL}, 1580, "udp"}, -{"mil-2045-47001", {NULL}, 1581, "tcp"}, -{"mil-2045-47001", {NULL}, 1581, "udp"}, -{"msims", {NULL}, 1582, "tcp"}, -{"msims", {NULL}, 1582, "udp"}, -{"simbaexpress", {NULL}, 1583, "tcp"}, -{"simbaexpress", {NULL}, 1583, "udp"}, -{"tn-tl-fd2", {NULL}, 1584, "tcp"}, -{"tn-tl-fd2", {NULL}, 1584, "udp"}, -{"intv", {NULL}, 1585, "tcp"}, -{"intv", {NULL}, 1585, "udp"}, -{"ibm-abtact", {NULL}, 1586, "tcp"}, -{"ibm-abtact", {NULL}, 1586, "udp"}, -{"pra_elmd", {NULL}, 1587, "tcp"}, -{"pra_elmd", {NULL}, 1587, "udp"}, -{"triquest-lm", {NULL}, 1588, "tcp"}, -{"triquest-lm", {NULL}, 1588, "udp"}, -{"vqp", {NULL}, 1589, "tcp"}, -{"vqp", {NULL}, 1589, "udp"}, -{"gemini-lm", {NULL}, 1590, "tcp"}, -{"gemini-lm", {NULL}, 1590, "udp"}, -{"ncpm-pm", {NULL}, 1591, "tcp"}, -{"ncpm-pm", {NULL}, 1591, "udp"}, -{"commonspace", {NULL}, 1592, "tcp"}, -{"commonspace", {NULL}, 1592, "udp"}, -{"mainsoft-lm", {NULL}, 1593, "tcp"}, -{"mainsoft-lm", {NULL}, 1593, "udp"}, -{"sixtrak", {NULL}, 1594, "tcp"}, -{"sixtrak", {NULL}, 1594, "udp"}, -{"radio", {NULL}, 1595, "tcp"}, -{"radio", {NULL}, 1595, "udp"}, -{"radio-sm", {NULL}, 1596, "tcp"}, -{"radio-bc", {NULL}, 1596, "udp"}, -{"orbplus-iiop", {NULL}, 1597, "tcp"}, -{"orbplus-iiop", {NULL}, 1597, "udp"}, -{"picknfs", {NULL}, 1598, "tcp"}, -{"picknfs", {NULL}, 1598, "udp"}, -{"simbaservices", {NULL}, 1599, "tcp"}, -{"simbaservices", {NULL}, 1599, "udp"}, -{"issd", {NULL}, 1600, "tcp"}, -{"issd", {NULL}, 1600, "udp"}, -{"aas", {NULL}, 1601, "tcp"}, -{"aas", {NULL}, 1601, "udp"}, -{"inspect", {NULL}, 1602, "tcp"}, -{"inspect", {NULL}, 1602, "udp"}, -{"picodbc", {NULL}, 1603, "tcp"}, -{"picodbc", {NULL}, 1603, "udp"}, -{"icabrowser", {NULL}, 1604, "tcp"}, -{"icabrowser", {NULL}, 1604, "udp"}, -{"slp", {NULL}, 1605, "tcp"}, -{"slp", {NULL}, 1605, "udp"}, -{"slm-api", {NULL}, 1606, "tcp"}, -{"slm-api", {NULL}, 1606, "udp"}, -{"stt", {NULL}, 1607, "tcp"}, -{"stt", {NULL}, 1607, "udp"}, -{"smart-lm", {NULL}, 1608, "tcp"}, -{"smart-lm", {NULL}, 1608, "udp"}, -{"isysg-lm", {NULL}, 1609, "tcp"}, -{"isysg-lm", {NULL}, 1609, "udp"}, -{"taurus-wh", {NULL}, 1610, "tcp"}, -{"taurus-wh", {NULL}, 1610, "udp"}, -{"ill", {NULL}, 1611, "tcp"}, -{"ill", {NULL}, 1611, "udp"}, -{"netbill-trans", {NULL}, 1612, "tcp"}, -{"netbill-trans", {NULL}, 1612, "udp"}, -{"netbill-keyrep", {NULL}, 1613, "tcp"}, -{"netbill-keyrep", {NULL}, 1613, "udp"}, -{"netbill-cred", {NULL}, 1614, "tcp"}, -{"netbill-cred", {NULL}, 1614, "udp"}, -{"netbill-auth", {NULL}, 1615, "tcp"}, -{"netbill-auth", {NULL}, 1615, "udp"}, -{"netbill-prod", {NULL}, 1616, "tcp"}, -{"netbill-prod", {NULL}, 1616, "udp"}, -{"nimrod-agent", {NULL}, 1617, "tcp"}, -{"nimrod-agent", {NULL}, 1617, "udp"}, -{"skytelnet", {NULL}, 1618, "tcp"}, -{"skytelnet", {NULL}, 1618, "udp"}, -{"xs-openstorage", {NULL}, 1619, "tcp"}, -{"xs-openstorage", {NULL}, 1619, "udp"}, -{"faxportwinport", {NULL}, 1620, "tcp"}, -{"faxportwinport", {NULL}, 1620, "udp"}, -{"softdataphone", {NULL}, 1621, "tcp"}, -{"softdataphone", {NULL}, 1621, "udp"}, -{"ontime", {NULL}, 1622, "tcp"}, -{"ontime", {NULL}, 1622, "udp"}, -{"jaleosnd", {NULL}, 1623, "tcp"}, -{"jaleosnd", {NULL}, 1623, "udp"}, -{"udp-sr-port", {NULL}, 1624, "tcp"}, -{"udp-sr-port", {NULL}, 1624, "udp"}, -{"svs-omagent", {NULL}, 1625, "tcp"}, -{"svs-omagent", {NULL}, 1625, "udp"}, -{"shockwave", {NULL}, 1626, "tcp"}, -{"shockwave", {NULL}, 1626, "udp"}, -{"t128-gateway", {NULL}, 1627, "tcp"}, -{"t128-gateway", {NULL}, 1627, "udp"}, -{"lontalk-norm", {NULL}, 1628, "tcp"}, -{"lontalk-norm", {NULL}, 1628, "udp"}, -{"lontalk-urgnt", {NULL}, 1629, "tcp"}, -{"lontalk-urgnt", {NULL}, 1629, "udp"}, -{"oraclenet8cman", {NULL}, 1630, "tcp"}, -{"oraclenet8cman", {NULL}, 1630, "udp"}, -{"visitview", {NULL}, 1631, "tcp"}, -{"visitview", {NULL}, 1631, "udp"}, -{"pammratc", {NULL}, 1632, "tcp"}, -{"pammratc", {NULL}, 1632, "udp"}, -{"pammrpc", {NULL}, 1633, "tcp"}, -{"pammrpc", {NULL}, 1633, "udp"}, -{"loaprobe", {NULL}, 1634, "tcp"}, -{"loaprobe", {NULL}, 1634, "udp"}, -{"edb-server1", {NULL}, 1635, "tcp"}, -{"edb-server1", {NULL}, 1635, "udp"}, -{"isdc", {NULL}, 1636, "tcp"}, -{"isdc", {NULL}, 1636, "udp"}, -{"islc", {NULL}, 1637, "tcp"}, -{"islc", {NULL}, 1637, "udp"}, -{"ismc", {NULL}, 1638, "tcp"}, -{"ismc", {NULL}, 1638, "udp"}, -{"cert-initiator", {NULL}, 1639, "tcp"}, -{"cert-initiator", {NULL}, 1639, "udp"}, -{"cert-responder", {NULL}, 1640, "tcp"}, -{"cert-responder", {NULL}, 1640, "udp"}, -{"invision", {NULL}, 1641, "tcp"}, -{"invision", {NULL}, 1641, "udp"}, -{"isis-am", {NULL}, 1642, "tcp"}, -{"isis-am", {NULL}, 1642, "udp"}, -{"isis-ambc", {NULL}, 1643, "tcp"}, -{"isis-ambc", {NULL}, 1643, "udp"}, -{"saiseh", {NULL}, 1644, "tcp"}, -{"sightline", {NULL}, 1645, "tcp"}, -{"sightline", {NULL}, 1645, "udp"}, -{"sa-msg-port", {NULL}, 1646, "tcp"}, -{"sa-msg-port", {NULL}, 1646, "udp"}, -{"rsap", {NULL}, 1647, "tcp"}, -{"rsap", {NULL}, 1647, "udp"}, -{"concurrent-lm", {NULL}, 1648, "tcp"}, -{"concurrent-lm", {NULL}, 1648, "udp"}, -{"kermit", {NULL}, 1649, "tcp"}, -{"kermit", {NULL}, 1649, "udp"}, -{"nkd", {NULL}, 1650, "tcp"}, -{"nkd", {NULL}, 1650, "udp"}, -{"shiva_confsrvr", {NULL}, 1651, "tcp"}, -{"shiva_confsrvr", {NULL}, 1651, "udp"}, -{"xnmp", {NULL}, 1652, "tcp"}, -{"xnmp", {NULL}, 1652, "udp"}, -{"alphatech-lm", {NULL}, 1653, "tcp"}, -{"alphatech-lm", {NULL}, 1653, "udp"}, -{"stargatealerts", {NULL}, 1654, "tcp"}, -{"stargatealerts", {NULL}, 1654, "udp"}, -{"dec-mbadmin", {NULL}, 1655, "tcp"}, -{"dec-mbadmin", {NULL}, 1655, "udp"}, -{"dec-mbadmin-h", {NULL}, 1656, "tcp"}, -{"dec-mbadmin-h", {NULL}, 1656, "udp"}, -{"fujitsu-mmpdc", {NULL}, 1657, "tcp"}, -{"fujitsu-mmpdc", {NULL}, 1657, "udp"}, -{"sixnetudr", {NULL}, 1658, "tcp"}, -{"sixnetudr", {NULL}, 1658, "udp"}, -{"sg-lm", {NULL}, 1659, "tcp"}, -{"sg-lm", {NULL}, 1659, "udp"}, -{"skip-mc-gikreq", {NULL}, 1660, "tcp"}, -{"skip-mc-gikreq", {NULL}, 1660, "udp"}, -{"netview-aix-1", {NULL}, 1661, "tcp"}, -{"netview-aix-1", {NULL}, 1661, "udp"}, -{"netview-aix-2", {NULL}, 1662, "tcp"}, -{"netview-aix-2", {NULL}, 1662, "udp"}, -{"netview-aix-3", {NULL}, 1663, "tcp"}, -{"netview-aix-3", {NULL}, 1663, "udp"}, -{"netview-aix-4", {NULL}, 1664, "tcp"}, -{"netview-aix-4", {NULL}, 1664, "udp"}, -{"netview-aix-5", {NULL}, 1665, "tcp"}, -{"netview-aix-5", {NULL}, 1665, "udp"}, -{"netview-aix-6", {NULL}, 1666, "tcp"}, -{"netview-aix-6", {NULL}, 1666, "udp"}, -{"netview-aix-7", {NULL}, 1667, "tcp"}, -{"netview-aix-7", {NULL}, 1667, "udp"}, -{"netview-aix-8", {NULL}, 1668, "tcp"}, -{"netview-aix-8", {NULL}, 1668, "udp"}, -{"netview-aix-9", {NULL}, 1669, "tcp"}, -{"netview-aix-9", {NULL}, 1669, "udp"}, -{"netview-aix-10", {NULL}, 1670, "tcp"}, -{"netview-aix-10", {NULL}, 1670, "udp"}, -{"netview-aix-11", {NULL}, 1671, "tcp"}, -{"netview-aix-11", {NULL}, 1671, "udp"}, -{"netview-aix-12", {NULL}, 1672, "tcp"}, -{"netview-aix-12", {NULL}, 1672, "udp"}, -{"proshare-mc-1", {NULL}, 1673, "tcp"}, -{"proshare-mc-1", {NULL}, 1673, "udp"}, -{"proshare-mc-2", {NULL}, 1674, "tcp"}, -{"proshare-mc-2", {NULL}, 1674, "udp"}, -{"pdp", {NULL}, 1675, "tcp"}, -{"pdp", {NULL}, 1675, "udp"}, -{"netcomm1", {NULL}, 1676, "tcp"}, -{"netcomm2", {NULL}, 1676, "udp"}, -{"groupwise", {NULL}, 1677, "tcp"}, -{"groupwise", {NULL}, 1677, "udp"}, -{"prolink", {NULL}, 1678, "tcp"}, -{"prolink", {NULL}, 1678, "udp"}, -{"darcorp-lm", {NULL}, 1679, "tcp"}, -{"darcorp-lm", {NULL}, 1679, "udp"}, -{"microcom-sbp", {NULL}, 1680, "tcp"}, -{"microcom-sbp", {NULL}, 1680, "udp"}, -{"sd-elmd", {NULL}, 1681, "tcp"}, -{"sd-elmd", {NULL}, 1681, "udp"}, -{"lanyon-lantern", {NULL}, 1682, "tcp"}, -{"lanyon-lantern", {NULL}, 1682, "udp"}, -{"ncpm-hip", {NULL}, 1683, "tcp"}, -{"ncpm-hip", {NULL}, 1683, "udp"}, -{"snaresecure", {NULL}, 1684, "tcp"}, -{"snaresecure", {NULL}, 1684, "udp"}, -{"n2nremote", {NULL}, 1685, "tcp"}, -{"n2nremote", {NULL}, 1685, "udp"}, -{"cvmon", {NULL}, 1686, "tcp"}, -{"cvmon", {NULL}, 1686, "udp"}, -{"nsjtp-ctrl", {NULL}, 1687, "tcp"}, -{"nsjtp-ctrl", {NULL}, 1687, "udp"}, -{"nsjtp-data", {NULL}, 1688, "tcp"}, -{"nsjtp-data", {NULL}, 1688, "udp"}, -{"firefox", {NULL}, 1689, "tcp"}, -{"firefox", {NULL}, 1689, "udp"}, -{"ng-umds", {NULL}, 1690, "tcp"}, -{"ng-umds", {NULL}, 1690, "udp"}, -{"empire-empuma", {NULL}, 1691, "tcp"}, -{"empire-empuma", {NULL}, 1691, "udp"}, -{"sstsys-lm", {NULL}, 1692, "tcp"}, -{"sstsys-lm", {NULL}, 1692, "udp"}, -{"rrirtr", {NULL}, 1693, "tcp"}, -{"rrirtr", {NULL}, 1693, "udp"}, -{"rrimwm", {NULL}, 1694, "tcp"}, -{"rrimwm", {NULL}, 1694, "udp"}, -{"rrilwm", {NULL}, 1695, "tcp"}, -{"rrilwm", {NULL}, 1695, "udp"}, -{"rrifmm", {NULL}, 1696, "tcp"}, -{"rrifmm", {NULL}, 1696, "udp"}, -{"rrisat", {NULL}, 1697, "tcp"}, -{"rrisat", {NULL}, 1697, "udp"}, -{"rsvp-encap-1", {NULL}, 1698, "tcp"}, -{"rsvp-encap-1", {NULL}, 1698, "udp"}, -{"rsvp-encap-2", {NULL}, 1699, "tcp"}, -{"rsvp-encap-2", {NULL}, 1699, "udp"}, -{"mps-raft", {NULL}, 1700, "tcp"}, -{"mps-raft", {NULL}, 1700, "udp"}, -{"l2f", {NULL}, 1701, "tcp"}, -{"l2f", {NULL}, 1701, "udp"}, -{"l2tp", {NULL}, 1701, "tcp"}, -{"l2tp", {NULL}, 1701, "udp"}, -{"deskshare", {NULL}, 1702, "tcp"}, -{"deskshare", {NULL}, 1702, "udp"}, -{"hb-engine", {NULL}, 1703, "tcp"}, -{"hb-engine", {NULL}, 1703, "udp"}, -{"bcs-broker", {NULL}, 1704, "tcp"}, -{"bcs-broker", {NULL}, 1704, "udp"}, -{"slingshot", {NULL}, 1705, "tcp"}, -{"slingshot", {NULL}, 1705, "udp"}, -{"jetform", {NULL}, 1706, "tcp"}, -{"jetform", {NULL}, 1706, "udp"}, -{"vdmplay", {NULL}, 1707, "tcp"}, -{"vdmplay", {NULL}, 1707, "udp"}, -{"gat-lmd", {NULL}, 1708, "tcp"}, -{"gat-lmd", {NULL}, 1708, "udp"}, -{"centra", {NULL}, 1709, "tcp"}, -{"centra", {NULL}, 1709, "udp"}, -{"impera", {NULL}, 1710, "tcp"}, -{"impera", {NULL}, 1710, "udp"}, -{"pptconference", {NULL}, 1711, "tcp"}, -{"pptconference", {NULL}, 1711, "udp"}, -{"registrar", {NULL}, 1712, "tcp"}, -{"registrar", {NULL}, 1712, "udp"}, -{"conferencetalk", {NULL}, 1713, "tcp"}, -{"conferencetalk", {NULL}, 1713, "udp"}, -{"sesi-lm", {NULL}, 1714, "tcp"}, -{"sesi-lm", {NULL}, 1714, "udp"}, -{"houdini-lm", {NULL}, 1715, "tcp"}, -{"houdini-lm", {NULL}, 1715, "udp"}, -{"xmsg", {NULL}, 1716, "tcp"}, -{"xmsg", {NULL}, 1716, "udp"}, -{"fj-hdnet", {NULL}, 1717, "tcp"}, -{"fj-hdnet", {NULL}, 1717, "udp"}, -{"h323gatedisc", {NULL}, 1718, "tcp"}, -{"h323gatedisc", {NULL}, 1718, "udp"}, -{"h323gatestat", {NULL}, 1719, "tcp"}, -{"h323gatestat", {NULL}, 1719, "udp"}, -{"h323hostcall", {NULL}, 1720, "tcp"}, -{"h323hostcall", {NULL}, 1720, "udp"}, -{"caicci", {NULL}, 1721, "tcp"}, -{"caicci", {NULL}, 1721, "udp"}, -{"hks-lm", {NULL}, 1722, "tcp"}, -{"hks-lm", {NULL}, 1722, "udp"}, -{"pptp", {NULL}, 1723, "tcp"}, -{"pptp", {NULL}, 1723, "udp"}, -{"csbphonemaster", {NULL}, 1724, "tcp"}, -{"csbphonemaster", {NULL}, 1724, "udp"}, -{"iden-ralp", {NULL}, 1725, "tcp"}, -{"iden-ralp", {NULL}, 1725, "udp"}, -{"iberiagames", {NULL}, 1726, "tcp"}, -{"iberiagames", {NULL}, 1726, "udp"}, -{"winddx", {NULL}, 1727, "tcp"}, -{"winddx", {NULL}, 1727, "udp"}, -{"telindus", {NULL}, 1728, "tcp"}, -{"telindus", {NULL}, 1728, "udp"}, -{"citynl", {NULL}, 1729, "tcp"}, -{"citynl", {NULL}, 1729, "udp"}, -{"roketz", {NULL}, 1730, "tcp"}, -{"roketz", {NULL}, 1730, "udp"}, -{"msiccp", {NULL}, 1731, "tcp"}, -{"msiccp", {NULL}, 1731, "udp"}, -{"proxim", {NULL}, 1732, "tcp"}, -{"proxim", {NULL}, 1732, "udp"}, -{"siipat", {NULL}, 1733, "tcp"}, -{"siipat", {NULL}, 1733, "udp"}, -{"cambertx-lm", {NULL}, 1734, "tcp"}, -{"cambertx-lm", {NULL}, 1734, "udp"}, -{"privatechat", {NULL}, 1735, "tcp"}, -{"privatechat", {NULL}, 1735, "udp"}, -{"street-stream", {NULL}, 1736, "tcp"}, -{"street-stream", {NULL}, 1736, "udp"}, -{"ultimad", {NULL}, 1737, "tcp"}, -{"ultimad", {NULL}, 1737, "udp"}, -{"gamegen1", {NULL}, 1738, "tcp"}, -{"gamegen1", {NULL}, 1738, "udp"}, -{"webaccess", {NULL}, 1739, "tcp"}, -{"webaccess", {NULL}, 1739, "udp"}, -{"encore", {NULL}, 1740, "tcp"}, -{"encore", {NULL}, 1740, "udp"}, -{"cisco-net-mgmt", {NULL}, 1741, "tcp"}, -{"cisco-net-mgmt", {NULL}, 1741, "udp"}, -{"3Com-nsd", {NULL}, 1742, "tcp"}, -{"3Com-nsd", {NULL}, 1742, "udp"}, -{"cinegrfx-lm", {NULL}, 1743, "tcp"}, -{"cinegrfx-lm", {NULL}, 1743, "udp"}, -{"ncpm-ft", {NULL}, 1744, "tcp"}, -{"ncpm-ft", {NULL}, 1744, "udp"}, -{"remote-winsock", {NULL}, 1745, "tcp"}, -{"remote-winsock", {NULL}, 1745, "udp"}, -{"ftrapid-1", {NULL}, 1746, "tcp"}, -{"ftrapid-1", {NULL}, 1746, "udp"}, -{"ftrapid-2", {NULL}, 1747, "tcp"}, -{"ftrapid-2", {NULL}, 1747, "udp"}, -{"oracle-em1", {NULL}, 1748, "tcp"}, -{"oracle-em1", {NULL}, 1748, "udp"}, -{"aspen-services", {NULL}, 1749, "tcp"}, -{"aspen-services", {NULL}, 1749, "udp"}, -{"sslp", {NULL}, 1750, "tcp"}, -{"sslp", {NULL}, 1750, "udp"}, -{"swiftnet", {NULL}, 1751, "tcp"}, -{"swiftnet", {NULL}, 1751, "udp"}, -{"lofr-lm", {NULL}, 1752, "tcp"}, -{"lofr-lm", {NULL}, 1752, "udp"}, -{"oracle-em2", {NULL}, 1754, "tcp"}, -{"oracle-em2", {NULL}, 1754, "udp"}, -{"ms-streaming", {NULL}, 1755, "tcp"}, -{"ms-streaming", {NULL}, 1755, "udp"}, -{"capfast-lmd", {NULL}, 1756, "tcp"}, -{"capfast-lmd", {NULL}, 1756, "udp"}, -{"cnhrp", {NULL}, 1757, "tcp"}, -{"cnhrp", {NULL}, 1757, "udp"}, -{"tftp-mcast", {NULL}, 1758, "tcp"}, -{"tftp-mcast", {NULL}, 1758, "udp"}, -{"spss-lm", {NULL}, 1759, "tcp"}, -{"spss-lm", {NULL}, 1759, "udp"}, -{"www-ldap-gw", {NULL}, 1760, "tcp"}, -{"www-ldap-gw", {NULL}, 1760, "udp"}, -{"cft-0", {NULL}, 1761, "tcp"}, -{"cft-0", {NULL}, 1761, "udp"}, -{"cft-1", {NULL}, 1762, "tcp"}, -{"cft-1", {NULL}, 1762, "udp"}, -{"cft-2", {NULL}, 1763, "tcp"}, -{"cft-2", {NULL}, 1763, "udp"}, -{"cft-3", {NULL}, 1764, "tcp"}, -{"cft-3", {NULL}, 1764, "udp"}, -{"cft-4", {NULL}, 1765, "tcp"}, -{"cft-4", {NULL}, 1765, "udp"}, -{"cft-5", {NULL}, 1766, "tcp"}, -{"cft-5", {NULL}, 1766, "udp"}, -{"cft-6", {NULL}, 1767, "tcp"}, -{"cft-6", {NULL}, 1767, "udp"}, -{"cft-7", {NULL}, 1768, "tcp"}, -{"cft-7", {NULL}, 1768, "udp"}, -{"bmc-net-adm", {NULL}, 1769, "tcp"}, -{"bmc-net-adm", {NULL}, 1769, "udp"}, -{"bmc-net-svc", {NULL}, 1770, "tcp"}, -{"bmc-net-svc", {NULL}, 1770, "udp"}, -{"vaultbase", {NULL}, 1771, "tcp"}, -{"vaultbase", {NULL}, 1771, "udp"}, -{"essweb-gw", {NULL}, 1772, "tcp"}, -{"essweb-gw", {NULL}, 1772, "udp"}, -{"kmscontrol", {NULL}, 1773, "tcp"}, -{"kmscontrol", {NULL}, 1773, "udp"}, -{"global-dtserv", {NULL}, 1774, "tcp"}, -{"global-dtserv", {NULL}, 1774, "udp"}, -{"femis", {NULL}, 1776, "tcp"}, -{"femis", {NULL}, 1776, "udp"}, -{"powerguardian", {NULL}, 1777, "tcp"}, -{"powerguardian", {NULL}, 1777, "udp"}, -{"prodigy-intrnet", {NULL}, 1778, "tcp"}, -{"prodigy-intrnet", {NULL}, 1778, "udp"}, -{"pharmasoft", {NULL}, 1779, "tcp"}, -{"pharmasoft", {NULL}, 1779, "udp"}, -{"dpkeyserv", {NULL}, 1780, "tcp"}, -{"dpkeyserv", {NULL}, 1780, "udp"}, -{"answersoft-lm", {NULL}, 1781, "tcp"}, -{"answersoft-lm", {NULL}, 1781, "udp"}, -{"hp-hcip", {NULL}, 1782, "tcp"}, -{"hp-hcip", {NULL}, 1782, "udp"}, -{"finle-lm", {NULL}, 1784, "tcp"}, -{"finle-lm", {NULL}, 1784, "udp"}, -{"windlm", {NULL}, 1785, "tcp"}, -{"windlm", {NULL}, 1785, "udp"}, -{"funk-logger", {NULL}, 1786, "tcp"}, -{"funk-logger", {NULL}, 1786, "udp"}, -{"funk-license", {NULL}, 1787, "tcp"}, -{"funk-license", {NULL}, 1787, "udp"}, -{"psmond", {NULL}, 1788, "tcp"}, -{"psmond", {NULL}, 1788, "udp"}, -{"hello", {NULL}, 1789, "tcp"}, -{"hello", {NULL}, 1789, "udp"}, -{"nmsp", {NULL}, 1790, "tcp"}, -{"nmsp", {NULL}, 1790, "udp"}, -{"ea1", {NULL}, 1791, "tcp"}, -{"ea1", {NULL}, 1791, "udp"}, -{"ibm-dt-2", {NULL}, 1792, "tcp"}, -{"ibm-dt-2", {NULL}, 1792, "udp"}, -{"rsc-robot", {NULL}, 1793, "tcp"}, -{"rsc-robot", {NULL}, 1793, "udp"}, -{"cera-bcm", {NULL}, 1794, "tcp"}, -{"cera-bcm", {NULL}, 1794, "udp"}, -{"dpi-proxy", {NULL}, 1795, "tcp"}, -{"dpi-proxy", {NULL}, 1795, "udp"}, -{"vocaltec-admin", {NULL}, 1796, "tcp"}, -{"vocaltec-admin", {NULL}, 1796, "udp"}, -{"uma", {NULL}, 1797, "tcp"}, -{"uma", {NULL}, 1797, "udp"}, -{"etp", {NULL}, 1798, "tcp"}, -{"etp", {NULL}, 1798, "udp"}, -{"netrisk", {NULL}, 1799, "tcp"}, -{"netrisk", {NULL}, 1799, "udp"}, -{"ansys-lm", {NULL}, 1800, "tcp"}, -{"ansys-lm", {NULL}, 1800, "udp"}, -{"msmq", {NULL}, 1801, "tcp"}, -{"msmq", {NULL}, 1801, "udp"}, -{"concomp1", {NULL}, 1802, "tcp"}, -{"concomp1", {NULL}, 1802, "udp"}, -{"hp-hcip-gwy", {NULL}, 1803, "tcp"}, -{"hp-hcip-gwy", {NULL}, 1803, "udp"}, -{"enl", {NULL}, 1804, "tcp"}, -{"enl", {NULL}, 1804, "udp"}, -{"enl-name", {NULL}, 1805, "tcp"}, -{"enl-name", {NULL}, 1805, "udp"}, -{"musiconline", {NULL}, 1806, "tcp"}, -{"musiconline", {NULL}, 1806, "udp"}, -{"fhsp", {NULL}, 1807, "tcp"}, -{"fhsp", {NULL}, 1807, "udp"}, -{"oracle-vp2", {NULL}, 1808, "tcp"}, -{"oracle-vp2", {NULL}, 1808, "udp"}, -{"oracle-vp1", {NULL}, 1809, "tcp"}, -{"oracle-vp1", {NULL}, 1809, "udp"}, -{"jerand-lm", {NULL}, 1810, "tcp"}, -{"jerand-lm", {NULL}, 1810, "udp"}, -{"scientia-sdb", {NULL}, 1811, "tcp"}, -{"scientia-sdb", {NULL}, 1811, "udp"}, -{"radius", {NULL}, 1812, "tcp"}, -{"radius", {NULL}, 1812, "udp"}, -{"radius-acct", {NULL}, 1813, "tcp"}, -{"radius-acct", {NULL}, 1813, "udp"}, -{"tdp-suite", {NULL}, 1814, "tcp"}, -{"tdp-suite", {NULL}, 1814, "udp"}, -{"mmpft", {NULL}, 1815, "tcp"}, -{"mmpft", {NULL}, 1815, "udp"}, -{"harp", {NULL}, 1816, "tcp"}, -{"harp", {NULL}, 1816, "udp"}, -{"rkb-oscs", {NULL}, 1817, "tcp"}, -{"rkb-oscs", {NULL}, 1817, "udp"}, -{"etftp", {NULL}, 1818, "tcp"}, -{"etftp", {NULL}, 1818, "udp"}, -{"plato-lm", {NULL}, 1819, "tcp"}, -{"plato-lm", {NULL}, 1819, "udp"}, -{"mcagent", {NULL}, 1820, "tcp"}, -{"mcagent", {NULL}, 1820, "udp"}, -{"donnyworld", {NULL}, 1821, "tcp"}, -{"donnyworld", {NULL}, 1821, "udp"}, -{"es-elmd", {NULL}, 1822, "tcp"}, -{"es-elmd", {NULL}, 1822, "udp"}, -{"unisys-lm", {NULL}, 1823, "tcp"}, -{"unisys-lm", {NULL}, 1823, "udp"}, -{"metrics-pas", {NULL}, 1824, "tcp"}, -{"metrics-pas", {NULL}, 1824, "udp"}, -{"direcpc-video", {NULL}, 1825, "tcp"}, -{"direcpc-video", {NULL}, 1825, "udp"}, -{"ardt", {NULL}, 1826, "tcp"}, -{"ardt", {NULL}, 1826, "udp"}, -{"asi", {NULL}, 1827, "tcp"}, -{"asi", {NULL}, 1827, "udp"}, -{"itm-mcell-u", {NULL}, 1828, "tcp"}, -{"itm-mcell-u", {NULL}, 1828, "udp"}, -{"optika-emedia", {NULL}, 1829, "tcp"}, -{"optika-emedia", {NULL}, 1829, "udp"}, -{"net8-cman", {NULL}, 1830, "tcp"}, -{"net8-cman", {NULL}, 1830, "udp"}, -{"myrtle", {NULL}, 1831, "tcp"}, -{"myrtle", {NULL}, 1831, "udp"}, -{"tht-treasure", {NULL}, 1832, "tcp"}, -{"tht-treasure", {NULL}, 1832, "udp"}, -{"udpradio", {NULL}, 1833, "tcp"}, -{"udpradio", {NULL}, 1833, "udp"}, -{"ardusuni", {NULL}, 1834, "tcp"}, -{"ardusuni", {NULL}, 1834, "udp"}, -{"ardusmul", {NULL}, 1835, "tcp"}, -{"ardusmul", {NULL}, 1835, "udp"}, -{"ste-smsc", {NULL}, 1836, "tcp"}, -{"ste-smsc", {NULL}, 1836, "udp"}, -{"csoft1", {NULL}, 1837, "tcp"}, -{"csoft1", {NULL}, 1837, "udp"}, -{"talnet", {NULL}, 1838, "tcp"}, -{"talnet", {NULL}, 1838, "udp"}, -{"netopia-vo1", {NULL}, 1839, "tcp"}, -{"netopia-vo1", {NULL}, 1839, "udp"}, -{"netopia-vo2", {NULL}, 1840, "tcp"}, -{"netopia-vo2", {NULL}, 1840, "udp"}, -{"netopia-vo3", {NULL}, 1841, "tcp"}, -{"netopia-vo3", {NULL}, 1841, "udp"}, -{"netopia-vo4", {NULL}, 1842, "tcp"}, -{"netopia-vo4", {NULL}, 1842, "udp"}, -{"netopia-vo5", {NULL}, 1843, "tcp"}, -{"netopia-vo5", {NULL}, 1843, "udp"}, -{"direcpc-dll", {NULL}, 1844, "tcp"}, -{"direcpc-dll", {NULL}, 1844, "udp"}, -{"altalink", {NULL}, 1845, "tcp"}, -{"altalink", {NULL}, 1845, "udp"}, -{"tunstall-pnc", {NULL}, 1846, "tcp"}, -{"tunstall-pnc", {NULL}, 1846, "udp"}, -{"slp-notify", {NULL}, 1847, "tcp"}, -{"slp-notify", {NULL}, 1847, "udp"}, -{"fjdocdist", {NULL}, 1848, "tcp"}, -{"fjdocdist", {NULL}, 1848, "udp"}, -{"alpha-sms", {NULL}, 1849, "tcp"}, -{"alpha-sms", {NULL}, 1849, "udp"}, -{"gsi", {NULL}, 1850, "tcp"}, -{"gsi", {NULL}, 1850, "udp"}, -{"ctcd", {NULL}, 1851, "tcp"}, -{"ctcd", {NULL}, 1851, "udp"}, -{"virtual-time", {NULL}, 1852, "tcp"}, -{"virtual-time", {NULL}, 1852, "udp"}, -{"vids-avtp", {NULL}, 1853, "tcp"}, -{"vids-avtp", {NULL}, 1853, "udp"}, -{"buddy-draw", {NULL}, 1854, "tcp"}, -{"buddy-draw", {NULL}, 1854, "udp"}, -{"fiorano-rtrsvc", {NULL}, 1855, "tcp"}, -{"fiorano-rtrsvc", {NULL}, 1855, "udp"}, -{"fiorano-msgsvc", {NULL}, 1856, "tcp"}, -{"fiorano-msgsvc", {NULL}, 1856, "udp"}, -{"datacaptor", {NULL}, 1857, "tcp"}, -{"datacaptor", {NULL}, 1857, "udp"}, -{"privateark", {NULL}, 1858, "tcp"}, -{"privateark", {NULL}, 1858, "udp"}, -{"gammafetchsvr", {NULL}, 1859, "tcp"}, -{"gammafetchsvr", {NULL}, 1859, "udp"}, -{"sunscalar-svc", {NULL}, 1860, "tcp"}, -{"sunscalar-svc", {NULL}, 1860, "udp"}, -{"lecroy-vicp", {NULL}, 1861, "tcp"}, -{"lecroy-vicp", {NULL}, 1861, "udp"}, -{"mysql-cm-agent", {NULL}, 1862, "tcp"}, -{"mysql-cm-agent", {NULL}, 1862, "udp"}, -{"msnp", {NULL}, 1863, "tcp"}, -{"msnp", {NULL}, 1863, "udp"}, -{"paradym-31port", {NULL}, 1864, "tcp"}, -{"paradym-31port", {NULL}, 1864, "udp"}, -{"entp", {NULL}, 1865, "tcp"}, -{"entp", {NULL}, 1865, "udp"}, -{"swrmi", {NULL}, 1866, "tcp"}, -{"swrmi", {NULL}, 1866, "udp"}, -{"udrive", {NULL}, 1867, "tcp"}, -{"udrive", {NULL}, 1867, "udp"}, -{"viziblebrowser", {NULL}, 1868, "tcp"}, -{"viziblebrowser", {NULL}, 1868, "udp"}, -{"transact", {NULL}, 1869, "tcp"}, -{"transact", {NULL}, 1869, "udp"}, -{"sunscalar-dns", {NULL}, 1870, "tcp"}, -{"sunscalar-dns", {NULL}, 1870, "udp"}, -{"canocentral0", {NULL}, 1871, "tcp"}, -{"canocentral0", {NULL}, 1871, "udp"}, -{"canocentral1", {NULL}, 1872, "tcp"}, -{"canocentral1", {NULL}, 1872, "udp"}, -{"fjmpjps", {NULL}, 1873, "tcp"}, -{"fjmpjps", {NULL}, 1873, "udp"}, -{"fjswapsnp", {NULL}, 1874, "tcp"}, -{"fjswapsnp", {NULL}, 1874, "udp"}, -{"westell-stats", {NULL}, 1875, "tcp"}, -{"westell-stats", {NULL}, 1875, "udp"}, -{"ewcappsrv", {NULL}, 1876, "tcp"}, -{"ewcappsrv", {NULL}, 1876, "udp"}, -{"hp-webqosdb", {NULL}, 1877, "tcp"}, -{"hp-webqosdb", {NULL}, 1877, "udp"}, -{"drmsmc", {NULL}, 1878, "tcp"}, -{"drmsmc", {NULL}, 1878, "udp"}, -{"nettgain-nms", {NULL}, 1879, "tcp"}, -{"nettgain-nms", {NULL}, 1879, "udp"}, -{"vsat-control", {NULL}, 1880, "tcp"}, -{"vsat-control", {NULL}, 1880, "udp"}, -{"ibm-mqseries2", {NULL}, 1881, "tcp"}, -{"ibm-mqseries2", {NULL}, 1881, "udp"}, -{"ecsqdmn", {NULL}, 1882, "tcp"}, -{"ecsqdmn", {NULL}, 1882, "udp"}, -{"ibm-mqisdp", {NULL}, 1883, "tcp"}, -{"ibm-mqisdp", {NULL}, 1883, "udp"}, -{"idmaps", {NULL}, 1884, "tcp"}, -{"idmaps", {NULL}, 1884, "udp"}, -{"vrtstrapserver", {NULL}, 1885, "tcp"}, -{"vrtstrapserver", {NULL}, 1885, "udp"}, -{"leoip", {NULL}, 1886, "tcp"}, -{"leoip", {NULL}, 1886, "udp"}, -{"filex-lport", {NULL}, 1887, "tcp"}, -{"filex-lport", {NULL}, 1887, "udp"}, -{"ncconfig", {NULL}, 1888, "tcp"}, -{"ncconfig", {NULL}, 1888, "udp"}, -{"unify-adapter", {NULL}, 1889, "tcp"}, -{"unify-adapter", {NULL}, 1889, "udp"}, -{"wilkenlistener", {NULL}, 1890, "tcp"}, -{"wilkenlistener", {NULL}, 1890, "udp"}, -{"childkey-notif", {NULL}, 1891, "tcp"}, -{"childkey-notif", {NULL}, 1891, "udp"}, -{"childkey-ctrl", {NULL}, 1892, "tcp"}, -{"childkey-ctrl", {NULL}, 1892, "udp"}, -{"elad", {NULL}, 1893, "tcp"}, -{"elad", {NULL}, 1893, "udp"}, -{"o2server-port", {NULL}, 1894, "tcp"}, -{"o2server-port", {NULL}, 1894, "udp"}, -{"b-novative-ls", {NULL}, 1896, "tcp"}, -{"b-novative-ls", {NULL}, 1896, "udp"}, -{"metaagent", {NULL}, 1897, "tcp"}, -{"metaagent", {NULL}, 1897, "udp"}, -{"cymtec-port", {NULL}, 1898, "tcp"}, -{"cymtec-port", {NULL}, 1898, "udp"}, -{"mc2studios", {NULL}, 1899, "tcp"}, -{"mc2studios", {NULL}, 1899, "udp"}, -{"ssdp", {NULL}, 1900, "tcp"}, -{"ssdp", {NULL}, 1900, "udp"}, -{"fjicl-tep-a", {NULL}, 1901, "tcp"}, -{"fjicl-tep-a", {NULL}, 1901, "udp"}, -{"fjicl-tep-b", {NULL}, 1902, "tcp"}, -{"fjicl-tep-b", {NULL}, 1902, "udp"}, -{"linkname", {NULL}, 1903, "tcp"}, -{"linkname", {NULL}, 1903, "udp"}, -{"fjicl-tep-c", {NULL}, 1904, "tcp"}, -{"fjicl-tep-c", {NULL}, 1904, "udp"}, -{"sugp", {NULL}, 1905, "tcp"}, -{"sugp", {NULL}, 1905, "udp"}, -{"tpmd", {NULL}, 1906, "tcp"}, -{"tpmd", {NULL}, 1906, "udp"}, -{"intrastar", {NULL}, 1907, "tcp"}, -{"intrastar", {NULL}, 1907, "udp"}, -{"dawn", {NULL}, 1908, "tcp"}, -{"dawn", {NULL}, 1908, "udp"}, -{"global-wlink", {NULL}, 1909, "tcp"}, -{"global-wlink", {NULL}, 1909, "udp"}, -{"ultrabac", {NULL}, 1910, "tcp"}, -{"ultrabac", {NULL}, 1910, "udp"}, -{"mtp", {NULL}, 1911, "tcp"}, -{"mtp", {NULL}, 1911, "udp"}, -{"rhp-iibp", {NULL}, 1912, "tcp"}, -{"rhp-iibp", {NULL}, 1912, "udp"}, -{"armadp", {NULL}, 1913, "tcp"}, -{"armadp", {NULL}, 1913, "udp"}, -{"elm-momentum", {NULL}, 1914, "tcp"}, -{"elm-momentum", {NULL}, 1914, "udp"}, -{"facelink", {NULL}, 1915, "tcp"}, -{"facelink", {NULL}, 1915, "udp"}, -{"persona", {NULL}, 1916, "tcp"}, -{"persona", {NULL}, 1916, "udp"}, -{"noagent", {NULL}, 1917, "tcp"}, -{"noagent", {NULL}, 1917, "udp"}, -{"can-nds", {NULL}, 1918, "tcp"}, -{"can-nds", {NULL}, 1918, "udp"}, -{"can-dch", {NULL}, 1919, "tcp"}, -{"can-dch", {NULL}, 1919, "udp"}, -{"can-ferret", {NULL}, 1920, "tcp"}, -{"can-ferret", {NULL}, 1920, "udp"}, -{"noadmin", {NULL}, 1921, "tcp"}, -{"noadmin", {NULL}, 1921, "udp"}, -{"tapestry", {NULL}, 1922, "tcp"}, -{"tapestry", {NULL}, 1922, "udp"}, -{"spice", {NULL}, 1923, "tcp"}, -{"spice", {NULL}, 1923, "udp"}, -{"xiip", {NULL}, 1924, "tcp"}, -{"xiip", {NULL}, 1924, "udp"}, -{"discovery-port", {NULL}, 1925, "tcp"}, -{"discovery-port", {NULL}, 1925, "udp"}, -{"egs", {NULL}, 1926, "tcp"}, -{"egs", {NULL}, 1926, "udp"}, -{"videte-cipc", {NULL}, 1927, "tcp"}, -{"videte-cipc", {NULL}, 1927, "udp"}, -{"emsd-port", {NULL}, 1928, "tcp"}, -{"emsd-port", {NULL}, 1928, "udp"}, -{"bandwiz-system", {NULL}, 1929, "tcp"}, -{"bandwiz-system", {NULL}, 1929, "udp"}, -{"driveappserver", {NULL}, 1930, "tcp"}, -{"driveappserver", {NULL}, 1930, "udp"}, -{"amdsched", {NULL}, 1931, "tcp"}, -{"amdsched", {NULL}, 1931, "udp"}, -{"ctt-broker", {NULL}, 1932, "tcp"}, -{"ctt-broker", {NULL}, 1932, "udp"}, -{"xmapi", {NULL}, 1933, "tcp"}, -{"xmapi", {NULL}, 1933, "udp"}, -{"xaapi", {NULL}, 1934, "tcp"}, -{"xaapi", {NULL}, 1934, "udp"}, -{"macromedia-fcs", {NULL}, 1935, "tcp"}, -{"macromedia-fcs", {NULL}, 1935, "udp"}, -{"jetcmeserver", {NULL}, 1936, "tcp"}, -{"jetcmeserver", {NULL}, 1936, "udp"}, -{"jwserver", {NULL}, 1937, "tcp"}, -{"jwserver", {NULL}, 1937, "udp"}, -{"jwclient", {NULL}, 1938, "tcp"}, -{"jwclient", {NULL}, 1938, "udp"}, -{"jvserver", {NULL}, 1939, "tcp"}, -{"jvserver", {NULL}, 1939, "udp"}, -{"jvclient", {NULL}, 1940, "tcp"}, -{"jvclient", {NULL}, 1940, "udp"}, -{"dic-aida", {NULL}, 1941, "tcp"}, -{"dic-aida", {NULL}, 1941, "udp"}, -{"res", {NULL}, 1942, "tcp"}, -{"res", {NULL}, 1942, "udp"}, -{"beeyond-media", {NULL}, 1943, "tcp"}, -{"beeyond-media", {NULL}, 1943, "udp"}, -{"close-combat", {NULL}, 1944, "tcp"}, -{"close-combat", {NULL}, 1944, "udp"}, -{"dialogic-elmd", {NULL}, 1945, "tcp"}, -{"dialogic-elmd", {NULL}, 1945, "udp"}, -{"tekpls", {NULL}, 1946, "tcp"}, -{"tekpls", {NULL}, 1946, "udp"}, -{"sentinelsrm", {NULL}, 1947, "tcp"}, -{"sentinelsrm", {NULL}, 1947, "udp"}, -{"eye2eye", {NULL}, 1948, "tcp"}, -{"eye2eye", {NULL}, 1948, "udp"}, -{"ismaeasdaqlive", {NULL}, 1949, "tcp"}, -{"ismaeasdaqlive", {NULL}, 1949, "udp"}, -{"ismaeasdaqtest", {NULL}, 1950, "tcp"}, -{"ismaeasdaqtest", {NULL}, 1950, "udp"}, -{"bcs-lmserver", {NULL}, 1951, "tcp"}, -{"bcs-lmserver", {NULL}, 1951, "udp"}, -{"mpnjsc", {NULL}, 1952, "tcp"}, -{"mpnjsc", {NULL}, 1952, "udp"}, -{"rapidbase", {NULL}, 1953, "tcp"}, -{"rapidbase", {NULL}, 1953, "udp"}, -{"abr-api", {NULL}, 1954, "tcp"}, -{"abr-api", {NULL}, 1954, "udp"}, -{"abr-secure", {NULL}, 1955, "tcp"}, -{"abr-secure", {NULL}, 1955, "udp"}, -{"vrtl-vmf-ds", {NULL}, 1956, "tcp"}, -{"vrtl-vmf-ds", {NULL}, 1956, "udp"}, -{"unix-status", {NULL}, 1957, "tcp"}, -{"unix-status", {NULL}, 1957, "udp"}, -{"dxadmind", {NULL}, 1958, "tcp"}, -{"dxadmind", {NULL}, 1958, "udp"}, -{"simp-all", {NULL}, 1959, "tcp"}, -{"simp-all", {NULL}, 1959, "udp"}, -{"nasmanager", {NULL}, 1960, "tcp"}, -{"nasmanager", {NULL}, 1960, "udp"}, -{"bts-appserver", {NULL}, 1961, "tcp"}, -{"bts-appserver", {NULL}, 1961, "udp"}, -{"biap-mp", {NULL}, 1962, "tcp"}, -{"biap-mp", {NULL}, 1962, "udp"}, -{"webmachine", {NULL}, 1963, "tcp"}, -{"webmachine", {NULL}, 1963, "udp"}, -{"solid-e-engine", {NULL}, 1964, "tcp"}, -{"solid-e-engine", {NULL}, 1964, "udp"}, -{"tivoli-npm", {NULL}, 1965, "tcp"}, -{"tivoli-npm", {NULL}, 1965, "udp"}, -{"slush", {NULL}, 1966, "tcp"}, -{"slush", {NULL}, 1966, "udp"}, -{"sns-quote", {NULL}, 1967, "tcp"}, -{"sns-quote", {NULL}, 1967, "udp"}, -{"lipsinc", {NULL}, 1968, "tcp"}, -{"lipsinc", {NULL}, 1968, "udp"}, -{"lipsinc1", {NULL}, 1969, "tcp"}, -{"lipsinc1", {NULL}, 1969, "udp"}, -{"netop-rc", {NULL}, 1970, "tcp"}, -{"netop-rc", {NULL}, 1970, "udp"}, -{"netop-school", {NULL}, 1971, "tcp"}, -{"netop-school", {NULL}, 1971, "udp"}, -{"intersys-cache", {NULL}, 1972, "tcp"}, -{"intersys-cache", {NULL}, 1972, "udp"}, -{"dlsrap", {NULL}, 1973, "tcp"}, -{"dlsrap", {NULL}, 1973, "udp"}, -{"drp", {NULL}, 1974, "tcp"}, -{"drp", {NULL}, 1974, "udp"}, -{"tcoflashagent", {NULL}, 1975, "tcp"}, -{"tcoflashagent", {NULL}, 1975, "udp"}, -{"tcoregagent", {NULL}, 1976, "tcp"}, -{"tcoregagent", {NULL}, 1976, "udp"}, -{"tcoaddressbook", {NULL}, 1977, "tcp"}, -{"tcoaddressbook", {NULL}, 1977, "udp"}, -{"unisql", {NULL}, 1978, "tcp"}, -{"unisql", {NULL}, 1978, "udp"}, -{"unisql-java", {NULL}, 1979, "tcp"}, -{"unisql-java", {NULL}, 1979, "udp"}, -{"pearldoc-xact", {NULL}, 1980, "tcp"}, -{"pearldoc-xact", {NULL}, 1980, "udp"}, -{"p2pq", {NULL}, 1981, "tcp"}, -{"p2pq", {NULL}, 1981, "udp"}, -{"estamp", {NULL}, 1982, "tcp"}, -{"estamp", {NULL}, 1982, "udp"}, -{"lhtp", {NULL}, 1983, "tcp"}, -{"lhtp", {NULL}, 1983, "udp"}, -{"bb", {NULL}, 1984, "tcp"}, -{"bb", {NULL}, 1984, "udp"}, -{"hsrp", {NULL}, 1985, "tcp"}, -{"hsrp", {NULL}, 1985, "udp"}, -{"licensedaemon", {NULL}, 1986, "tcp"}, -{"licensedaemon", {NULL}, 1986, "udp"}, -{"tr-rsrb-p1", {NULL}, 1987, "tcp"}, -{"tr-rsrb-p1", {NULL}, 1987, "udp"}, -{"tr-rsrb-p2", {NULL}, 1988, "tcp"}, -{"tr-rsrb-p2", {NULL}, 1988, "udp"}, -{"tr-rsrb-p3", {NULL}, 1989, "tcp"}, -{"tr-rsrb-p3", {NULL}, 1989, "udp"}, -{"mshnet", {NULL}, 1989, "tcp"}, -{"mshnet", {NULL}, 1989, "udp"}, -{"stun-p1", {NULL}, 1990, "tcp"}, -{"stun-p1", {NULL}, 1990, "udp"}, -{"stun-p2", {NULL}, 1991, "tcp"}, -{"stun-p2", {NULL}, 1991, "udp"}, -{"stun-p3", {NULL}, 1992, "tcp"}, -{"stun-p3", {NULL}, 1992, "udp"}, -{"ipsendmsg", {NULL}, 1992, "tcp"}, -{"ipsendmsg", {NULL}, 1992, "udp"}, -{"snmp-tcp-port", {NULL}, 1993, "tcp"}, -{"snmp-tcp-port", {NULL}, 1993, "udp"}, -{"stun-port", {NULL}, 1994, "tcp"}, -{"stun-port", {NULL}, 1994, "udp"}, -{"perf-port", {NULL}, 1995, "tcp"}, -{"perf-port", {NULL}, 1995, "udp"}, -{"tr-rsrb-port", {NULL}, 1996, "tcp"}, -{"tr-rsrb-port", {NULL}, 1996, "udp"}, -{"gdp-port", {NULL}, 1997, "tcp"}, -{"gdp-port", {NULL}, 1997, "udp"}, -{"x25-svc-port", {NULL}, 1998, "tcp"}, -{"x25-svc-port", {NULL}, 1998, "udp"}, -{"tcp-id-port", {NULL}, 1999, "tcp"}, -{"tcp-id-port", {NULL}, 1999, "udp"}, -{"cisco-sccp", {NULL}, 2000, "tcp"}, -{"cisco-sccp", {NULL}, 2000, "udp"}, -{"dc", {NULL}, 2001, "tcp"}, -{"wizard", {NULL}, 2001, "udp"}, -{"globe", {NULL}, 2002, "tcp"}, -{"globe", {NULL}, 2002, "udp"}, -{"brutus", {NULL}, 2003, "tcp"}, -{"brutus", {NULL}, 2003, "udp"}, -{"mailbox", {NULL}, 2004, "tcp"}, -{"emce", {NULL}, 2004, "udp"}, -{"berknet", {NULL}, 2005, "tcp"}, -{"oracle", {NULL}, 2005, "udp"}, -{"invokator", {NULL}, 2006, "tcp"}, -{"raid-cd", {NULL}, 2006, "udp"}, -{"dectalk", {NULL}, 2007, "tcp"}, -{"raid-am", {NULL}, 2007, "udp"}, -{"conf", {NULL}, 2008, "tcp"}, -{"terminaldb", {NULL}, 2008, "udp"}, -{"news", {NULL}, 2009, "tcp"}, -{"whosockami", {NULL}, 2009, "udp"}, -{"search", {NULL}, 2010, "tcp"}, -{"pipe_server", {NULL}, 2010, "udp"}, -{"raid-cc", {NULL}, 2011, "tcp"}, -{"servserv", {NULL}, 2011, "udp"}, -{"ttyinfo", {NULL}, 2012, "tcp"}, -{"raid-ac", {NULL}, 2012, "udp"}, -{"raid-am", {NULL}, 2013, "tcp"}, -{"raid-cd", {NULL}, 2013, "udp"}, -{"troff", {NULL}, 2014, "tcp"}, -{"raid-sf", {NULL}, 2014, "udp"}, -{"cypress", {NULL}, 2015, "tcp"}, -{"raid-cs", {NULL}, 2015, "udp"}, -{"bootserver", {NULL}, 2016, "tcp"}, -{"bootserver", {NULL}, 2016, "udp"}, -{"cypress-stat", {NULL}, 2017, "tcp"}, -{"bootclient", {NULL}, 2017, "udp"}, -{"terminaldb", {NULL}, 2018, "tcp"}, -{"rellpack", {NULL}, 2018, "udp"}, -{"whosockami", {NULL}, 2019, "tcp"}, -{"about", {NULL}, 2019, "udp"}, -{"xinupageserver", {NULL}, 2020, "tcp"}, -{"xinupageserver", {NULL}, 2020, "udp"}, -{"servexec", {NULL}, 2021, "tcp"}, -{"xinuexpansion1", {NULL}, 2021, "udp"}, -{"down", {NULL}, 2022, "tcp"}, -{"xinuexpansion2", {NULL}, 2022, "udp"}, -{"xinuexpansion3", {NULL}, 2023, "tcp"}, -{"xinuexpansion3", {NULL}, 2023, "udp"}, -{"xinuexpansion4", {NULL}, 2024, "tcp"}, -{"xinuexpansion4", {NULL}, 2024, "udp"}, -{"ellpack", {NULL}, 2025, "tcp"}, -{"xribs", {NULL}, 2025, "udp"}, -{"scrabble", {NULL}, 2026, "tcp"}, -{"scrabble", {NULL}, 2026, "udp"}, -{"shadowserver", {NULL}, 2027, "tcp"}, -{"shadowserver", {NULL}, 2027, "udp"}, -{"submitserver", {NULL}, 2028, "tcp"}, -{"submitserver", {NULL}, 2028, "udp"}, -{"hsrpv6", {NULL}, 2029, "tcp"}, -{"hsrpv6", {NULL}, 2029, "udp"}, -{"device2", {NULL}, 2030, "tcp"}, -{"device2", {NULL}, 2030, "udp"}, -{"mobrien-chat", {NULL}, 2031, "tcp"}, -{"mobrien-chat", {NULL}, 2031, "udp"}, -{"blackboard", {NULL}, 2032, "tcp"}, -{"blackboard", {NULL}, 2032, "udp"}, -{"glogger", {NULL}, 2033, "tcp"}, -{"glogger", {NULL}, 2033, "udp"}, -{"scoremgr", {NULL}, 2034, "tcp"}, -{"scoremgr", {NULL}, 2034, "udp"}, -{"imsldoc", {NULL}, 2035, "tcp"}, -{"imsldoc", {NULL}, 2035, "udp"}, -{"e-dpnet", {NULL}, 2036, "tcp"}, -{"e-dpnet", {NULL}, 2036, "udp"}, -{"applus", {NULL}, 2037, "tcp"}, -{"applus", {NULL}, 2037, "udp"}, -{"objectmanager", {NULL}, 2038, "tcp"}, -{"objectmanager", {NULL}, 2038, "udp"}, -{"prizma", {NULL}, 2039, "tcp"}, -{"prizma", {NULL}, 2039, "udp"}, -{"lam", {NULL}, 2040, "tcp"}, -{"lam", {NULL}, 2040, "udp"}, -{"interbase", {NULL}, 2041, "tcp"}, -{"interbase", {NULL}, 2041, "udp"}, -{"isis", {NULL}, 2042, "tcp"}, -{"isis", {NULL}, 2042, "udp"}, -{"isis-bcast", {NULL}, 2043, "tcp"}, -{"isis-bcast", {NULL}, 2043, "udp"}, -{"rimsl", {NULL}, 2044, "tcp"}, -{"rimsl", {NULL}, 2044, "udp"}, -{"cdfunc", {NULL}, 2045, "tcp"}, -{"cdfunc", {NULL}, 2045, "udp"}, -{"sdfunc", {NULL}, 2046, "tcp"}, -{"sdfunc", {NULL}, 2046, "udp"}, -{"dls", {NULL}, 2047, "tcp"}, -{"dls", {NULL}, 2047, "udp"}, -{"dls-monitor", {NULL}, 2048, "tcp"}, -{"dls-monitor", {NULL}, 2048, "udp"}, -{"shilp", {NULL}, 2049, "tcp"}, -{"shilp", {NULL}, 2049, "udp"}, -{"nfs", {NULL}, 2049, "tcp"}, -{"nfs", {NULL}, 2049, "udp"}, -{"nfs", {NULL}, 2049, "sctp"}, -{"av-emb-config", {NULL}, 2050, "tcp"}, -{"av-emb-config", {NULL}, 2050, "udp"}, -{"epnsdp", {NULL}, 2051, "tcp"}, -{"epnsdp", {NULL}, 2051, "udp"}, -{"clearvisn", {NULL}, 2052, "tcp"}, -{"clearvisn", {NULL}, 2052, "udp"}, -{"lot105-ds-upd", {NULL}, 2053, "tcp"}, -{"lot105-ds-upd", {NULL}, 2053, "udp"}, -{"weblogin", {NULL}, 2054, "tcp"}, -{"weblogin", {NULL}, 2054, "udp"}, -{"iop", {NULL}, 2055, "tcp"}, -{"iop", {NULL}, 2055, "udp"}, -{"omnisky", {NULL}, 2056, "tcp"}, -{"omnisky", {NULL}, 2056, "udp"}, -{"rich-cp", {NULL}, 2057, "tcp"}, -{"rich-cp", {NULL}, 2057, "udp"}, -{"newwavesearch", {NULL}, 2058, "tcp"}, -{"newwavesearch", {NULL}, 2058, "udp"}, -{"bmc-messaging", {NULL}, 2059, "tcp"}, -{"bmc-messaging", {NULL}, 2059, "udp"}, -{"teleniumdaemon", {NULL}, 2060, "tcp"}, -{"teleniumdaemon", {NULL}, 2060, "udp"}, -{"netmount", {NULL}, 2061, "tcp"}, -{"netmount", {NULL}, 2061, "udp"}, -{"icg-swp", {NULL}, 2062, "tcp"}, -{"icg-swp", {NULL}, 2062, "udp"}, -{"icg-bridge", {NULL}, 2063, "tcp"}, -{"icg-bridge", {NULL}, 2063, "udp"}, -{"icg-iprelay", {NULL}, 2064, "tcp"}, -{"icg-iprelay", {NULL}, 2064, "udp"}, -{"dlsrpn", {NULL}, 2065, "tcp"}, -{"dlsrpn", {NULL}, 2065, "udp"}, -{"aura", {NULL}, 2066, "tcp"}, -{"aura", {NULL}, 2066, "udp"}, -{"dlswpn", {NULL}, 2067, "tcp"}, -{"dlswpn", {NULL}, 2067, "udp"}, -{"avauthsrvprtcl", {NULL}, 2068, "tcp"}, -{"avauthsrvprtcl", {NULL}, 2068, "udp"}, -{"event-port", {NULL}, 2069, "tcp"}, -{"event-port", {NULL}, 2069, "udp"}, -{"ah-esp-encap", {NULL}, 2070, "tcp"}, -{"ah-esp-encap", {NULL}, 2070, "udp"}, -{"acp-port", {NULL}, 2071, "tcp"}, -{"acp-port", {NULL}, 2071, "udp"}, -{"msync", {NULL}, 2072, "tcp"}, -{"msync", {NULL}, 2072, "udp"}, -{"gxs-data-port", {NULL}, 2073, "tcp"}, -{"gxs-data-port", {NULL}, 2073, "udp"}, -{"vrtl-vmf-sa", {NULL}, 2074, "tcp"}, -{"vrtl-vmf-sa", {NULL}, 2074, "udp"}, -{"newlixengine", {NULL}, 2075, "tcp"}, -{"newlixengine", {NULL}, 2075, "udp"}, -{"newlixconfig", {NULL}, 2076, "tcp"}, -{"newlixconfig", {NULL}, 2076, "udp"}, -{"tsrmagt", {NULL}, 2077, "tcp"}, -{"tsrmagt", {NULL}, 2077, "udp"}, -{"tpcsrvr", {NULL}, 2078, "tcp"}, -{"tpcsrvr", {NULL}, 2078, "udp"}, -{"idware-router", {NULL}, 2079, "tcp"}, -{"idware-router", {NULL}, 2079, "udp"}, -{"autodesk-nlm", {NULL}, 2080, "tcp"}, -{"autodesk-nlm", {NULL}, 2080, "udp"}, -{"kme-trap-port", {NULL}, 2081, "tcp"}, -{"kme-trap-port", {NULL}, 2081, "udp"}, -{"infowave", {NULL}, 2082, "tcp"}, -{"infowave", {NULL}, 2082, "udp"}, -{"radsec", {NULL}, 2083, "tcp"}, -{"radsec", {NULL}, 2083, "udp"}, -{"sunclustergeo", {NULL}, 2084, "tcp"}, -{"sunclustergeo", {NULL}, 2084, "udp"}, -{"ada-cip", {NULL}, 2085, "tcp"}, -{"ada-cip", {NULL}, 2085, "udp"}, -{"gnunet", {NULL}, 2086, "tcp"}, -{"gnunet", {NULL}, 2086, "udp"}, -{"eli", {NULL}, 2087, "tcp"}, -{"eli", {NULL}, 2087, "udp"}, -{"ip-blf", {NULL}, 2088, "tcp"}, -{"ip-blf", {NULL}, 2088, "udp"}, -{"sep", {NULL}, 2089, "tcp"}, -{"sep", {NULL}, 2089, "udp"}, -{"lrp", {NULL}, 2090, "tcp"}, -{"lrp", {NULL}, 2090, "udp"}, -{"prp", {NULL}, 2091, "tcp"}, -{"prp", {NULL}, 2091, "udp"}, -{"descent3", {NULL}, 2092, "tcp"}, -{"descent3", {NULL}, 2092, "udp"}, -{"nbx-cc", {NULL}, 2093, "tcp"}, -{"nbx-cc", {NULL}, 2093, "udp"}, -{"nbx-au", {NULL}, 2094, "tcp"}, -{"nbx-au", {NULL}, 2094, "udp"}, -{"nbx-ser", {NULL}, 2095, "tcp"}, -{"nbx-ser", {NULL}, 2095, "udp"}, -{"nbx-dir", {NULL}, 2096, "tcp"}, -{"nbx-dir", {NULL}, 2096, "udp"}, -{"jetformpreview", {NULL}, 2097, "tcp"}, -{"jetformpreview", {NULL}, 2097, "udp"}, -{"dialog-port", {NULL}, 2098, "tcp"}, -{"dialog-port", {NULL}, 2098, "udp"}, -{"h2250-annex-g", {NULL}, 2099, "tcp"}, -{"h2250-annex-g", {NULL}, 2099, "udp"}, -{"amiganetfs", {NULL}, 2100, "tcp"}, -{"amiganetfs", {NULL}, 2100, "udp"}, -{"rtcm-sc104", {NULL}, 2101, "tcp"}, -{"rtcm-sc104", {NULL}, 2101, "udp"}, -{"zephyr-srv", {NULL}, 2102, "tcp"}, -{"zephyr-srv", {NULL}, 2102, "udp"}, -{"zephyr-clt", {NULL}, 2103, "tcp"}, -{"zephyr-clt", {NULL}, 2103, "udp"}, -{"zephyr-hm", {NULL}, 2104, "tcp"}, -{"zephyr-hm", {NULL}, 2104, "udp"}, -{"minipay", {NULL}, 2105, "tcp"}, -{"minipay", {NULL}, 2105, "udp"}, -{"mzap", {NULL}, 2106, "tcp"}, -{"mzap", {NULL}, 2106, "udp"}, -{"bintec-admin", {NULL}, 2107, "tcp"}, -{"bintec-admin", {NULL}, 2107, "udp"}, -{"comcam", {NULL}, 2108, "tcp"}, -{"comcam", {NULL}, 2108, "udp"}, -{"ergolight", {NULL}, 2109, "tcp"}, -{"ergolight", {NULL}, 2109, "udp"}, -{"umsp", {NULL}, 2110, "tcp"}, -{"umsp", {NULL}, 2110, "udp"}, -{"dsatp", {NULL}, 2111, "tcp"}, -{"dsatp", {NULL}, 2111, "udp"}, -{"idonix-metanet", {NULL}, 2112, "tcp"}, -{"idonix-metanet", {NULL}, 2112, "udp"}, -{"hsl-storm", {NULL}, 2113, "tcp"}, -{"hsl-storm", {NULL}, 2113, "udp"}, -{"newheights", {NULL}, 2114, "tcp"}, -{"newheights", {NULL}, 2114, "udp"}, -{"kdm", {NULL}, 2115, "tcp"}, -{"kdm", {NULL}, 2115, "udp"}, -{"ccowcmr", {NULL}, 2116, "tcp"}, -{"ccowcmr", {NULL}, 2116, "udp"}, -{"mentaclient", {NULL}, 2117, "tcp"}, -{"mentaclient", {NULL}, 2117, "udp"}, -{"mentaserver", {NULL}, 2118, "tcp"}, -{"mentaserver", {NULL}, 2118, "udp"}, -{"gsigatekeeper", {NULL}, 2119, "tcp"}, -{"gsigatekeeper", {NULL}, 2119, "udp"}, -{"qencp", {NULL}, 2120, "tcp"}, -{"qencp", {NULL}, 2120, "udp"}, -{"scientia-ssdb", {NULL}, 2121, "tcp"}, -{"scientia-ssdb", {NULL}, 2121, "udp"}, -{"caupc-remote", {NULL}, 2122, "tcp"}, -{"caupc-remote", {NULL}, 2122, "udp"}, -{"gtp-control", {NULL}, 2123, "tcp"}, -{"gtp-control", {NULL}, 2123, "udp"}, -{"elatelink", {NULL}, 2124, "tcp"}, -{"elatelink", {NULL}, 2124, "udp"}, -{"lockstep", {NULL}, 2125, "tcp"}, -{"lockstep", {NULL}, 2125, "udp"}, -{"pktcable-cops", {NULL}, 2126, "tcp"}, -{"pktcable-cops", {NULL}, 2126, "udp"}, -{"index-pc-wb", {NULL}, 2127, "tcp"}, -{"index-pc-wb", {NULL}, 2127, "udp"}, -{"net-steward", {NULL}, 2128, "tcp"}, -{"net-steward", {NULL}, 2128, "udp"}, -{"cs-live", {NULL}, 2129, "tcp"}, -{"cs-live", {NULL}, 2129, "udp"}, -{"xds", {NULL}, 2130, "tcp"}, -{"xds", {NULL}, 2130, "udp"}, -{"avantageb2b", {NULL}, 2131, "tcp"}, -{"avantageb2b", {NULL}, 2131, "udp"}, -{"solera-epmap", {NULL}, 2132, "tcp"}, -{"solera-epmap", {NULL}, 2132, "udp"}, -{"zymed-zpp", {NULL}, 2133, "tcp"}, -{"zymed-zpp", {NULL}, 2133, "udp"}, -{"avenue", {NULL}, 2134, "tcp"}, -{"avenue", {NULL}, 2134, "udp"}, -{"gris", {NULL}, 2135, "tcp"}, -{"gris", {NULL}, 2135, "udp"}, -{"appworxsrv", {NULL}, 2136, "tcp"}, -{"appworxsrv", {NULL}, 2136, "udp"}, -{"connect", {NULL}, 2137, "tcp"}, -{"connect", {NULL}, 2137, "udp"}, -{"unbind-cluster", {NULL}, 2138, "tcp"}, -{"unbind-cluster", {NULL}, 2138, "udp"}, -{"ias-auth", {NULL}, 2139, "tcp"}, -{"ias-auth", {NULL}, 2139, "udp"}, -{"ias-reg", {NULL}, 2140, "tcp"}, -{"ias-reg", {NULL}, 2140, "udp"}, -{"ias-admind", {NULL}, 2141, "tcp"}, -{"ias-admind", {NULL}, 2141, "udp"}, -{"tdmoip", {NULL}, 2142, "tcp"}, -{"tdmoip", {NULL}, 2142, "udp"}, -{"lv-jc", {NULL}, 2143, "tcp"}, -{"lv-jc", {NULL}, 2143, "udp"}, -{"lv-ffx", {NULL}, 2144, "tcp"}, -{"lv-ffx", {NULL}, 2144, "udp"}, -{"lv-pici", {NULL}, 2145, "tcp"}, -{"lv-pici", {NULL}, 2145, "udp"}, -{"lv-not", {NULL}, 2146, "tcp"}, -{"lv-not", {NULL}, 2146, "udp"}, -{"lv-auth", {NULL}, 2147, "tcp"}, -{"lv-auth", {NULL}, 2147, "udp"}, -{"veritas-ucl", {NULL}, 2148, "tcp"}, -{"veritas-ucl", {NULL}, 2148, "udp"}, -{"acptsys", {NULL}, 2149, "tcp"}, -{"acptsys", {NULL}, 2149, "udp"}, -{"dynamic3d", {NULL}, 2150, "tcp"}, -{"dynamic3d", {NULL}, 2150, "udp"}, -{"docent", {NULL}, 2151, "tcp"}, -{"docent", {NULL}, 2151, "udp"}, -{"gtp-user", {NULL}, 2152, "tcp"}, -{"gtp-user", {NULL}, 2152, "udp"}, -{"ctlptc", {NULL}, 2153, "tcp"}, -{"ctlptc", {NULL}, 2153, "udp"}, -{"stdptc", {NULL}, 2154, "tcp"}, -{"stdptc", {NULL}, 2154, "udp"}, -{"brdptc", {NULL}, 2155, "tcp"}, -{"brdptc", {NULL}, 2155, "udp"}, -{"trp", {NULL}, 2156, "tcp"}, -{"trp", {NULL}, 2156, "udp"}, -{"xnds", {NULL}, 2157, "tcp"}, -{"xnds", {NULL}, 2157, "udp"}, -{"touchnetplus", {NULL}, 2158, "tcp"}, -{"touchnetplus", {NULL}, 2158, "udp"}, -{"gdbremote", {NULL}, 2159, "tcp"}, -{"gdbremote", {NULL}, 2159, "udp"}, -{"apc-2160", {NULL}, 2160, "tcp"}, -{"apc-2160", {NULL}, 2160, "udp"}, -{"apc-2161", {NULL}, 2161, "tcp"}, -{"apc-2161", {NULL}, 2161, "udp"}, -{"navisphere", {NULL}, 2162, "tcp"}, -{"navisphere", {NULL}, 2162, "udp"}, -{"navisphere-sec", {NULL}, 2163, "tcp"}, -{"navisphere-sec", {NULL}, 2163, "udp"}, -{"ddns-v3", {NULL}, 2164, "tcp"}, -{"ddns-v3", {NULL}, 2164, "udp"}, -{"x-bone-api", {NULL}, 2165, "tcp"}, -{"x-bone-api", {NULL}, 2165, "udp"}, -{"iwserver", {NULL}, 2166, "tcp"}, -{"iwserver", {NULL}, 2166, "udp"}, -{"raw-serial", {NULL}, 2167, "tcp"}, -{"raw-serial", {NULL}, 2167, "udp"}, -{"easy-soft-mux", {NULL}, 2168, "tcp"}, -{"easy-soft-mux", {NULL}, 2168, "udp"}, -{"brain", {NULL}, 2169, "tcp"}, -{"brain", {NULL}, 2169, "udp"}, -{"eyetv", {NULL}, 2170, "tcp"}, -{"eyetv", {NULL}, 2170, "udp"}, -{"msfw-storage", {NULL}, 2171, "tcp"}, -{"msfw-storage", {NULL}, 2171, "udp"}, -{"msfw-s-storage", {NULL}, 2172, "tcp"}, -{"msfw-s-storage", {NULL}, 2172, "udp"}, -{"msfw-replica", {NULL}, 2173, "tcp"}, -{"msfw-replica", {NULL}, 2173, "udp"}, -{"msfw-array", {NULL}, 2174, "tcp"}, -{"msfw-array", {NULL}, 2174, "udp"}, -{"airsync", {NULL}, 2175, "tcp"}, -{"airsync", {NULL}, 2175, "udp"}, -{"rapi", {NULL}, 2176, "tcp"}, -{"rapi", {NULL}, 2176, "udp"}, -{"qwave", {NULL}, 2177, "tcp"}, -{"qwave", {NULL}, 2177, "udp"}, -{"bitspeer", {NULL}, 2178, "tcp"}, -{"bitspeer", {NULL}, 2178, "udp"}, -{"vmrdp", {NULL}, 2179, "tcp"}, -{"vmrdp", {NULL}, 2179, "udp"}, -{"mc-gt-srv", {NULL}, 2180, "tcp"}, -{"mc-gt-srv", {NULL}, 2180, "udp"}, -{"eforward", {NULL}, 2181, "tcp"}, -{"eforward", {NULL}, 2181, "udp"}, -{"cgn-stat", {NULL}, 2182, "tcp"}, -{"cgn-stat", {NULL}, 2182, "udp"}, -{"cgn-config", {NULL}, 2183, "tcp"}, -{"cgn-config", {NULL}, 2183, "udp"}, -{"nvd", {NULL}, 2184, "tcp"}, -{"nvd", {NULL}, 2184, "udp"}, -{"onbase-dds", {NULL}, 2185, "tcp"}, -{"onbase-dds", {NULL}, 2185, "udp"}, -{"gtaua", {NULL}, 2186, "tcp"}, -{"gtaua", {NULL}, 2186, "udp"}, -{"ssmc", {NULL}, 2187, "tcp"}, -{"ssmd", {NULL}, 2187, "udp"}, -{"tivoconnect", {NULL}, 2190, "tcp"}, -{"tivoconnect", {NULL}, 2190, "udp"}, -{"tvbus", {NULL}, 2191, "tcp"}, -{"tvbus", {NULL}, 2191, "udp"}, -{"asdis", {NULL}, 2192, "tcp"}, -{"asdis", {NULL}, 2192, "udp"}, -{"drwcs", {NULL}, 2193, "tcp"}, -{"drwcs", {NULL}, 2193, "udp"}, -{"mnp-exchange", {NULL}, 2197, "tcp"}, -{"mnp-exchange", {NULL}, 2197, "udp"}, -{"onehome-remote", {NULL}, 2198, "tcp"}, -{"onehome-remote", {NULL}, 2198, "udp"}, -{"onehome-help", {NULL}, 2199, "tcp"}, -{"onehome-help", {NULL}, 2199, "udp"}, -{"ici", {NULL}, 2200, "tcp"}, -{"ici", {NULL}, 2200, "udp"}, -{"ats", {NULL}, 2201, "tcp"}, -{"ats", {NULL}, 2201, "udp"}, -{"imtc-map", {NULL}, 2202, "tcp"}, -{"imtc-map", {NULL}, 2202, "udp"}, -{"b2-runtime", {NULL}, 2203, "tcp"}, -{"b2-runtime", {NULL}, 2203, "udp"}, -{"b2-license", {NULL}, 2204, "tcp"}, -{"b2-license", {NULL}, 2204, "udp"}, -{"jps", {NULL}, 2205, "tcp"}, -{"jps", {NULL}, 2205, "udp"}, -{"hpocbus", {NULL}, 2206, "tcp"}, -{"hpocbus", {NULL}, 2206, "udp"}, -{"hpssd", {NULL}, 2207, "tcp"}, -{"hpssd", {NULL}, 2207, "udp"}, -{"hpiod", {NULL}, 2208, "tcp"}, -{"hpiod", {NULL}, 2208, "udp"}, -{"rimf-ps", {NULL}, 2209, "tcp"}, -{"rimf-ps", {NULL}, 2209, "udp"}, -{"noaaport", {NULL}, 2210, "tcp"}, -{"noaaport", {NULL}, 2210, "udp"}, -{"emwin", {NULL}, 2211, "tcp"}, -{"emwin", {NULL}, 2211, "udp"}, -{"leecoposserver", {NULL}, 2212, "tcp"}, -{"leecoposserver", {NULL}, 2212, "udp"}, -{"kali", {NULL}, 2213, "tcp"}, -{"kali", {NULL}, 2213, "udp"}, -{"rpi", {NULL}, 2214, "tcp"}, -{"rpi", {NULL}, 2214, "udp"}, -{"ipcore", {NULL}, 2215, "tcp"}, -{"ipcore", {NULL}, 2215, "udp"}, -{"vtu-comms", {NULL}, 2216, "tcp"}, -{"vtu-comms", {NULL}, 2216, "udp"}, -{"gotodevice", {NULL}, 2217, "tcp"}, -{"gotodevice", {NULL}, 2217, "udp"}, -{"bounzza", {NULL}, 2218, "tcp"}, -{"bounzza", {NULL}, 2218, "udp"}, -{"netiq-ncap", {NULL}, 2219, "tcp"}, -{"netiq-ncap", {NULL}, 2219, "udp"}, -{"netiq", {NULL}, 2220, "tcp"}, -{"netiq", {NULL}, 2220, "udp"}, -{"rockwell-csp1", {NULL}, 2221, "tcp"}, -{"rockwell-csp1", {NULL}, 2221, "udp"}, -{"EtherNet/IP-1", {NULL}, 2222, "tcp"}, -{"EtherNet/IP-1", {NULL}, 2222, "udp"}, -{"rockwell-csp2", {NULL}, 2223, "tcp"}, -{"rockwell-csp2", {NULL}, 2223, "udp"}, -{"efi-mg", {NULL}, 2224, "tcp"}, -{"efi-mg", {NULL}, 2224, "udp"}, -{"rcip-itu", {NULL}, 2225, "tcp"}, -{"rcip-itu", {NULL}, 2225, "sctp"}, -{"di-drm", {NULL}, 2226, "tcp"}, -{"di-drm", {NULL}, 2226, "udp"}, -{"di-msg", {NULL}, 2227, "tcp"}, -{"di-msg", {NULL}, 2227, "udp"}, -{"ehome-ms", {NULL}, 2228, "tcp"}, -{"ehome-ms", {NULL}, 2228, "udp"}, -{"datalens", {NULL}, 2229, "tcp"}, -{"datalens", {NULL}, 2229, "udp"}, -{"queueadm", {NULL}, 2230, "tcp"}, -{"queueadm", {NULL}, 2230, "udp"}, -{"wimaxasncp", {NULL}, 2231, "tcp"}, -{"wimaxasncp", {NULL}, 2231, "udp"}, -{"ivs-video", {NULL}, 2232, "tcp"}, -{"ivs-video", {NULL}, 2232, "udp"}, -{"infocrypt", {NULL}, 2233, "tcp"}, -{"infocrypt", {NULL}, 2233, "udp"}, -{"directplay", {NULL}, 2234, "tcp"}, -{"directplay", {NULL}, 2234, "udp"}, -{"sercomm-wlink", {NULL}, 2235, "tcp"}, -{"sercomm-wlink", {NULL}, 2235, "udp"}, -{"nani", {NULL}, 2236, "tcp"}, -{"nani", {NULL}, 2236, "udp"}, -{"optech-port1-lm", {NULL}, 2237, "tcp"}, -{"optech-port1-lm", {NULL}, 2237, "udp"}, -{"aviva-sna", {NULL}, 2238, "tcp"}, -{"aviva-sna", {NULL}, 2238, "udp"}, -{"imagequery", {NULL}, 2239, "tcp"}, -{"imagequery", {NULL}, 2239, "udp"}, -{"recipe", {NULL}, 2240, "tcp"}, -{"recipe", {NULL}, 2240, "udp"}, -{"ivsd", {NULL}, 2241, "tcp"}, -{"ivsd", {NULL}, 2241, "udp"}, -{"foliocorp", {NULL}, 2242, "tcp"}, -{"foliocorp", {NULL}, 2242, "udp"}, -{"magicom", {NULL}, 2243, "tcp"}, -{"magicom", {NULL}, 2243, "udp"}, -{"nmsserver", {NULL}, 2244, "tcp"}, -{"nmsserver", {NULL}, 2244, "udp"}, -{"hao", {NULL}, 2245, "tcp"}, -{"hao", {NULL}, 2245, "udp"}, -{"pc-mta-addrmap", {NULL}, 2246, "tcp"}, -{"pc-mta-addrmap", {NULL}, 2246, "udp"}, -{"antidotemgrsvr", {NULL}, 2247, "tcp"}, -{"antidotemgrsvr", {NULL}, 2247, "udp"}, -{"ums", {NULL}, 2248, "tcp"}, -{"ums", {NULL}, 2248, "udp"}, -{"rfmp", {NULL}, 2249, "tcp"}, -{"rfmp", {NULL}, 2249, "udp"}, -{"remote-collab", {NULL}, 2250, "tcp"}, -{"remote-collab", {NULL}, 2250, "udp"}, -{"dif-port", {NULL}, 2251, "tcp"}, -{"dif-port", {NULL}, 2251, "udp"}, -{"njenet-ssl", {NULL}, 2252, "tcp"}, -{"njenet-ssl", {NULL}, 2252, "udp"}, -{"dtv-chan-req", {NULL}, 2253, "tcp"}, -{"dtv-chan-req", {NULL}, 2253, "udp"}, -{"seispoc", {NULL}, 2254, "tcp"}, -{"seispoc", {NULL}, 2254, "udp"}, -{"vrtp", {NULL}, 2255, "tcp"}, -{"vrtp", {NULL}, 2255, "udp"}, -{"pcc-mfp", {NULL}, 2256, "tcp"}, -{"pcc-mfp", {NULL}, 2256, "udp"}, -{"simple-tx-rx", {NULL}, 2257, "tcp"}, -{"simple-tx-rx", {NULL}, 2257, "udp"}, -{"rcts", {NULL}, 2258, "tcp"}, -{"rcts", {NULL}, 2258, "udp"}, -{"acd-pm", {NULL}, 2259, "tcp"}, -{"acd-pm", {NULL}, 2259, "udp"}, -{"apc-2260", {NULL}, 2260, "tcp"}, -{"apc-2260", {NULL}, 2260, "udp"}, -{"comotionmaster", {NULL}, 2261, "tcp"}, -{"comotionmaster", {NULL}, 2261, "udp"}, -{"comotionback", {NULL}, 2262, "tcp"}, -{"comotionback", {NULL}, 2262, "udp"}, -{"ecwcfg", {NULL}, 2263, "tcp"}, -{"ecwcfg", {NULL}, 2263, "udp"}, -{"apx500api-1", {NULL}, 2264, "tcp"}, -{"apx500api-1", {NULL}, 2264, "udp"}, -{"apx500api-2", {NULL}, 2265, "tcp"}, -{"apx500api-2", {NULL}, 2265, "udp"}, -{"mfserver", {NULL}, 2266, "tcp"}, -{"mfserver", {NULL}, 2266, "udp"}, -{"ontobroker", {NULL}, 2267, "tcp"}, -{"ontobroker", {NULL}, 2267, "udp"}, -{"amt", {NULL}, 2268, "tcp"}, -{"amt", {NULL}, 2268, "udp"}, -{"mikey", {NULL}, 2269, "tcp"}, -{"mikey", {NULL}, 2269, "udp"}, -{"starschool", {NULL}, 2270, "tcp"}, -{"starschool", {NULL}, 2270, "udp"}, -{"mmcals", {NULL}, 2271, "tcp"}, -{"mmcals", {NULL}, 2271, "udp"}, -{"mmcal", {NULL}, 2272, "tcp"}, -{"mmcal", {NULL}, 2272, "udp"}, -{"mysql-im", {NULL}, 2273, "tcp"}, -{"mysql-im", {NULL}, 2273, "udp"}, -{"pcttunnell", {NULL}, 2274, "tcp"}, -{"pcttunnell", {NULL}, 2274, "udp"}, -{"ibridge-data", {NULL}, 2275, "tcp"}, -{"ibridge-data", {NULL}, 2275, "udp"}, -{"ibridge-mgmt", {NULL}, 2276, "tcp"}, -{"ibridge-mgmt", {NULL}, 2276, "udp"}, -{"bluectrlproxy", {NULL}, 2277, "tcp"}, -{"bluectrlproxy", {NULL}, 2277, "udp"}, -{"s3db", {NULL}, 2278, "tcp"}, -{"s3db", {NULL}, 2278, "udp"}, -{"xmquery", {NULL}, 2279, "tcp"}, -{"xmquery", {NULL}, 2279, "udp"}, -{"lnvpoller", {NULL}, 2280, "tcp"}, -{"lnvpoller", {NULL}, 2280, "udp"}, -{"lnvconsole", {NULL}, 2281, "tcp"}, -{"lnvconsole", {NULL}, 2281, "udp"}, -{"lnvalarm", {NULL}, 2282, "tcp"}, -{"lnvalarm", {NULL}, 2282, "udp"}, -{"lnvstatus", {NULL}, 2283, "tcp"}, -{"lnvstatus", {NULL}, 2283, "udp"}, -{"lnvmaps", {NULL}, 2284, "tcp"}, -{"lnvmaps", {NULL}, 2284, "udp"}, -{"lnvmailmon", {NULL}, 2285, "tcp"}, -{"lnvmailmon", {NULL}, 2285, "udp"}, -{"nas-metering", {NULL}, 2286, "tcp"}, -{"nas-metering", {NULL}, 2286, "udp"}, -{"dna", {NULL}, 2287, "tcp"}, -{"dna", {NULL}, 2287, "udp"}, -{"netml", {NULL}, 2288, "tcp"}, -{"netml", {NULL}, 2288, "udp"}, -{"dict-lookup", {NULL}, 2289, "tcp"}, -{"dict-lookup", {NULL}, 2289, "udp"}, -{"sonus-logging", {NULL}, 2290, "tcp"}, -{"sonus-logging", {NULL}, 2290, "udp"}, -{"eapsp", {NULL}, 2291, "tcp"}, -{"eapsp", {NULL}, 2291, "udp"}, -{"mib-streaming", {NULL}, 2292, "tcp"}, -{"mib-streaming", {NULL}, 2292, "udp"}, -{"npdbgmngr", {NULL}, 2293, "tcp"}, -{"npdbgmngr", {NULL}, 2293, "udp"}, -{"konshus-lm", {NULL}, 2294, "tcp"}, -{"konshus-lm", {NULL}, 2294, "udp"}, -{"advant-lm", {NULL}, 2295, "tcp"}, -{"advant-lm", {NULL}, 2295, "udp"}, -{"theta-lm", {NULL}, 2296, "tcp"}, -{"theta-lm", {NULL}, 2296, "udp"}, -{"d2k-datamover1", {NULL}, 2297, "tcp"}, -{"d2k-datamover1", {NULL}, 2297, "udp"}, -{"d2k-datamover2", {NULL}, 2298, "tcp"}, -{"d2k-datamover2", {NULL}, 2298, "udp"}, -{"pc-telecommute", {NULL}, 2299, "tcp"}, -{"pc-telecommute", {NULL}, 2299, "udp"}, -{"cvmmon", {NULL}, 2300, "tcp"}, -{"cvmmon", {NULL}, 2300, "udp"}, -{"cpq-wbem", {NULL}, 2301, "tcp"}, -{"cpq-wbem", {NULL}, 2301, "udp"}, -{"binderysupport", {NULL}, 2302, "tcp"}, -{"binderysupport", {NULL}, 2302, "udp"}, -{"proxy-gateway", {NULL}, 2303, "tcp"}, -{"proxy-gateway", {NULL}, 2303, "udp"}, -{"attachmate-uts", {NULL}, 2304, "tcp"}, -{"attachmate-uts", {NULL}, 2304, "udp"}, -{"mt-scaleserver", {NULL}, 2305, "tcp"}, -{"mt-scaleserver", {NULL}, 2305, "udp"}, -{"tappi-boxnet", {NULL}, 2306, "tcp"}, -{"tappi-boxnet", {NULL}, 2306, "udp"}, -{"pehelp", {NULL}, 2307, "tcp"}, -{"pehelp", {NULL}, 2307, "udp"}, -{"sdhelp", {NULL}, 2308, "tcp"}, -{"sdhelp", {NULL}, 2308, "udp"}, -{"sdserver", {NULL}, 2309, "tcp"}, -{"sdserver", {NULL}, 2309, "udp"}, -{"sdclient", {NULL}, 2310, "tcp"}, -{"sdclient", {NULL}, 2310, "udp"}, -{"messageservice", {NULL}, 2311, "tcp"}, -{"messageservice", {NULL}, 2311, "udp"}, -{"wanscaler", {NULL}, 2312, "tcp"}, -{"wanscaler", {NULL}, 2312, "udp"}, -{"iapp", {NULL}, 2313, "tcp"}, -{"iapp", {NULL}, 2313, "udp"}, -{"cr-websystems", {NULL}, 2314, "tcp"}, -{"cr-websystems", {NULL}, 2314, "udp"}, -{"precise-sft", {NULL}, 2315, "tcp"}, -{"precise-sft", {NULL}, 2315, "udp"}, -{"sent-lm", {NULL}, 2316, "tcp"}, -{"sent-lm", {NULL}, 2316, "udp"}, -{"attachmate-g32", {NULL}, 2317, "tcp"}, -{"attachmate-g32", {NULL}, 2317, "udp"}, -{"cadencecontrol", {NULL}, 2318, "tcp"}, -{"cadencecontrol", {NULL}, 2318, "udp"}, -{"infolibria", {NULL}, 2319, "tcp"}, -{"infolibria", {NULL}, 2319, "udp"}, -{"siebel-ns", {NULL}, 2320, "tcp"}, -{"siebel-ns", {NULL}, 2320, "udp"}, -{"rdlap", {NULL}, 2321, "tcp"}, -{"rdlap", {NULL}, 2321, "udp"}, -{"ofsd", {NULL}, 2322, "tcp"}, -{"ofsd", {NULL}, 2322, "udp"}, -{"3d-nfsd", {NULL}, 2323, "tcp"}, -{"3d-nfsd", {NULL}, 2323, "udp"}, -{"cosmocall", {NULL}, 2324, "tcp"}, -{"cosmocall", {NULL}, 2324, "udp"}, -{"ansysli", {NULL}, 2325, "tcp"}, -{"ansysli", {NULL}, 2325, "udp"}, -{"idcp", {NULL}, 2326, "tcp"}, -{"idcp", {NULL}, 2326, "udp"}, -{"xingcsm", {NULL}, 2327, "tcp"}, -{"xingcsm", {NULL}, 2327, "udp"}, -{"netrix-sftm", {NULL}, 2328, "tcp"}, -{"netrix-sftm", {NULL}, 2328, "udp"}, -{"nvd", {NULL}, 2329, "tcp"}, -{"nvd", {NULL}, 2329, "udp"}, -{"tscchat", {NULL}, 2330, "tcp"}, -{"tscchat", {NULL}, 2330, "udp"}, -{"agentview", {NULL}, 2331, "tcp"}, -{"agentview", {NULL}, 2331, "udp"}, -{"rcc-host", {NULL}, 2332, "tcp"}, -{"rcc-host", {NULL}, 2332, "udp"}, -{"snapp", {NULL}, 2333, "tcp"}, -{"snapp", {NULL}, 2333, "udp"}, -{"ace-client", {NULL}, 2334, "tcp"}, -{"ace-client", {NULL}, 2334, "udp"}, -{"ace-proxy", {NULL}, 2335, "tcp"}, -{"ace-proxy", {NULL}, 2335, "udp"}, -{"appleugcontrol", {NULL}, 2336, "tcp"}, -{"appleugcontrol", {NULL}, 2336, "udp"}, -{"ideesrv", {NULL}, 2337, "tcp"}, -{"ideesrv", {NULL}, 2337, "udp"}, -{"norton-lambert", {NULL}, 2338, "tcp"}, -{"norton-lambert", {NULL}, 2338, "udp"}, -{"3com-webview", {NULL}, 2339, "tcp"}, -{"3com-webview", {NULL}, 2339, "udp"}, -{"wrs_registry", {NULL}, 2340, "tcp"}, -{"wrs_registry", {NULL}, 2340, "udp"}, -{"xiostatus", {NULL}, 2341, "tcp"}, -{"xiostatus", {NULL}, 2341, "udp"}, -{"manage-exec", {NULL}, 2342, "tcp"}, -{"manage-exec", {NULL}, 2342, "udp"}, -{"nati-logos", {NULL}, 2343, "tcp"}, -{"nati-logos", {NULL}, 2343, "udp"}, -{"fcmsys", {NULL}, 2344, "tcp"}, -{"fcmsys", {NULL}, 2344, "udp"}, -{"dbm", {NULL}, 2345, "tcp"}, -{"dbm", {NULL}, 2345, "udp"}, -{"redstorm_join", {NULL}, 2346, "tcp"}, -{"redstorm_join", {NULL}, 2346, "udp"}, -{"redstorm_find", {NULL}, 2347, "tcp"}, -{"redstorm_find", {NULL}, 2347, "udp"}, -{"redstorm_info", {NULL}, 2348, "tcp"}, -{"redstorm_info", {NULL}, 2348, "udp"}, -{"redstorm_diag", {NULL}, 2349, "tcp"}, -{"redstorm_diag", {NULL}, 2349, "udp"}, -{"psbserver", {NULL}, 2350, "tcp"}, -{"psbserver", {NULL}, 2350, "udp"}, -{"psrserver", {NULL}, 2351, "tcp"}, -{"psrserver", {NULL}, 2351, "udp"}, -{"pslserver", {NULL}, 2352, "tcp"}, -{"pslserver", {NULL}, 2352, "udp"}, -{"pspserver", {NULL}, 2353, "tcp"}, -{"pspserver", {NULL}, 2353, "udp"}, -{"psprserver", {NULL}, 2354, "tcp"}, -{"psprserver", {NULL}, 2354, "udp"}, -{"psdbserver", {NULL}, 2355, "tcp"}, -{"psdbserver", {NULL}, 2355, "udp"}, -{"gxtelmd", {NULL}, 2356, "tcp"}, -{"gxtelmd", {NULL}, 2356, "udp"}, -{"unihub-server", {NULL}, 2357, "tcp"}, -{"unihub-server", {NULL}, 2357, "udp"}, -{"futrix", {NULL}, 2358, "tcp"}, -{"futrix", {NULL}, 2358, "udp"}, -{"flukeserver", {NULL}, 2359, "tcp"}, -{"flukeserver", {NULL}, 2359, "udp"}, -{"nexstorindltd", {NULL}, 2360, "tcp"}, -{"nexstorindltd", {NULL}, 2360, "udp"}, -{"tl1", {NULL}, 2361, "tcp"}, -{"tl1", {NULL}, 2361, "udp"}, -{"digiman", {NULL}, 2362, "tcp"}, -{"digiman", {NULL}, 2362, "udp"}, -{"mediacntrlnfsd", {NULL}, 2363, "tcp"}, -{"mediacntrlnfsd", {NULL}, 2363, "udp"}, -{"oi-2000", {NULL}, 2364, "tcp"}, -{"oi-2000", {NULL}, 2364, "udp"}, -{"dbref", {NULL}, 2365, "tcp"}, -{"dbref", {NULL}, 2365, "udp"}, -{"qip-login", {NULL}, 2366, "tcp"}, -{"qip-login", {NULL}, 2366, "udp"}, -{"service-ctrl", {NULL}, 2367, "tcp"}, -{"service-ctrl", {NULL}, 2367, "udp"}, -{"opentable", {NULL}, 2368, "tcp"}, -{"opentable", {NULL}, 2368, "udp"}, -{"l3-hbmon", {NULL}, 2370, "tcp"}, -{"l3-hbmon", {NULL}, 2370, "udp"}, -{"worldwire", {NULL}, 2371, "tcp"}, -{"worldwire", {NULL}, 2371, "udp"}, -{"lanmessenger", {NULL}, 2372, "tcp"}, -{"lanmessenger", {NULL}, 2372, "udp"}, -{"remographlm", {NULL}, 2373, "tcp"}, -{"hydra", {NULL}, 2374, "tcp"}, -{"compaq-https", {NULL}, 2381, "tcp"}, -{"compaq-https", {NULL}, 2381, "udp"}, -{"ms-olap3", {NULL}, 2382, "tcp"}, -{"ms-olap3", {NULL}, 2382, "udp"}, -{"ms-olap4", {NULL}, 2383, "tcp"}, -{"ms-olap4", {NULL}, 2383, "udp"}, -{"sd-request", {NULL}, 2384, "tcp"}, -{"sd-capacity", {NULL}, 2384, "udp"}, -{"sd-data", {NULL}, 2385, "tcp"}, -{"sd-data", {NULL}, 2385, "udp"}, -{"virtualtape", {NULL}, 2386, "tcp"}, -{"virtualtape", {NULL}, 2386, "udp"}, -{"vsamredirector", {NULL}, 2387, "tcp"}, -{"vsamredirector", {NULL}, 2387, "udp"}, -{"mynahautostart", {NULL}, 2388, "tcp"}, -{"mynahautostart", {NULL}, 2388, "udp"}, -{"ovsessionmgr", {NULL}, 2389, "tcp"}, -{"ovsessionmgr", {NULL}, 2389, "udp"}, -{"rsmtp", {NULL}, 2390, "tcp"}, -{"rsmtp", {NULL}, 2390, "udp"}, -{"3com-net-mgmt", {NULL}, 2391, "tcp"}, -{"3com-net-mgmt", {NULL}, 2391, "udp"}, -{"tacticalauth", {NULL}, 2392, "tcp"}, -{"tacticalauth", {NULL}, 2392, "udp"}, -{"ms-olap1", {NULL}, 2393, "tcp"}, -{"ms-olap1", {NULL}, 2393, "udp"}, -{"ms-olap2", {NULL}, 2394, "tcp"}, -{"ms-olap2", {NULL}, 2394, "udp"}, -{"lan900_remote", {NULL}, 2395, "tcp"}, -{"lan900_remote", {NULL}, 2395, "udp"}, -{"wusage", {NULL}, 2396, "tcp"}, -{"wusage", {NULL}, 2396, "udp"}, -{"ncl", {NULL}, 2397, "tcp"}, -{"ncl", {NULL}, 2397, "udp"}, -{"orbiter", {NULL}, 2398, "tcp"}, -{"orbiter", {NULL}, 2398, "udp"}, -{"fmpro-fdal", {NULL}, 2399, "tcp"}, -{"fmpro-fdal", {NULL}, 2399, "udp"}, -{"opequus-server", {NULL}, 2400, "tcp"}, -{"opequus-server", {NULL}, 2400, "udp"}, -{"cvspserver", {NULL}, 2401, "tcp"}, -{"cvspserver", {NULL}, 2401, "udp"}, -{"taskmaster2000", {NULL}, 2402, "tcp"}, -{"taskmaster2000", {NULL}, 2402, "udp"}, -{"taskmaster2000", {NULL}, 2403, "tcp"}, -{"taskmaster2000", {NULL}, 2403, "udp"}, -{"iec-104", {NULL}, 2404, "tcp"}, -{"iec-104", {NULL}, 2404, "udp"}, -{"trc-netpoll", {NULL}, 2405, "tcp"}, -{"trc-netpoll", {NULL}, 2405, "udp"}, -{"jediserver", {NULL}, 2406, "tcp"}, -{"jediserver", {NULL}, 2406, "udp"}, -{"orion", {NULL}, 2407, "tcp"}, -{"orion", {NULL}, 2407, "udp"}, -{"optimanet", {NULL}, 2408, "tcp"}, -{"optimanet", {NULL}, 2408, "udp"}, -{"sns-protocol", {NULL}, 2409, "tcp"}, -{"sns-protocol", {NULL}, 2409, "udp"}, -{"vrts-registry", {NULL}, 2410, "tcp"}, -{"vrts-registry", {NULL}, 2410, "udp"}, -{"netwave-ap-mgmt", {NULL}, 2411, "tcp"}, -{"netwave-ap-mgmt", {NULL}, 2411, "udp"}, -{"cdn", {NULL}, 2412, "tcp"}, -{"cdn", {NULL}, 2412, "udp"}, -{"orion-rmi-reg", {NULL}, 2413, "tcp"}, -{"orion-rmi-reg", {NULL}, 2413, "udp"}, -{"beeyond", {NULL}, 2414, "tcp"}, -{"beeyond", {NULL}, 2414, "udp"}, -{"codima-rtp", {NULL}, 2415, "tcp"}, -{"codima-rtp", {NULL}, 2415, "udp"}, -{"rmtserver", {NULL}, 2416, "tcp"}, -{"rmtserver", {NULL}, 2416, "udp"}, -{"composit-server", {NULL}, 2417, "tcp"}, -{"composit-server", {NULL}, 2417, "udp"}, -{"cas", {NULL}, 2418, "tcp"}, -{"cas", {NULL}, 2418, "udp"}, -{"attachmate-s2s", {NULL}, 2419, "tcp"}, -{"attachmate-s2s", {NULL}, 2419, "udp"}, -{"dslremote-mgmt", {NULL}, 2420, "tcp"}, -{"dslremote-mgmt", {NULL}, 2420, "udp"}, -{"g-talk", {NULL}, 2421, "tcp"}, -{"g-talk", {NULL}, 2421, "udp"}, -{"crmsbits", {NULL}, 2422, "tcp"}, -{"crmsbits", {NULL}, 2422, "udp"}, -{"rnrp", {NULL}, 2423, "tcp"}, -{"rnrp", {NULL}, 2423, "udp"}, -{"kofax-svr", {NULL}, 2424, "tcp"}, -{"kofax-svr", {NULL}, 2424, "udp"}, -{"fjitsuappmgr", {NULL}, 2425, "tcp"}, -{"fjitsuappmgr", {NULL}, 2425, "udp"}, -{"mgcp-gateway", {NULL}, 2427, "tcp"}, -{"mgcp-gateway", {NULL}, 2427, "udp"}, -{"ott", {NULL}, 2428, "tcp"}, -{"ott", {NULL}, 2428, "udp"}, -{"ft-role", {NULL}, 2429, "tcp"}, -{"ft-role", {NULL}, 2429, "udp"}, -{"venus", {NULL}, 2430, "tcp"}, -{"venus", {NULL}, 2430, "udp"}, -{"venus-se", {NULL}, 2431, "tcp"}, -{"venus-se", {NULL}, 2431, "udp"}, -{"codasrv", {NULL}, 2432, "tcp"}, -{"codasrv", {NULL}, 2432, "udp"}, -{"codasrv-se", {NULL}, 2433, "tcp"}, -{"codasrv-se", {NULL}, 2433, "udp"}, -{"pxc-epmap", {NULL}, 2434, "tcp"}, -{"pxc-epmap", {NULL}, 2434, "udp"}, -{"optilogic", {NULL}, 2435, "tcp"}, -{"optilogic", {NULL}, 2435, "udp"}, -{"topx", {NULL}, 2436, "tcp"}, -{"topx", {NULL}, 2436, "udp"}, -{"unicontrol", {NULL}, 2437, "tcp"}, -{"unicontrol", {NULL}, 2437, "udp"}, -{"msp", {NULL}, 2438, "tcp"}, -{"msp", {NULL}, 2438, "udp"}, -{"sybasedbsynch", {NULL}, 2439, "tcp"}, -{"sybasedbsynch", {NULL}, 2439, "udp"}, -{"spearway", {NULL}, 2440, "tcp"}, -{"spearway", {NULL}, 2440, "udp"}, -{"pvsw-inet", {NULL}, 2441, "tcp"}, -{"pvsw-inet", {NULL}, 2441, "udp"}, -{"netangel", {NULL}, 2442, "tcp"}, -{"netangel", {NULL}, 2442, "udp"}, -{"powerclientcsf", {NULL}, 2443, "tcp"}, -{"powerclientcsf", {NULL}, 2443, "udp"}, -{"btpp2sectrans", {NULL}, 2444, "tcp"}, -{"btpp2sectrans", {NULL}, 2444, "udp"}, -{"dtn1", {NULL}, 2445, "tcp"}, -{"dtn1", {NULL}, 2445, "udp"}, -{"bues_service", {NULL}, 2446, "tcp"}, -{"bues_service", {NULL}, 2446, "udp"}, -{"ovwdb", {NULL}, 2447, "tcp"}, -{"ovwdb", {NULL}, 2447, "udp"}, -{"hpppssvr", {NULL}, 2448, "tcp"}, -{"hpppssvr", {NULL}, 2448, "udp"}, -{"ratl", {NULL}, 2449, "tcp"}, -{"ratl", {NULL}, 2449, "udp"}, -{"netadmin", {NULL}, 2450, "tcp"}, -{"netadmin", {NULL}, 2450, "udp"}, -{"netchat", {NULL}, 2451, "tcp"}, -{"netchat", {NULL}, 2451, "udp"}, -{"snifferclient", {NULL}, 2452, "tcp"}, -{"snifferclient", {NULL}, 2452, "udp"}, -{"madge-ltd", {NULL}, 2453, "tcp"}, -{"madge-ltd", {NULL}, 2453, "udp"}, -{"indx-dds", {NULL}, 2454, "tcp"}, -{"indx-dds", {NULL}, 2454, "udp"}, -{"wago-io-system", {NULL}, 2455, "tcp"}, -{"wago-io-system", {NULL}, 2455, "udp"}, -{"altav-remmgt", {NULL}, 2456, "tcp"}, -{"altav-remmgt", {NULL}, 2456, "udp"}, -{"rapido-ip", {NULL}, 2457, "tcp"}, -{"rapido-ip", {NULL}, 2457, "udp"}, -{"griffin", {NULL}, 2458, "tcp"}, -{"griffin", {NULL}, 2458, "udp"}, -{"community", {NULL}, 2459, "tcp"}, -{"community", {NULL}, 2459, "udp"}, -{"ms-theater", {NULL}, 2460, "tcp"}, -{"ms-theater", {NULL}, 2460, "udp"}, -{"qadmifoper", {NULL}, 2461, "tcp"}, -{"qadmifoper", {NULL}, 2461, "udp"}, -{"qadmifevent", {NULL}, 2462, "tcp"}, -{"qadmifevent", {NULL}, 2462, "udp"}, -{"lsi-raid-mgmt", {NULL}, 2463, "tcp"}, -{"lsi-raid-mgmt", {NULL}, 2463, "udp"}, -{"direcpc-si", {NULL}, 2464, "tcp"}, -{"direcpc-si", {NULL}, 2464, "udp"}, -{"lbm", {NULL}, 2465, "tcp"}, -{"lbm", {NULL}, 2465, "udp"}, -{"lbf", {NULL}, 2466, "tcp"}, -{"lbf", {NULL}, 2466, "udp"}, -{"high-criteria", {NULL}, 2467, "tcp"}, -{"high-criteria", {NULL}, 2467, "udp"}, -{"qip-msgd", {NULL}, 2468, "tcp"}, -{"qip-msgd", {NULL}, 2468, "udp"}, -{"mti-tcs-comm", {NULL}, 2469, "tcp"}, -{"mti-tcs-comm", {NULL}, 2469, "udp"}, -{"taskman-port", {NULL}, 2470, "tcp"}, -{"taskman-port", {NULL}, 2470, "udp"}, -{"seaodbc", {NULL}, 2471, "tcp"}, -{"seaodbc", {NULL}, 2471, "udp"}, -{"c3", {NULL}, 2472, "tcp"}, -{"c3", {NULL}, 2472, "udp"}, -{"aker-cdp", {NULL}, 2473, "tcp"}, -{"aker-cdp", {NULL}, 2473, "udp"}, -{"vitalanalysis", {NULL}, 2474, "tcp"}, -{"vitalanalysis", {NULL}, 2474, "udp"}, -{"ace-server", {NULL}, 2475, "tcp"}, -{"ace-server", {NULL}, 2475, "udp"}, -{"ace-svr-prop", {NULL}, 2476, "tcp"}, -{"ace-svr-prop", {NULL}, 2476, "udp"}, -{"ssm-cvs", {NULL}, 2477, "tcp"}, -{"ssm-cvs", {NULL}, 2477, "udp"}, -{"ssm-cssps", {NULL}, 2478, "tcp"}, -{"ssm-cssps", {NULL}, 2478, "udp"}, -{"ssm-els", {NULL}, 2479, "tcp"}, -{"ssm-els", {NULL}, 2479, "udp"}, -{"powerexchange", {NULL}, 2480, "tcp"}, -{"powerexchange", {NULL}, 2480, "udp"}, -{"giop", {NULL}, 2481, "tcp"}, -{"giop", {NULL}, 2481, "udp"}, -{"giop-ssl", {NULL}, 2482, "tcp"}, -{"giop-ssl", {NULL}, 2482, "udp"}, -{"ttc", {NULL}, 2483, "tcp"}, -{"ttc", {NULL}, 2483, "udp"}, -{"ttc-ssl", {NULL}, 2484, "tcp"}, -{"ttc-ssl", {NULL}, 2484, "udp"}, -{"netobjects1", {NULL}, 2485, "tcp"}, -{"netobjects1", {NULL}, 2485, "udp"}, -{"netobjects2", {NULL}, 2486, "tcp"}, -{"netobjects2", {NULL}, 2486, "udp"}, -{"pns", {NULL}, 2487, "tcp"}, -{"pns", {NULL}, 2487, "udp"}, -{"moy-corp", {NULL}, 2488, "tcp"}, -{"moy-corp", {NULL}, 2488, "udp"}, -{"tsilb", {NULL}, 2489, "tcp"}, -{"tsilb", {NULL}, 2489, "udp"}, -{"qip-qdhcp", {NULL}, 2490, "tcp"}, -{"qip-qdhcp", {NULL}, 2490, "udp"}, -{"conclave-cpp", {NULL}, 2491, "tcp"}, -{"conclave-cpp", {NULL}, 2491, "udp"}, -{"groove", {NULL}, 2492, "tcp"}, -{"groove", {NULL}, 2492, "udp"}, -{"talarian-mqs", {NULL}, 2493, "tcp"}, -{"talarian-mqs", {NULL}, 2493, "udp"}, -{"bmc-ar", {NULL}, 2494, "tcp"}, -{"bmc-ar", {NULL}, 2494, "udp"}, -{"fast-rem-serv", {NULL}, 2495, "tcp"}, -{"fast-rem-serv", {NULL}, 2495, "udp"}, -{"dirgis", {NULL}, 2496, "tcp"}, -{"dirgis", {NULL}, 2496, "udp"}, -{"quaddb", {NULL}, 2497, "tcp"}, -{"quaddb", {NULL}, 2497, "udp"}, -{"odn-castraq", {NULL}, 2498, "tcp"}, -{"odn-castraq", {NULL}, 2498, "udp"}, -{"unicontrol", {NULL}, 2499, "tcp"}, -{"unicontrol", {NULL}, 2499, "udp"}, -{"rtsserv", {NULL}, 2500, "tcp"}, -{"rtsserv", {NULL}, 2500, "udp"}, -{"rtsclient", {NULL}, 2501, "tcp"}, -{"rtsclient", {NULL}, 2501, "udp"}, -{"kentrox-prot", {NULL}, 2502, "tcp"}, -{"kentrox-prot", {NULL}, 2502, "udp"}, -{"nms-dpnss", {NULL}, 2503, "tcp"}, -{"nms-dpnss", {NULL}, 2503, "udp"}, -{"wlbs", {NULL}, 2504, "tcp"}, -{"wlbs", {NULL}, 2504, "udp"}, -{"ppcontrol", {NULL}, 2505, "tcp"}, -{"ppcontrol", {NULL}, 2505, "udp"}, -{"jbroker", {NULL}, 2506, "tcp"}, -{"jbroker", {NULL}, 2506, "udp"}, -{"spock", {NULL}, 2507, "tcp"}, -{"spock", {NULL}, 2507, "udp"}, -{"jdatastore", {NULL}, 2508, "tcp"}, -{"jdatastore", {NULL}, 2508, "udp"}, -{"fjmpss", {NULL}, 2509, "tcp"}, -{"fjmpss", {NULL}, 2509, "udp"}, -{"fjappmgrbulk", {NULL}, 2510, "tcp"}, -{"fjappmgrbulk", {NULL}, 2510, "udp"}, -{"metastorm", {NULL}, 2511, "tcp"}, -{"metastorm", {NULL}, 2511, "udp"}, -{"citrixima", {NULL}, 2512, "tcp"}, -{"citrixima", {NULL}, 2512, "udp"}, -{"citrixadmin", {NULL}, 2513, "tcp"}, -{"citrixadmin", {NULL}, 2513, "udp"}, -{"facsys-ntp", {NULL}, 2514, "tcp"}, -{"facsys-ntp", {NULL}, 2514, "udp"}, -{"facsys-router", {NULL}, 2515, "tcp"}, -{"facsys-router", {NULL}, 2515, "udp"}, -{"maincontrol", {NULL}, 2516, "tcp"}, -{"maincontrol", {NULL}, 2516, "udp"}, -{"call-sig-trans", {NULL}, 2517, "tcp"}, -{"call-sig-trans", {NULL}, 2517, "udp"}, -{"willy", {NULL}, 2518, "tcp"}, -{"willy", {NULL}, 2518, "udp"}, -{"globmsgsvc", {NULL}, 2519, "tcp"}, -{"globmsgsvc", {NULL}, 2519, "udp"}, -{"pvsw", {NULL}, 2520, "tcp"}, -{"pvsw", {NULL}, 2520, "udp"}, -{"adaptecmgr", {NULL}, 2521, "tcp"}, -{"adaptecmgr", {NULL}, 2521, "udp"}, -{"windb", {NULL}, 2522, "tcp"}, -{"windb", {NULL}, 2522, "udp"}, -{"qke-llc-v3", {NULL}, 2523, "tcp"}, -{"qke-llc-v3", {NULL}, 2523, "udp"}, -{"optiwave-lm", {NULL}, 2524, "tcp"}, -{"optiwave-lm", {NULL}, 2524, "udp"}, -{"ms-v-worlds", {NULL}, 2525, "tcp"}, -{"ms-v-worlds", {NULL}, 2525, "udp"}, -{"ema-sent-lm", {NULL}, 2526, "tcp"}, -{"ema-sent-lm", {NULL}, 2526, "udp"}, -{"iqserver", {NULL}, 2527, "tcp"}, -{"iqserver", {NULL}, 2527, "udp"}, -{"ncr_ccl", {NULL}, 2528, "tcp"}, -{"ncr_ccl", {NULL}, 2528, "udp"}, -{"utsftp", {NULL}, 2529, "tcp"}, -{"utsftp", {NULL}, 2529, "udp"}, -{"vrcommerce", {NULL}, 2530, "tcp"}, -{"vrcommerce", {NULL}, 2530, "udp"}, -{"ito-e-gui", {NULL}, 2531, "tcp"}, -{"ito-e-gui", {NULL}, 2531, "udp"}, -{"ovtopmd", {NULL}, 2532, "tcp"}, -{"ovtopmd", {NULL}, 2532, "udp"}, -{"snifferserver", {NULL}, 2533, "tcp"}, -{"snifferserver", {NULL}, 2533, "udp"}, -{"combox-web-acc", {NULL}, 2534, "tcp"}, -{"combox-web-acc", {NULL}, 2534, "udp"}, -{"madcap", {NULL}, 2535, "tcp"}, -{"madcap", {NULL}, 2535, "udp"}, -{"btpp2audctr1", {NULL}, 2536, "tcp"}, -{"btpp2audctr1", {NULL}, 2536, "udp"}, -{"upgrade", {NULL}, 2537, "tcp"}, -{"upgrade", {NULL}, 2537, "udp"}, -{"vnwk-prapi", {NULL}, 2538, "tcp"}, -{"vnwk-prapi", {NULL}, 2538, "udp"}, -{"vsiadmin", {NULL}, 2539, "tcp"}, -{"vsiadmin", {NULL}, 2539, "udp"}, -{"lonworks", {NULL}, 2540, "tcp"}, -{"lonworks", {NULL}, 2540, "udp"}, -{"lonworks2", {NULL}, 2541, "tcp"}, -{"lonworks2", {NULL}, 2541, "udp"}, -{"udrawgraph", {NULL}, 2542, "tcp"}, -{"udrawgraph", {NULL}, 2542, "udp"}, -{"reftek", {NULL}, 2543, "tcp"}, -{"reftek", {NULL}, 2543, "udp"}, -{"novell-zen", {NULL}, 2544, "tcp"}, -{"novell-zen", {NULL}, 2544, "udp"}, -{"sis-emt", {NULL}, 2545, "tcp"}, -{"sis-emt", {NULL}, 2545, "udp"}, -{"vytalvaultbrtp", {NULL}, 2546, "tcp"}, -{"vytalvaultbrtp", {NULL}, 2546, "udp"}, -{"vytalvaultvsmp", {NULL}, 2547, "tcp"}, -{"vytalvaultvsmp", {NULL}, 2547, "udp"}, -{"vytalvaultpipe", {NULL}, 2548, "tcp"}, -{"vytalvaultpipe", {NULL}, 2548, "udp"}, -{"ipass", {NULL}, 2549, "tcp"}, -{"ipass", {NULL}, 2549, "udp"}, -{"ads", {NULL}, 2550, "tcp"}, -{"ads", {NULL}, 2550, "udp"}, -{"isg-uda-server", {NULL}, 2551, "tcp"}, -{"isg-uda-server", {NULL}, 2551, "udp"}, -{"call-logging", {NULL}, 2552, "tcp"}, -{"call-logging", {NULL}, 2552, "udp"}, -{"efidiningport", {NULL}, 2553, "tcp"}, -{"efidiningport", {NULL}, 2553, "udp"}, -{"vcnet-link-v10", {NULL}, 2554, "tcp"}, -{"vcnet-link-v10", {NULL}, 2554, "udp"}, -{"compaq-wcp", {NULL}, 2555, "tcp"}, -{"compaq-wcp", {NULL}, 2555, "udp"}, -{"nicetec-nmsvc", {NULL}, 2556, "tcp"}, -{"nicetec-nmsvc", {NULL}, 2556, "udp"}, -{"nicetec-mgmt", {NULL}, 2557, "tcp"}, -{"nicetec-mgmt", {NULL}, 2557, "udp"}, -{"pclemultimedia", {NULL}, 2558, "tcp"}, -{"pclemultimedia", {NULL}, 2558, "udp"}, -{"lstp", {NULL}, 2559, "tcp"}, -{"lstp", {NULL}, 2559, "udp"}, -{"labrat", {NULL}, 2560, "tcp"}, -{"labrat", {NULL}, 2560, "udp"}, -{"mosaixcc", {NULL}, 2561, "tcp"}, -{"mosaixcc", {NULL}, 2561, "udp"}, -{"delibo", {NULL}, 2562, "tcp"}, -{"delibo", {NULL}, 2562, "udp"}, -{"cti-redwood", {NULL}, 2563, "tcp"}, -{"cti-redwood", {NULL}, 2563, "udp"}, -{"hp-3000-telnet", {NULL}, 2564, "tcp"}, -{"coord-svr", {NULL}, 2565, "tcp"}, -{"coord-svr", {NULL}, 2565, "udp"}, -{"pcs-pcw", {NULL}, 2566, "tcp"}, -{"pcs-pcw", {NULL}, 2566, "udp"}, -{"clp", {NULL}, 2567, "tcp"}, -{"clp", {NULL}, 2567, "udp"}, -{"spamtrap", {NULL}, 2568, "tcp"}, -{"spamtrap", {NULL}, 2568, "udp"}, -{"sonuscallsig", {NULL}, 2569, "tcp"}, -{"sonuscallsig", {NULL}, 2569, "udp"}, -{"hs-port", {NULL}, 2570, "tcp"}, -{"hs-port", {NULL}, 2570, "udp"}, -{"cecsvc", {NULL}, 2571, "tcp"}, -{"cecsvc", {NULL}, 2571, "udp"}, -{"ibp", {NULL}, 2572, "tcp"}, -{"ibp", {NULL}, 2572, "udp"}, -{"trustestablish", {NULL}, 2573, "tcp"}, -{"trustestablish", {NULL}, 2573, "udp"}, -{"blockade-bpsp", {NULL}, 2574, "tcp"}, -{"blockade-bpsp", {NULL}, 2574, "udp"}, -{"hl7", {NULL}, 2575, "tcp"}, -{"hl7", {NULL}, 2575, "udp"}, -{"tclprodebugger", {NULL}, 2576, "tcp"}, -{"tclprodebugger", {NULL}, 2576, "udp"}, -{"scipticslsrvr", {NULL}, 2577, "tcp"}, -{"scipticslsrvr", {NULL}, 2577, "udp"}, -{"rvs-isdn-dcp", {NULL}, 2578, "tcp"}, -{"rvs-isdn-dcp", {NULL}, 2578, "udp"}, -{"mpfoncl", {NULL}, 2579, "tcp"}, -{"mpfoncl", {NULL}, 2579, "udp"}, -{"tributary", {NULL}, 2580, "tcp"}, -{"tributary", {NULL}, 2580, "udp"}, -{"argis-te", {NULL}, 2581, "tcp"}, -{"argis-te", {NULL}, 2581, "udp"}, -{"argis-ds", {NULL}, 2582, "tcp"}, -{"argis-ds", {NULL}, 2582, "udp"}, -{"mon", {NULL}, 2583, "tcp"}, -{"mon", {NULL}, 2583, "udp"}, -{"cyaserv", {NULL}, 2584, "tcp"}, -{"cyaserv", {NULL}, 2584, "udp"}, -{"netx-server", {NULL}, 2585, "tcp"}, -{"netx-server", {NULL}, 2585, "udp"}, -{"netx-agent", {NULL}, 2586, "tcp"}, -{"netx-agent", {NULL}, 2586, "udp"}, -{"masc", {NULL}, 2587, "tcp"}, -{"masc", {NULL}, 2587, "udp"}, -{"privilege", {NULL}, 2588, "tcp"}, -{"privilege", {NULL}, 2588, "udp"}, -{"quartus-tcl", {NULL}, 2589, "tcp"}, -{"quartus-tcl", {NULL}, 2589, "udp"}, -{"idotdist", {NULL}, 2590, "tcp"}, -{"idotdist", {NULL}, 2590, "udp"}, -{"maytagshuffle", {NULL}, 2591, "tcp"}, -{"maytagshuffle", {NULL}, 2591, "udp"}, -{"netrek", {NULL}, 2592, "tcp"}, -{"netrek", {NULL}, 2592, "udp"}, -{"mns-mail", {NULL}, 2593, "tcp"}, -{"mns-mail", {NULL}, 2593, "udp"}, -{"dts", {NULL}, 2594, "tcp"}, -{"dts", {NULL}, 2594, "udp"}, -{"worldfusion1", {NULL}, 2595, "tcp"}, -{"worldfusion1", {NULL}, 2595, "udp"}, -{"worldfusion2", {NULL}, 2596, "tcp"}, -{"worldfusion2", {NULL}, 2596, "udp"}, -{"homesteadglory", {NULL}, 2597, "tcp"}, -{"homesteadglory", {NULL}, 2597, "udp"}, -{"citriximaclient", {NULL}, 2598, "tcp"}, -{"citriximaclient", {NULL}, 2598, "udp"}, -{"snapd", {NULL}, 2599, "tcp"}, -{"snapd", {NULL}, 2599, "udp"}, -{"hpstgmgr", {NULL}, 2600, "tcp"}, -{"hpstgmgr", {NULL}, 2600, "udp"}, -{"discp-client", {NULL}, 2601, "tcp"}, -{"discp-client", {NULL}, 2601, "udp"}, -{"discp-server", {NULL}, 2602, "tcp"}, -{"discp-server", {NULL}, 2602, "udp"}, -{"servicemeter", {NULL}, 2603, "tcp"}, -{"servicemeter", {NULL}, 2603, "udp"}, -{"nsc-ccs", {NULL}, 2604, "tcp"}, -{"nsc-ccs", {NULL}, 2604, "udp"}, -{"nsc-posa", {NULL}, 2605, "tcp"}, -{"nsc-posa", {NULL}, 2605, "udp"}, -{"netmon", {NULL}, 2606, "tcp"}, -{"netmon", {NULL}, 2606, "udp"}, -{"connection", {NULL}, 2607, "tcp"}, -{"connection", {NULL}, 2607, "udp"}, -{"wag-service", {NULL}, 2608, "tcp"}, -{"wag-service", {NULL}, 2608, "udp"}, -{"system-monitor", {NULL}, 2609, "tcp"}, -{"system-monitor", {NULL}, 2609, "udp"}, -{"versa-tek", {NULL}, 2610, "tcp"}, -{"versa-tek", {NULL}, 2610, "udp"}, -{"lionhead", {NULL}, 2611, "tcp"}, -{"lionhead", {NULL}, 2611, "udp"}, -{"qpasa-agent", {NULL}, 2612, "tcp"}, -{"qpasa-agent", {NULL}, 2612, "udp"}, -{"smntubootstrap", {NULL}, 2613, "tcp"}, -{"smntubootstrap", {NULL}, 2613, "udp"}, -{"neveroffline", {NULL}, 2614, "tcp"}, -{"neveroffline", {NULL}, 2614, "udp"}, -{"firepower", {NULL}, 2615, "tcp"}, -{"firepower", {NULL}, 2615, "udp"}, -{"appswitch-emp", {NULL}, 2616, "tcp"}, -{"appswitch-emp", {NULL}, 2616, "udp"}, -{"cmadmin", {NULL}, 2617, "tcp"}, -{"cmadmin", {NULL}, 2617, "udp"}, -{"priority-e-com", {NULL}, 2618, "tcp"}, -{"priority-e-com", {NULL}, 2618, "udp"}, -{"bruce", {NULL}, 2619, "tcp"}, -{"bruce", {NULL}, 2619, "udp"}, -{"lpsrecommender", {NULL}, 2620, "tcp"}, -{"lpsrecommender", {NULL}, 2620, "udp"}, -{"miles-apart", {NULL}, 2621, "tcp"}, -{"miles-apart", {NULL}, 2621, "udp"}, -{"metricadbc", {NULL}, 2622, "tcp"}, -{"metricadbc", {NULL}, 2622, "udp"}, -{"lmdp", {NULL}, 2623, "tcp"}, -{"lmdp", {NULL}, 2623, "udp"}, -{"aria", {NULL}, 2624, "tcp"}, -{"aria", {NULL}, 2624, "udp"}, -{"blwnkl-port", {NULL}, 2625, "tcp"}, -{"blwnkl-port", {NULL}, 2625, "udp"}, -{"gbjd816", {NULL}, 2626, "tcp"}, -{"gbjd816", {NULL}, 2626, "udp"}, -{"moshebeeri", {NULL}, 2627, "tcp"}, -{"moshebeeri", {NULL}, 2627, "udp"}, -{"dict", {NULL}, 2628, "tcp"}, -{"dict", {NULL}, 2628, "udp"}, -{"sitaraserver", {NULL}, 2629, "tcp"}, -{"sitaraserver", {NULL}, 2629, "udp"}, -{"sitaramgmt", {NULL}, 2630, "tcp"}, -{"sitaramgmt", {NULL}, 2630, "udp"}, -{"sitaradir", {NULL}, 2631, "tcp"}, -{"sitaradir", {NULL}, 2631, "udp"}, -{"irdg-post", {NULL}, 2632, "tcp"}, -{"irdg-post", {NULL}, 2632, "udp"}, -{"interintelli", {NULL}, 2633, "tcp"}, -{"interintelli", {NULL}, 2633, "udp"}, -{"pk-electronics", {NULL}, 2634, "tcp"}, -{"pk-electronics", {NULL}, 2634, "udp"}, -{"backburner", {NULL}, 2635, "tcp"}, -{"backburner", {NULL}, 2635, "udp"}, -{"solve", {NULL}, 2636, "tcp"}, -{"solve", {NULL}, 2636, "udp"}, -{"imdocsvc", {NULL}, 2637, "tcp"}, -{"imdocsvc", {NULL}, 2637, "udp"}, -{"sybaseanywhere", {NULL}, 2638, "tcp"}, -{"sybaseanywhere", {NULL}, 2638, "udp"}, -{"aminet", {NULL}, 2639, "tcp"}, -{"aminet", {NULL}, 2639, "udp"}, -{"sai_sentlm", {NULL}, 2640, "tcp"}, -{"sai_sentlm", {NULL}, 2640, "udp"}, -{"hdl-srv", {NULL}, 2641, "tcp"}, -{"hdl-srv", {NULL}, 2641, "udp"}, -{"tragic", {NULL}, 2642, "tcp"}, -{"tragic", {NULL}, 2642, "udp"}, -{"gte-samp", {NULL}, 2643, "tcp"}, -{"gte-samp", {NULL}, 2643, "udp"}, -{"travsoft-ipx-t", {NULL}, 2644, "tcp"}, -{"travsoft-ipx-t", {NULL}, 2644, "udp"}, -{"novell-ipx-cmd", {NULL}, 2645, "tcp"}, -{"novell-ipx-cmd", {NULL}, 2645, "udp"}, -{"and-lm", {NULL}, 2646, "tcp"}, -{"and-lm", {NULL}, 2646, "udp"}, -{"syncserver", {NULL}, 2647, "tcp"}, -{"syncserver", {NULL}, 2647, "udp"}, -{"upsnotifyprot", {NULL}, 2648, "tcp"}, -{"upsnotifyprot", {NULL}, 2648, "udp"}, -{"vpsipport", {NULL}, 2649, "tcp"}, -{"vpsipport", {NULL}, 2649, "udp"}, -{"eristwoguns", {NULL}, 2650, "tcp"}, -{"eristwoguns", {NULL}, 2650, "udp"}, -{"ebinsite", {NULL}, 2651, "tcp"}, -{"ebinsite", {NULL}, 2651, "udp"}, -{"interpathpanel", {NULL}, 2652, "tcp"}, -{"interpathpanel", {NULL}, 2652, "udp"}, -{"sonus", {NULL}, 2653, "tcp"}, -{"sonus", {NULL}, 2653, "udp"}, -{"corel_vncadmin", {NULL}, 2654, "tcp"}, -{"corel_vncadmin", {NULL}, 2654, "udp"}, -{"unglue", {NULL}, 2655, "tcp"}, -{"unglue", {NULL}, 2655, "udp"}, -{"kana", {NULL}, 2656, "tcp"}, -{"kana", {NULL}, 2656, "udp"}, -{"sns-dispatcher", {NULL}, 2657, "tcp"}, -{"sns-dispatcher", {NULL}, 2657, "udp"}, -{"sns-admin", {NULL}, 2658, "tcp"}, -{"sns-admin", {NULL}, 2658, "udp"}, -{"sns-query", {NULL}, 2659, "tcp"}, -{"sns-query", {NULL}, 2659, "udp"}, -{"gcmonitor", {NULL}, 2660, "tcp"}, -{"gcmonitor", {NULL}, 2660, "udp"}, -{"olhost", {NULL}, 2661, "tcp"}, -{"olhost", {NULL}, 2661, "udp"}, -{"bintec-capi", {NULL}, 2662, "tcp"}, -{"bintec-capi", {NULL}, 2662, "udp"}, -{"bintec-tapi", {NULL}, 2663, "tcp"}, -{"bintec-tapi", {NULL}, 2663, "udp"}, -{"patrol-mq-gm", {NULL}, 2664, "tcp"}, -{"patrol-mq-gm", {NULL}, 2664, "udp"}, -{"patrol-mq-nm", {NULL}, 2665, "tcp"}, -{"patrol-mq-nm", {NULL}, 2665, "udp"}, -{"extensis", {NULL}, 2666, "tcp"}, -{"extensis", {NULL}, 2666, "udp"}, -{"alarm-clock-s", {NULL}, 2667, "tcp"}, -{"alarm-clock-s", {NULL}, 2667, "udp"}, -{"alarm-clock-c", {NULL}, 2668, "tcp"}, -{"alarm-clock-c", {NULL}, 2668, "udp"}, -{"toad", {NULL}, 2669, "tcp"}, -{"toad", {NULL}, 2669, "udp"}, -{"tve-announce", {NULL}, 2670, "tcp"}, -{"tve-announce", {NULL}, 2670, "udp"}, -{"newlixreg", {NULL}, 2671, "tcp"}, -{"newlixreg", {NULL}, 2671, "udp"}, -{"nhserver", {NULL}, 2672, "tcp"}, -{"nhserver", {NULL}, 2672, "udp"}, -{"firstcall42", {NULL}, 2673, "tcp"}, -{"firstcall42", {NULL}, 2673, "udp"}, -{"ewnn", {NULL}, 2674, "tcp"}, -{"ewnn", {NULL}, 2674, "udp"}, -{"ttc-etap", {NULL}, 2675, "tcp"}, -{"ttc-etap", {NULL}, 2675, "udp"}, -{"simslink", {NULL}, 2676, "tcp"}, -{"simslink", {NULL}, 2676, "udp"}, -{"gadgetgate1way", {NULL}, 2677, "tcp"}, -{"gadgetgate1way", {NULL}, 2677, "udp"}, -{"gadgetgate2way", {NULL}, 2678, "tcp"}, -{"gadgetgate2way", {NULL}, 2678, "udp"}, -{"syncserverssl", {NULL}, 2679, "tcp"}, -{"syncserverssl", {NULL}, 2679, "udp"}, -{"pxc-sapxom", {NULL}, 2680, "tcp"}, -{"pxc-sapxom", {NULL}, 2680, "udp"}, -{"mpnjsomb", {NULL}, 2681, "tcp"}, -{"mpnjsomb", {NULL}, 2681, "udp"}, -{"ncdloadbalance", {NULL}, 2683, "tcp"}, -{"ncdloadbalance", {NULL}, 2683, "udp"}, -{"mpnjsosv", {NULL}, 2684, "tcp"}, -{"mpnjsosv", {NULL}, 2684, "udp"}, -{"mpnjsocl", {NULL}, 2685, "tcp"}, -{"mpnjsocl", {NULL}, 2685, "udp"}, -{"mpnjsomg", {NULL}, 2686, "tcp"}, -{"mpnjsomg", {NULL}, 2686, "udp"}, -{"pq-lic-mgmt", {NULL}, 2687, "tcp"}, -{"pq-lic-mgmt", {NULL}, 2687, "udp"}, -{"md-cg-http", {NULL}, 2688, "tcp"}, -{"md-cg-http", {NULL}, 2688, "udp"}, -{"fastlynx", {NULL}, 2689, "tcp"}, -{"fastlynx", {NULL}, 2689, "udp"}, -{"hp-nnm-data", {NULL}, 2690, "tcp"}, -{"hp-nnm-data", {NULL}, 2690, "udp"}, -{"itinternet", {NULL}, 2691, "tcp"}, -{"itinternet", {NULL}, 2691, "udp"}, -{"admins-lms", {NULL}, 2692, "tcp"}, -{"admins-lms", {NULL}, 2692, "udp"}, -{"pwrsevent", {NULL}, 2694, "tcp"}, -{"pwrsevent", {NULL}, 2694, "udp"}, -{"vspread", {NULL}, 2695, "tcp"}, -{"vspread", {NULL}, 2695, "udp"}, -{"unifyadmin", {NULL}, 2696, "tcp"}, -{"unifyadmin", {NULL}, 2696, "udp"}, -{"oce-snmp-trap", {NULL}, 2697, "tcp"}, -{"oce-snmp-trap", {NULL}, 2697, "udp"}, -{"mck-ivpip", {NULL}, 2698, "tcp"}, -{"mck-ivpip", {NULL}, 2698, "udp"}, -{"csoft-plusclnt", {NULL}, 2699, "tcp"}, -{"csoft-plusclnt", {NULL}, 2699, "udp"}, -{"tqdata", {NULL}, 2700, "tcp"}, -{"tqdata", {NULL}, 2700, "udp"}, -{"sms-rcinfo", {NULL}, 2701, "tcp"}, -{"sms-rcinfo", {NULL}, 2701, "udp"}, -{"sms-xfer", {NULL}, 2702, "tcp"}, -{"sms-xfer", {NULL}, 2702, "udp"}, -{"sms-chat", {NULL}, 2703, "tcp"}, -{"sms-chat", {NULL}, 2703, "udp"}, -{"sms-remctrl", {NULL}, 2704, "tcp"}, -{"sms-remctrl", {NULL}, 2704, "udp"}, -{"sds-admin", {NULL}, 2705, "tcp"}, -{"sds-admin", {NULL}, 2705, "udp"}, -{"ncdmirroring", {NULL}, 2706, "tcp"}, -{"ncdmirroring", {NULL}, 2706, "udp"}, -{"emcsymapiport", {NULL}, 2707, "tcp"}, -{"emcsymapiport", {NULL}, 2707, "udp"}, -{"banyan-net", {NULL}, 2708, "tcp"}, -{"banyan-net", {NULL}, 2708, "udp"}, -{"supermon", {NULL}, 2709, "tcp"}, -{"supermon", {NULL}, 2709, "udp"}, -{"sso-service", {NULL}, 2710, "tcp"}, -{"sso-service", {NULL}, 2710, "udp"}, -{"sso-control", {NULL}, 2711, "tcp"}, -{"sso-control", {NULL}, 2711, "udp"}, -{"aocp", {NULL}, 2712, "tcp"}, -{"aocp", {NULL}, 2712, "udp"}, -{"raventbs", {NULL}, 2713, "tcp"}, -{"raventbs", {NULL}, 2713, "udp"}, -{"raventdm", {NULL}, 2714, "tcp"}, -{"raventdm", {NULL}, 2714, "udp"}, -{"hpstgmgr2", {NULL}, 2715, "tcp"}, -{"hpstgmgr2", {NULL}, 2715, "udp"}, -{"inova-ip-disco", {NULL}, 2716, "tcp"}, -{"inova-ip-disco", {NULL}, 2716, "udp"}, -{"pn-requester", {NULL}, 2717, "tcp"}, -{"pn-requester", {NULL}, 2717, "udp"}, -{"pn-requester2", {NULL}, 2718, "tcp"}, -{"pn-requester2", {NULL}, 2718, "udp"}, -{"scan-change", {NULL}, 2719, "tcp"}, -{"scan-change", {NULL}, 2719, "udp"}, -{"wkars", {NULL}, 2720, "tcp"}, -{"wkars", {NULL}, 2720, "udp"}, -{"smart-diagnose", {NULL}, 2721, "tcp"}, -{"smart-diagnose", {NULL}, 2721, "udp"}, -{"proactivesrvr", {NULL}, 2722, "tcp"}, -{"proactivesrvr", {NULL}, 2722, "udp"}, -{"watchdog-nt", {NULL}, 2723, "tcp"}, -{"watchdog-nt", {NULL}, 2723, "udp"}, -{"qotps", {NULL}, 2724, "tcp"}, -{"qotps", {NULL}, 2724, "udp"}, -{"msolap-ptp2", {NULL}, 2725, "tcp"}, -{"msolap-ptp2", {NULL}, 2725, "udp"}, -{"tams", {NULL}, 2726, "tcp"}, -{"tams", {NULL}, 2726, "udp"}, -{"mgcp-callagent", {NULL}, 2727, "tcp"}, -{"mgcp-callagent", {NULL}, 2727, "udp"}, -{"sqdr", {NULL}, 2728, "tcp"}, -{"sqdr", {NULL}, 2728, "udp"}, -{"tcim-control", {NULL}, 2729, "tcp"}, -{"tcim-control", {NULL}, 2729, "udp"}, -{"nec-raidplus", {NULL}, 2730, "tcp"}, -{"nec-raidplus", {NULL}, 2730, "udp"}, -{"fyre-messanger", {NULL}, 2731, "tcp"}, -{"fyre-messanger", {NULL}, 2731, "udp"}, -{"g5m", {NULL}, 2732, "tcp"}, -{"g5m", {NULL}, 2732, "udp"}, -{"signet-ctf", {NULL}, 2733, "tcp"}, -{"signet-ctf", {NULL}, 2733, "udp"}, -{"ccs-software", {NULL}, 2734, "tcp"}, -{"ccs-software", {NULL}, 2734, "udp"}, -{"netiq-mc", {NULL}, 2735, "tcp"}, -{"netiq-mc", {NULL}, 2735, "udp"}, -{"radwiz-nms-srv", {NULL}, 2736, "tcp"}, -{"radwiz-nms-srv", {NULL}, 2736, "udp"}, -{"srp-feedback", {NULL}, 2737, "tcp"}, -{"srp-feedback", {NULL}, 2737, "udp"}, -{"ndl-tcp-ois-gw", {NULL}, 2738, "tcp"}, -{"ndl-tcp-ois-gw", {NULL}, 2738, "udp"}, -{"tn-timing", {NULL}, 2739, "tcp"}, -{"tn-timing", {NULL}, 2739, "udp"}, -{"alarm", {NULL}, 2740, "tcp"}, -{"alarm", {NULL}, 2740, "udp"}, -{"tsb", {NULL}, 2741, "tcp"}, -{"tsb", {NULL}, 2741, "udp"}, -{"tsb2", {NULL}, 2742, "tcp"}, -{"tsb2", {NULL}, 2742, "udp"}, -{"murx", {NULL}, 2743, "tcp"}, -{"murx", {NULL}, 2743, "udp"}, -{"honyaku", {NULL}, 2744, "tcp"}, -{"honyaku", {NULL}, 2744, "udp"}, -{"urbisnet", {NULL}, 2745, "tcp"}, -{"urbisnet", {NULL}, 2745, "udp"}, -{"cpudpencap", {NULL}, 2746, "tcp"}, -{"cpudpencap", {NULL}, 2746, "udp"}, -{"fjippol-swrly", {NULL}, 2747, "tcp"}, -{"fjippol-swrly", {NULL}, 2747, "udp"}, -{"fjippol-polsvr", {NULL}, 2748, "tcp"}, -{"fjippol-polsvr", {NULL}, 2748, "udp"}, -{"fjippol-cnsl", {NULL}, 2749, "tcp"}, -{"fjippol-cnsl", {NULL}, 2749, "udp"}, -{"fjippol-port1", {NULL}, 2750, "tcp"}, -{"fjippol-port1", {NULL}, 2750, "udp"}, -{"fjippol-port2", {NULL}, 2751, "tcp"}, -{"fjippol-port2", {NULL}, 2751, "udp"}, -{"rsisysaccess", {NULL}, 2752, "tcp"}, -{"rsisysaccess", {NULL}, 2752, "udp"}, -{"de-spot", {NULL}, 2753, "tcp"}, -{"de-spot", {NULL}, 2753, "udp"}, -{"apollo-cc", {NULL}, 2754, "tcp"}, -{"apollo-cc", {NULL}, 2754, "udp"}, -{"expresspay", {NULL}, 2755, "tcp"}, -{"expresspay", {NULL}, 2755, "udp"}, -{"simplement-tie", {NULL}, 2756, "tcp"}, -{"simplement-tie", {NULL}, 2756, "udp"}, -{"cnrp", {NULL}, 2757, "tcp"}, -{"cnrp", {NULL}, 2757, "udp"}, -{"apollo-status", {NULL}, 2758, "tcp"}, -{"apollo-status", {NULL}, 2758, "udp"}, -{"apollo-gms", {NULL}, 2759, "tcp"}, -{"apollo-gms", {NULL}, 2759, "udp"}, -{"sabams", {NULL}, 2760, "tcp"}, -{"sabams", {NULL}, 2760, "udp"}, -{"dicom-iscl", {NULL}, 2761, "tcp"}, -{"dicom-iscl", {NULL}, 2761, "udp"}, -{"dicom-tls", {NULL}, 2762, "tcp"}, -{"dicom-tls", {NULL}, 2762, "udp"}, -{"desktop-dna", {NULL}, 2763, "tcp"}, -{"desktop-dna", {NULL}, 2763, "udp"}, -{"data-insurance", {NULL}, 2764, "tcp"}, -{"data-insurance", {NULL}, 2764, "udp"}, -{"qip-audup", {NULL}, 2765, "tcp"}, -{"qip-audup", {NULL}, 2765, "udp"}, -{"compaq-scp", {NULL}, 2766, "tcp"}, -{"compaq-scp", {NULL}, 2766, "udp"}, -{"uadtc", {NULL}, 2767, "tcp"}, -{"uadtc", {NULL}, 2767, "udp"}, -{"uacs", {NULL}, 2768, "tcp"}, -{"uacs", {NULL}, 2768, "udp"}, -{"exce", {NULL}, 2769, "tcp"}, -{"exce", {NULL}, 2769, "udp"}, -{"veronica", {NULL}, 2770, "tcp"}, -{"veronica", {NULL}, 2770, "udp"}, -{"vergencecm", {NULL}, 2771, "tcp"}, -{"vergencecm", {NULL}, 2771, "udp"}, -{"auris", {NULL}, 2772, "tcp"}, -{"auris", {NULL}, 2772, "udp"}, -{"rbakcup1", {NULL}, 2773, "tcp"}, -{"rbakcup1", {NULL}, 2773, "udp"}, -{"rbakcup2", {NULL}, 2774, "tcp"}, -{"rbakcup2", {NULL}, 2774, "udp"}, -{"smpp", {NULL}, 2775, "tcp"}, -{"smpp", {NULL}, 2775, "udp"}, -{"ridgeway1", {NULL}, 2776, "tcp"}, -{"ridgeway1", {NULL}, 2776, "udp"}, -{"ridgeway2", {NULL}, 2777, "tcp"}, -{"ridgeway2", {NULL}, 2777, "udp"}, -{"gwen-sonya", {NULL}, 2778, "tcp"}, -{"gwen-sonya", {NULL}, 2778, "udp"}, -{"lbc-sync", {NULL}, 2779, "tcp"}, -{"lbc-sync", {NULL}, 2779, "udp"}, -{"lbc-control", {NULL}, 2780, "tcp"}, -{"lbc-control", {NULL}, 2780, "udp"}, -{"whosells", {NULL}, 2781, "tcp"}, -{"whosells", {NULL}, 2781, "udp"}, -{"everydayrc", {NULL}, 2782, "tcp"}, -{"everydayrc", {NULL}, 2782, "udp"}, -{"aises", {NULL}, 2783, "tcp"}, -{"aises", {NULL}, 2783, "udp"}, -{"www-dev", {NULL}, 2784, "tcp"}, -{"www-dev", {NULL}, 2784, "udp"}, -{"aic-np", {NULL}, 2785, "tcp"}, -{"aic-np", {NULL}, 2785, "udp"}, -{"aic-oncrpc", {NULL}, 2786, "tcp"}, -{"aic-oncrpc", {NULL}, 2786, "udp"}, -{"piccolo", {NULL}, 2787, "tcp"}, -{"piccolo", {NULL}, 2787, "udp"}, -{"fryeserv", {NULL}, 2788, "tcp"}, -{"fryeserv", {NULL}, 2788, "udp"}, -{"media-agent", {NULL}, 2789, "tcp"}, -{"media-agent", {NULL}, 2789, "udp"}, -{"plgproxy", {NULL}, 2790, "tcp"}, -{"plgproxy", {NULL}, 2790, "udp"}, -{"mtport-regist", {NULL}, 2791, "tcp"}, -{"mtport-regist", {NULL}, 2791, "udp"}, -{"f5-globalsite", {NULL}, 2792, "tcp"}, -{"f5-globalsite", {NULL}, 2792, "udp"}, -{"initlsmsad", {NULL}, 2793, "tcp"}, -{"initlsmsad", {NULL}, 2793, "udp"}, -{"livestats", {NULL}, 2795, "tcp"}, -{"livestats", {NULL}, 2795, "udp"}, -{"ac-tech", {NULL}, 2796, "tcp"}, -{"ac-tech", {NULL}, 2796, "udp"}, -{"esp-encap", {NULL}, 2797, "tcp"}, -{"esp-encap", {NULL}, 2797, "udp"}, -{"tmesis-upshot", {NULL}, 2798, "tcp"}, -{"tmesis-upshot", {NULL}, 2798, "udp"}, -{"icon-discover", {NULL}, 2799, "tcp"}, -{"icon-discover", {NULL}, 2799, "udp"}, -{"acc-raid", {NULL}, 2800, "tcp"}, -{"acc-raid", {NULL}, 2800, "udp"}, -{"igcp", {NULL}, 2801, "tcp"}, -{"igcp", {NULL}, 2801, "udp"}, -{"veritas-tcp1", {NULL}, 2802, "tcp"}, -{"veritas-udp1", {NULL}, 2802, "udp"}, -{"btprjctrl", {NULL}, 2803, "tcp"}, -{"btprjctrl", {NULL}, 2803, "udp"}, -{"dvr-esm", {NULL}, 2804, "tcp"}, -{"dvr-esm", {NULL}, 2804, "udp"}, -{"wta-wsp-s", {NULL}, 2805, "tcp"}, -{"wta-wsp-s", {NULL}, 2805, "udp"}, -{"cspuni", {NULL}, 2806, "tcp"}, -{"cspuni", {NULL}, 2806, "udp"}, -{"cspmulti", {NULL}, 2807, "tcp"}, -{"cspmulti", {NULL}, 2807, "udp"}, -{"j-lan-p", {NULL}, 2808, "tcp"}, -{"j-lan-p", {NULL}, 2808, "udp"}, -{"corbaloc", {NULL}, 2809, "tcp"}, -{"corbaloc", {NULL}, 2809, "udp"}, -{"netsteward", {NULL}, 2810, "tcp"}, -{"netsteward", {NULL}, 2810, "udp"}, -{"gsiftp", {NULL}, 2811, "tcp"}, -{"gsiftp", {NULL}, 2811, "udp"}, -{"atmtcp", {NULL}, 2812, "tcp"}, -{"atmtcp", {NULL}, 2812, "udp"}, -{"llm-pass", {NULL}, 2813, "tcp"}, -{"llm-pass", {NULL}, 2813, "udp"}, -{"llm-csv", {NULL}, 2814, "tcp"}, -{"llm-csv", {NULL}, 2814, "udp"}, -{"lbc-measure", {NULL}, 2815, "tcp"}, -{"lbc-measure", {NULL}, 2815, "udp"}, -{"lbc-watchdog", {NULL}, 2816, "tcp"}, -{"lbc-watchdog", {NULL}, 2816, "udp"}, -{"nmsigport", {NULL}, 2817, "tcp"}, -{"nmsigport", {NULL}, 2817, "udp"}, -{"rmlnk", {NULL}, 2818, "tcp"}, -{"rmlnk", {NULL}, 2818, "udp"}, -{"fc-faultnotify", {NULL}, 2819, "tcp"}, -{"fc-faultnotify", {NULL}, 2819, "udp"}, -{"univision", {NULL}, 2820, "tcp"}, -{"univision", {NULL}, 2820, "udp"}, -{"vrts-at-port", {NULL}, 2821, "tcp"}, -{"vrts-at-port", {NULL}, 2821, "udp"}, -{"ka0wuc", {NULL}, 2822, "tcp"}, -{"ka0wuc", {NULL}, 2822, "udp"}, -{"cqg-netlan", {NULL}, 2823, "tcp"}, -{"cqg-netlan", {NULL}, 2823, "udp"}, -{"cqg-netlan-1", {NULL}, 2824, "tcp"}, -{"cqg-netlan-1", {NULL}, 2824, "udp"}, -{"slc-systemlog", {NULL}, 2826, "tcp"}, -{"slc-systemlog", {NULL}, 2826, "udp"}, -{"slc-ctrlrloops", {NULL}, 2827, "tcp"}, -{"slc-ctrlrloops", {NULL}, 2827, "udp"}, -{"itm-lm", {NULL}, 2828, "tcp"}, -{"itm-lm", {NULL}, 2828, "udp"}, -{"silkp1", {NULL}, 2829, "tcp"}, -{"silkp1", {NULL}, 2829, "udp"}, -{"silkp2", {NULL}, 2830, "tcp"}, -{"silkp2", {NULL}, 2830, "udp"}, -{"silkp3", {NULL}, 2831, "tcp"}, -{"silkp3", {NULL}, 2831, "udp"}, -{"silkp4", {NULL}, 2832, "tcp"}, -{"silkp4", {NULL}, 2832, "udp"}, -{"glishd", {NULL}, 2833, "tcp"}, -{"glishd", {NULL}, 2833, "udp"}, -{"evtp", {NULL}, 2834, "tcp"}, -{"evtp", {NULL}, 2834, "udp"}, -{"evtp-data", {NULL}, 2835, "tcp"}, -{"evtp-data", {NULL}, 2835, "udp"}, -{"catalyst", {NULL}, 2836, "tcp"}, -{"catalyst", {NULL}, 2836, "udp"}, -{"repliweb", {NULL}, 2837, "tcp"}, -{"repliweb", {NULL}, 2837, "udp"}, -{"starbot", {NULL}, 2838, "tcp"}, -{"starbot", {NULL}, 2838, "udp"}, -{"nmsigport", {NULL}, 2839, "tcp"}, -{"nmsigport", {NULL}, 2839, "udp"}, -{"l3-exprt", {NULL}, 2840, "tcp"}, -{"l3-exprt", {NULL}, 2840, "udp"}, -{"l3-ranger", {NULL}, 2841, "tcp"}, -{"l3-ranger", {NULL}, 2841, "udp"}, -{"l3-hawk", {NULL}, 2842, "tcp"}, -{"l3-hawk", {NULL}, 2842, "udp"}, -{"pdnet", {NULL}, 2843, "tcp"}, -{"pdnet", {NULL}, 2843, "udp"}, -{"bpcp-poll", {NULL}, 2844, "tcp"}, -{"bpcp-poll", {NULL}, 2844, "udp"}, -{"bpcp-trap", {NULL}, 2845, "tcp"}, -{"bpcp-trap", {NULL}, 2845, "udp"}, -{"aimpp-hello", {NULL}, 2846, "tcp"}, -{"aimpp-hello", {NULL}, 2846, "udp"}, -{"aimpp-port-req", {NULL}, 2847, "tcp"}, -{"aimpp-port-req", {NULL}, 2847, "udp"}, -{"amt-blc-port", {NULL}, 2848, "tcp"}, -{"amt-blc-port", {NULL}, 2848, "udp"}, -{"fxp", {NULL}, 2849, "tcp"}, -{"fxp", {NULL}, 2849, "udp"}, -{"metaconsole", {NULL}, 2850, "tcp"}, -{"metaconsole", {NULL}, 2850, "udp"}, -{"webemshttp", {NULL}, 2851, "tcp"}, -{"webemshttp", {NULL}, 2851, "udp"}, -{"bears-01", {NULL}, 2852, "tcp"}, -{"bears-01", {NULL}, 2852, "udp"}, -{"ispipes", {NULL}, 2853, "tcp"}, -{"ispipes", {NULL}, 2853, "udp"}, -{"infomover", {NULL}, 2854, "tcp"}, -{"infomover", {NULL}, 2854, "udp"}, -{"msrp", {NULL}, 2855, "tcp"}, -{"msrp", {NULL}, 2855, "udp"}, -{"cesdinv", {NULL}, 2856, "tcp"}, -{"cesdinv", {NULL}, 2856, "udp"}, -{"simctlp", {NULL}, 2857, "tcp"}, -{"simctlp", {NULL}, 2857, "udp"}, -{"ecnp", {NULL}, 2858, "tcp"}, -{"ecnp", {NULL}, 2858, "udp"}, -{"activememory", {NULL}, 2859, "tcp"}, -{"activememory", {NULL}, 2859, "udp"}, -{"dialpad-voice1", {NULL}, 2860, "tcp"}, -{"dialpad-voice1", {NULL}, 2860, "udp"}, -{"dialpad-voice2", {NULL}, 2861, "tcp"}, -{"dialpad-voice2", {NULL}, 2861, "udp"}, -{"ttg-protocol", {NULL}, 2862, "tcp"}, -{"ttg-protocol", {NULL}, 2862, "udp"}, -{"sonardata", {NULL}, 2863, "tcp"}, -{"sonardata", {NULL}, 2863, "udp"}, -{"astromed-main", {NULL}, 2864, "tcp"}, -{"astromed-main", {NULL}, 2864, "udp"}, -{"pit-vpn", {NULL}, 2865, "tcp"}, -{"pit-vpn", {NULL}, 2865, "udp"}, -{"iwlistener", {NULL}, 2866, "tcp"}, -{"iwlistener", {NULL}, 2866, "udp"}, -{"esps-portal", {NULL}, 2867, "tcp"}, -{"esps-portal", {NULL}, 2867, "udp"}, -{"npep-messaging", {NULL}, 2868, "tcp"}, -{"npep-messaging", {NULL}, 2868, "udp"}, -{"icslap", {NULL}, 2869, "tcp"}, -{"icslap", {NULL}, 2869, "udp"}, -{"daishi", {NULL}, 2870, "tcp"}, -{"daishi", {NULL}, 2870, "udp"}, -{"msi-selectplay", {NULL}, 2871, "tcp"}, -{"msi-selectplay", {NULL}, 2871, "udp"}, -{"radix", {NULL}, 2872, "tcp"}, -{"radix", {NULL}, 2872, "udp"}, -{"dxmessagebase1", {NULL}, 2874, "tcp"}, -{"dxmessagebase1", {NULL}, 2874, "udp"}, -{"dxmessagebase2", {NULL}, 2875, "tcp"}, -{"dxmessagebase2", {NULL}, 2875, "udp"}, -{"sps-tunnel", {NULL}, 2876, "tcp"}, -{"sps-tunnel", {NULL}, 2876, "udp"}, -{"bluelance", {NULL}, 2877, "tcp"}, -{"bluelance", {NULL}, 2877, "udp"}, -{"aap", {NULL}, 2878, "tcp"}, -{"aap", {NULL}, 2878, "udp"}, -{"ucentric-ds", {NULL}, 2879, "tcp"}, -{"ucentric-ds", {NULL}, 2879, "udp"}, -{"synapse", {NULL}, 2880, "tcp"}, -{"synapse", {NULL}, 2880, "udp"}, -{"ndsp", {NULL}, 2881, "tcp"}, -{"ndsp", {NULL}, 2881, "udp"}, -{"ndtp", {NULL}, 2882, "tcp"}, -{"ndtp", {NULL}, 2882, "udp"}, -{"ndnp", {NULL}, 2883, "tcp"}, -{"ndnp", {NULL}, 2883, "udp"}, -{"flashmsg", {NULL}, 2884, "tcp"}, -{"flashmsg", {NULL}, 2884, "udp"}, -{"topflow", {NULL}, 2885, "tcp"}, -{"topflow", {NULL}, 2885, "udp"}, -{"responselogic", {NULL}, 2886, "tcp"}, -{"responselogic", {NULL}, 2886, "udp"}, -{"aironetddp", {NULL}, 2887, "tcp"}, -{"aironetddp", {NULL}, 2887, "udp"}, -{"spcsdlobby", {NULL}, 2888, "tcp"}, -{"spcsdlobby", {NULL}, 2888, "udp"}, -{"rsom", {NULL}, 2889, "tcp"}, -{"rsom", {NULL}, 2889, "udp"}, -{"cspclmulti", {NULL}, 2890, "tcp"}, -{"cspclmulti", {NULL}, 2890, "udp"}, -{"cinegrfx-elmd", {NULL}, 2891, "tcp"}, -{"cinegrfx-elmd", {NULL}, 2891, "udp"}, -{"snifferdata", {NULL}, 2892, "tcp"}, -{"snifferdata", {NULL}, 2892, "udp"}, -{"vseconnector", {NULL}, 2893, "tcp"}, -{"vseconnector", {NULL}, 2893, "udp"}, -{"abacus-remote", {NULL}, 2894, "tcp"}, -{"abacus-remote", {NULL}, 2894, "udp"}, -{"natuslink", {NULL}, 2895, "tcp"}, -{"natuslink", {NULL}, 2895, "udp"}, -{"ecovisiong6-1", {NULL}, 2896, "tcp"}, -{"ecovisiong6-1", {NULL}, 2896, "udp"}, -{"citrix-rtmp", {NULL}, 2897, "tcp"}, -{"citrix-rtmp", {NULL}, 2897, "udp"}, -{"appliance-cfg", {NULL}, 2898, "tcp"}, -{"appliance-cfg", {NULL}, 2898, "udp"}, -{"powergemplus", {NULL}, 2899, "tcp"}, -{"powergemplus", {NULL}, 2899, "udp"}, -{"quicksuite", {NULL}, 2900, "tcp"}, -{"quicksuite", {NULL}, 2900, "udp"}, -{"allstorcns", {NULL}, 2901, "tcp"}, -{"allstorcns", {NULL}, 2901, "udp"}, -{"netaspi", {NULL}, 2902, "tcp"}, -{"netaspi", {NULL}, 2902, "udp"}, -{"suitcase", {NULL}, 2903, "tcp"}, -{"suitcase", {NULL}, 2903, "udp"}, -{"m2ua", {NULL}, 2904, "tcp"}, -{"m2ua", {NULL}, 2904, "udp"}, -{"m2ua", {NULL}, 2904, "sctp"}, -{"m3ua", {NULL}, 2905, "tcp"}, -{"m3ua", {NULL}, 2905, "sctp"}, -{"caller9", {NULL}, 2906, "tcp"}, -{"caller9", {NULL}, 2906, "udp"}, -{"webmethods-b2b", {NULL}, 2907, "tcp"}, -{"webmethods-b2b", {NULL}, 2907, "udp"}, -{"mao", {NULL}, 2908, "tcp"}, -{"mao", {NULL}, 2908, "udp"}, -{"funk-dialout", {NULL}, 2909, "tcp"}, -{"funk-dialout", {NULL}, 2909, "udp"}, -{"tdaccess", {NULL}, 2910, "tcp"}, -{"tdaccess", {NULL}, 2910, "udp"}, -{"blockade", {NULL}, 2911, "tcp"}, -{"blockade", {NULL}, 2911, "udp"}, -{"epicon", {NULL}, 2912, "tcp"}, -{"epicon", {NULL}, 2912, "udp"}, -{"boosterware", {NULL}, 2913, "tcp"}, -{"boosterware", {NULL}, 2913, "udp"}, -{"gamelobby", {NULL}, 2914, "tcp"}, -{"gamelobby", {NULL}, 2914, "udp"}, -{"tksocket", {NULL}, 2915, "tcp"}, -{"tksocket", {NULL}, 2915, "udp"}, -{"elvin_server", {NULL}, 2916, "tcp"}, -{"elvin_server", {NULL}, 2916, "udp"}, -{"elvin_client", {NULL}, 2917, "tcp"}, -{"elvin_client", {NULL}, 2917, "udp"}, -{"kastenchasepad", {NULL}, 2918, "tcp"}, -{"kastenchasepad", {NULL}, 2918, "udp"}, -{"roboer", {NULL}, 2919, "tcp"}, -{"roboer", {NULL}, 2919, "udp"}, -{"roboeda", {NULL}, 2920, "tcp"}, -{"roboeda", {NULL}, 2920, "udp"}, -{"cesdcdman", {NULL}, 2921, "tcp"}, -{"cesdcdman", {NULL}, 2921, "udp"}, -{"cesdcdtrn", {NULL}, 2922, "tcp"}, -{"cesdcdtrn", {NULL}, 2922, "udp"}, -{"wta-wsp-wtp-s", {NULL}, 2923, "tcp"}, -{"wta-wsp-wtp-s", {NULL}, 2923, "udp"}, -{"precise-vip", {NULL}, 2924, "tcp"}, -{"precise-vip", {NULL}, 2924, "udp"}, -{"mobile-file-dl", {NULL}, 2926, "tcp"}, -{"mobile-file-dl", {NULL}, 2926, "udp"}, -{"unimobilectrl", {NULL}, 2927, "tcp"}, -{"unimobilectrl", {NULL}, 2927, "udp"}, -{"redstone-cpss", {NULL}, 2928, "tcp"}, -{"redstone-cpss", {NULL}, 2928, "udp"}, -{"amx-webadmin", {NULL}, 2929, "tcp"}, -{"amx-webadmin", {NULL}, 2929, "udp"}, -{"amx-weblinx", {NULL}, 2930, "tcp"}, -{"amx-weblinx", {NULL}, 2930, "udp"}, -{"circle-x", {NULL}, 2931, "tcp"}, -{"circle-x", {NULL}, 2931, "udp"}, -{"incp", {NULL}, 2932, "tcp"}, -{"incp", {NULL}, 2932, "udp"}, -{"4-tieropmgw", {NULL}, 2933, "tcp"}, -{"4-tieropmgw", {NULL}, 2933, "udp"}, -{"4-tieropmcli", {NULL}, 2934, "tcp"}, -{"4-tieropmcli", {NULL}, 2934, "udp"}, -{"qtp", {NULL}, 2935, "tcp"}, -{"qtp", {NULL}, 2935, "udp"}, -{"otpatch", {NULL}, 2936, "tcp"}, -{"otpatch", {NULL}, 2936, "udp"}, -{"pnaconsult-lm", {NULL}, 2937, "tcp"}, -{"pnaconsult-lm", {NULL}, 2937, "udp"}, -{"sm-pas-1", {NULL}, 2938, "tcp"}, -{"sm-pas-1", {NULL}, 2938, "udp"}, -{"sm-pas-2", {NULL}, 2939, "tcp"}, -{"sm-pas-2", {NULL}, 2939, "udp"}, -{"sm-pas-3", {NULL}, 2940, "tcp"}, -{"sm-pas-3", {NULL}, 2940, "udp"}, -{"sm-pas-4", {NULL}, 2941, "tcp"}, -{"sm-pas-4", {NULL}, 2941, "udp"}, -{"sm-pas-5", {NULL}, 2942, "tcp"}, -{"sm-pas-5", {NULL}, 2942, "udp"}, -{"ttnrepository", {NULL}, 2943, "tcp"}, -{"ttnrepository", {NULL}, 2943, "udp"}, -{"megaco-h248", {NULL}, 2944, "tcp"}, -{"megaco-h248", {NULL}, 2944, "udp"}, -{"megaco-h248", {NULL}, 2944, "sctp"}, -{"h248-binary", {NULL}, 2945, "tcp"}, -{"h248-binary", {NULL}, 2945, "udp"}, -{"h248-binary", {NULL}, 2945, "sctp"}, -{"fjsvmpor", {NULL}, 2946, "tcp"}, -{"fjsvmpor", {NULL}, 2946, "udp"}, -{"gpsd", {NULL}, 2947, "tcp"}, -{"gpsd", {NULL}, 2947, "udp"}, -{"wap-push", {NULL}, 2948, "tcp"}, -{"wap-push", {NULL}, 2948, "udp"}, -{"wap-pushsecure", {NULL}, 2949, "tcp"}, -{"wap-pushsecure", {NULL}, 2949, "udp"}, -{"esip", {NULL}, 2950, "tcp"}, -{"esip", {NULL}, 2950, "udp"}, -{"ottp", {NULL}, 2951, "tcp"}, -{"ottp", {NULL}, 2951, "udp"}, -{"mpfwsas", {NULL}, 2952, "tcp"}, -{"mpfwsas", {NULL}, 2952, "udp"}, -{"ovalarmsrv", {NULL}, 2953, "tcp"}, -{"ovalarmsrv", {NULL}, 2953, "udp"}, -{"ovalarmsrv-cmd", {NULL}, 2954, "tcp"}, -{"ovalarmsrv-cmd", {NULL}, 2954, "udp"}, -{"csnotify", {NULL}, 2955, "tcp"}, -{"csnotify", {NULL}, 2955, "udp"}, -{"ovrimosdbman", {NULL}, 2956, "tcp"}, -{"ovrimosdbman", {NULL}, 2956, "udp"}, -{"jmact5", {NULL}, 2957, "tcp"}, -{"jmact5", {NULL}, 2957, "udp"}, -{"jmact6", {NULL}, 2958, "tcp"}, -{"jmact6", {NULL}, 2958, "udp"}, -{"rmopagt", {NULL}, 2959, "tcp"}, -{"rmopagt", {NULL}, 2959, "udp"}, -{"dfoxserver", {NULL}, 2960, "tcp"}, -{"dfoxserver", {NULL}, 2960, "udp"}, -{"boldsoft-lm", {NULL}, 2961, "tcp"}, -{"boldsoft-lm", {NULL}, 2961, "udp"}, -{"iph-policy-cli", {NULL}, 2962, "tcp"}, -{"iph-policy-cli", {NULL}, 2962, "udp"}, -{"iph-policy-adm", {NULL}, 2963, "tcp"}, -{"iph-policy-adm", {NULL}, 2963, "udp"}, -{"bullant-srap", {NULL}, 2964, "tcp"}, -{"bullant-srap", {NULL}, 2964, "udp"}, -{"bullant-rap", {NULL}, 2965, "tcp"}, -{"bullant-rap", {NULL}, 2965, "udp"}, -{"idp-infotrieve", {NULL}, 2966, "tcp"}, -{"idp-infotrieve", {NULL}, 2966, "udp"}, -{"ssc-agent", {NULL}, 2967, "tcp"}, -{"ssc-agent", {NULL}, 2967, "udp"}, -{"enpp", {NULL}, 2968, "tcp"}, -{"enpp", {NULL}, 2968, "udp"}, -{"essp", {NULL}, 2969, "tcp"}, -{"essp", {NULL}, 2969, "udp"}, -{"index-net", {NULL}, 2970, "tcp"}, -{"index-net", {NULL}, 2970, "udp"}, -{"netclip", {NULL}, 2971, "tcp"}, -{"netclip", {NULL}, 2971, "udp"}, -{"pmsm-webrctl", {NULL}, 2972, "tcp"}, -{"pmsm-webrctl", {NULL}, 2972, "udp"}, -{"svnetworks", {NULL}, 2973, "tcp"}, -{"svnetworks", {NULL}, 2973, "udp"}, -{"signal", {NULL}, 2974, "tcp"}, -{"signal", {NULL}, 2974, "udp"}, -{"fjmpcm", {NULL}, 2975, "tcp"}, -{"fjmpcm", {NULL}, 2975, "udp"}, -{"cns-srv-port", {NULL}, 2976, "tcp"}, -{"cns-srv-port", {NULL}, 2976, "udp"}, -{"ttc-etap-ns", {NULL}, 2977, "tcp"}, -{"ttc-etap-ns", {NULL}, 2977, "udp"}, -{"ttc-etap-ds", {NULL}, 2978, "tcp"}, -{"ttc-etap-ds", {NULL}, 2978, "udp"}, -{"h263-video", {NULL}, 2979, "tcp"}, -{"h263-video", {NULL}, 2979, "udp"}, -{"wimd", {NULL}, 2980, "tcp"}, -{"wimd", {NULL}, 2980, "udp"}, -{"mylxamport", {NULL}, 2981, "tcp"}, -{"mylxamport", {NULL}, 2981, "udp"}, -{"iwb-whiteboard", {NULL}, 2982, "tcp"}, -{"iwb-whiteboard", {NULL}, 2982, "udp"}, -{"netplan", {NULL}, 2983, "tcp"}, -{"netplan", {NULL}, 2983, "udp"}, -{"hpidsadmin", {NULL}, 2984, "tcp"}, -{"hpidsadmin", {NULL}, 2984, "udp"}, -{"hpidsagent", {NULL}, 2985, "tcp"}, -{"hpidsagent", {NULL}, 2985, "udp"}, -{"stonefalls", {NULL}, 2986, "tcp"}, -{"stonefalls", {NULL}, 2986, "udp"}, -{"identify", {NULL}, 2987, "tcp"}, -{"identify", {NULL}, 2987, "udp"}, -{"hippad", {NULL}, 2988, "tcp"}, -{"hippad", {NULL}, 2988, "udp"}, -{"zarkov", {NULL}, 2989, "tcp"}, -{"zarkov", {NULL}, 2989, "udp"}, -{"boscap", {NULL}, 2990, "tcp"}, -{"boscap", {NULL}, 2990, "udp"}, -{"wkstn-mon", {NULL}, 2991, "tcp"}, -{"wkstn-mon", {NULL}, 2991, "udp"}, -{"avenyo", {NULL}, 2992, "tcp"}, -{"avenyo", {NULL}, 2992, "udp"}, -{"veritas-vis1", {NULL}, 2993, "tcp"}, -{"veritas-vis1", {NULL}, 2993, "udp"}, -{"veritas-vis2", {NULL}, 2994, "tcp"}, -{"veritas-vis2", {NULL}, 2994, "udp"}, -{"idrs", {NULL}, 2995, "tcp"}, -{"idrs", {NULL}, 2995, "udp"}, -{"vsixml", {NULL}, 2996, "tcp"}, -{"vsixml", {NULL}, 2996, "udp"}, -{"rebol", {NULL}, 2997, "tcp"}, -{"rebol", {NULL}, 2997, "udp"}, -{"realsecure", {NULL}, 2998, "tcp"}, -{"realsecure", {NULL}, 2998, "udp"}, -{"remoteware-un", {NULL}, 2999, "tcp"}, -{"remoteware-un", {NULL}, 2999, "udp"}, -{"hbci", {NULL}, 3000, "tcp"}, -{"hbci", {NULL}, 3000, "udp"}, -{"remoteware-cl", {NULL}, 3000, "tcp"}, -{"remoteware-cl", {NULL}, 3000, "udp"}, -{"exlm-agent", {NULL}, 3002, "tcp"}, -{"exlm-agent", {NULL}, 3002, "udp"}, -{"remoteware-srv", {NULL}, 3002, "tcp"}, -{"remoteware-srv", {NULL}, 3002, "udp"}, -{"cgms", {NULL}, 3003, "tcp"}, -{"cgms", {NULL}, 3003, "udp"}, -{"csoftragent", {NULL}, 3004, "tcp"}, -{"csoftragent", {NULL}, 3004, "udp"}, -{"geniuslm", {NULL}, 3005, "tcp"}, -{"geniuslm", {NULL}, 3005, "udp"}, -{"ii-admin", {NULL}, 3006, "tcp"}, -{"ii-admin", {NULL}, 3006, "udp"}, -{"lotusmtap", {NULL}, 3007, "tcp"}, -{"lotusmtap", {NULL}, 3007, "udp"}, -{"midnight-tech", {NULL}, 3008, "tcp"}, -{"midnight-tech", {NULL}, 3008, "udp"}, -{"pxc-ntfy", {NULL}, 3009, "tcp"}, -{"pxc-ntfy", {NULL}, 3009, "udp"}, -{"gw", {NULL}, 3010, "tcp"}, -{"ping-pong", {NULL}, 3010, "udp"}, -{"trusted-web", {NULL}, 3011, "tcp"}, -{"trusted-web", {NULL}, 3011, "udp"}, -{"twsdss", {NULL}, 3012, "tcp"}, -{"twsdss", {NULL}, 3012, "udp"}, -{"gilatskysurfer", {NULL}, 3013, "tcp"}, -{"gilatskysurfer", {NULL}, 3013, "udp"}, -{"broker_service", {NULL}, 3014, "tcp"}, -{"broker_service", {NULL}, 3014, "udp"}, -{"nati-dstp", {NULL}, 3015, "tcp"}, -{"nati-dstp", {NULL}, 3015, "udp"}, -{"notify_srvr", {NULL}, 3016, "tcp"}, -{"notify_srvr", {NULL}, 3016, "udp"}, -{"event_listener", {NULL}, 3017, "tcp"}, -{"event_listener", {NULL}, 3017, "udp"}, -{"srvc_registry", {NULL}, 3018, "tcp"}, -{"srvc_registry", {NULL}, 3018, "udp"}, -{"resource_mgr", {NULL}, 3019, "tcp"}, -{"resource_mgr", {NULL}, 3019, "udp"}, -{"cifs", {NULL}, 3020, "tcp"}, -{"cifs", {NULL}, 3020, "udp"}, -{"agriserver", {NULL}, 3021, "tcp"}, -{"agriserver", {NULL}, 3021, "udp"}, -{"csregagent", {NULL}, 3022, "tcp"}, -{"csregagent", {NULL}, 3022, "udp"}, -{"magicnotes", {NULL}, 3023, "tcp"}, -{"magicnotes", {NULL}, 3023, "udp"}, -{"nds_sso", {NULL}, 3024, "tcp"}, -{"nds_sso", {NULL}, 3024, "udp"}, -{"arepa-raft", {NULL}, 3025, "tcp"}, -{"arepa-raft", {NULL}, 3025, "udp"}, -{"agri-gateway", {NULL}, 3026, "tcp"}, -{"agri-gateway", {NULL}, 3026, "udp"}, -{"LiebDevMgmt_C", {NULL}, 3027, "tcp"}, -{"LiebDevMgmt_C", {NULL}, 3027, "udp"}, -{"LiebDevMgmt_DM", {NULL}, 3028, "tcp"}, -{"LiebDevMgmt_DM", {NULL}, 3028, "udp"}, -{"LiebDevMgmt_A", {NULL}, 3029, "tcp"}, -{"LiebDevMgmt_A", {NULL}, 3029, "udp"}, -{"arepa-cas", {NULL}, 3030, "tcp"}, -{"arepa-cas", {NULL}, 3030, "udp"}, -{"eppc", {NULL}, 3031, "tcp"}, -{"eppc", {NULL}, 3031, "udp"}, -{"redwood-chat", {NULL}, 3032, "tcp"}, -{"redwood-chat", {NULL}, 3032, "udp"}, -{"pdb", {NULL}, 3033, "tcp"}, -{"pdb", {NULL}, 3033, "udp"}, -{"osmosis-aeea", {NULL}, 3034, "tcp"}, -{"osmosis-aeea", {NULL}, 3034, "udp"}, -{"fjsv-gssagt", {NULL}, 3035, "tcp"}, -{"fjsv-gssagt", {NULL}, 3035, "udp"}, -{"hagel-dump", {NULL}, 3036, "tcp"}, -{"hagel-dump", {NULL}, 3036, "udp"}, -{"hp-san-mgmt", {NULL}, 3037, "tcp"}, -{"hp-san-mgmt", {NULL}, 3037, "udp"}, -{"santak-ups", {NULL}, 3038, "tcp"}, -{"santak-ups", {NULL}, 3038, "udp"}, -{"cogitate", {NULL}, 3039, "tcp"}, -{"cogitate", {NULL}, 3039, "udp"}, -{"tomato-springs", {NULL}, 3040, "tcp"}, -{"tomato-springs", {NULL}, 3040, "udp"}, -{"di-traceware", {NULL}, 3041, "tcp"}, -{"di-traceware", {NULL}, 3041, "udp"}, -{"journee", {NULL}, 3042, "tcp"}, -{"journee", {NULL}, 3042, "udp"}, -{"brp", {NULL}, 3043, "tcp"}, -{"brp", {NULL}, 3043, "udp"}, -{"epp", {NULL}, 3044, "tcp"}, -{"epp", {NULL}, 3044, "udp"}, -{"responsenet", {NULL}, 3045, "tcp"}, -{"responsenet", {NULL}, 3045, "udp"}, -{"di-ase", {NULL}, 3046, "tcp"}, -{"di-ase", {NULL}, 3046, "udp"}, -{"hlserver", {NULL}, 3047, "tcp"}, -{"hlserver", {NULL}, 3047, "udp"}, -{"pctrader", {NULL}, 3048, "tcp"}, -{"pctrader", {NULL}, 3048, "udp"}, -{"nsws", {NULL}, 3049, "tcp"}, -{"nsws", {NULL}, 3049, "udp"}, -{"gds_db", {NULL}, 3050, "tcp"}, -{"gds_db", {NULL}, 3050, "udp"}, -{"galaxy-server", {NULL}, 3051, "tcp"}, -{"galaxy-server", {NULL}, 3051, "udp"}, -{"apc-3052", {NULL}, 3052, "tcp"}, -{"apc-3052", {NULL}, 3052, "udp"}, -{"dsom-server", {NULL}, 3053, "tcp"}, -{"dsom-server", {NULL}, 3053, "udp"}, -{"amt-cnf-prot", {NULL}, 3054, "tcp"}, -{"amt-cnf-prot", {NULL}, 3054, "udp"}, -{"policyserver", {NULL}, 3055, "tcp"}, -{"policyserver", {NULL}, 3055, "udp"}, -{"cdl-server", {NULL}, 3056, "tcp"}, -{"cdl-server", {NULL}, 3056, "udp"}, -{"goahead-fldup", {NULL}, 3057, "tcp"}, -{"goahead-fldup", {NULL}, 3057, "udp"}, -{"videobeans", {NULL}, 3058, "tcp"}, -{"videobeans", {NULL}, 3058, "udp"}, -{"qsoft", {NULL}, 3059, "tcp"}, -{"qsoft", {NULL}, 3059, "udp"}, -{"interserver", {NULL}, 3060, "tcp"}, -{"interserver", {NULL}, 3060, "udp"}, -{"cautcpd", {NULL}, 3061, "tcp"}, -{"cautcpd", {NULL}, 3061, "udp"}, -{"ncacn-ip-tcp", {NULL}, 3062, "tcp"}, -{"ncacn-ip-tcp", {NULL}, 3062, "udp"}, -{"ncadg-ip-udp", {NULL}, 3063, "tcp"}, -{"ncadg-ip-udp", {NULL}, 3063, "udp"}, -{"rprt", {NULL}, 3064, "tcp"}, -{"rprt", {NULL}, 3064, "udp"}, -{"slinterbase", {NULL}, 3065, "tcp"}, -{"slinterbase", {NULL}, 3065, "udp"}, -{"netattachsdmp", {NULL}, 3066, "tcp"}, -{"netattachsdmp", {NULL}, 3066, "udp"}, -{"fjhpjp", {NULL}, 3067, "tcp"}, -{"fjhpjp", {NULL}, 3067, "udp"}, -{"ls3bcast", {NULL}, 3068, "tcp"}, -{"ls3bcast", {NULL}, 3068, "udp"}, -{"ls3", {NULL}, 3069, "tcp"}, -{"ls3", {NULL}, 3069, "udp"}, -{"mgxswitch", {NULL}, 3070, "tcp"}, -{"mgxswitch", {NULL}, 3070, "udp"}, -{"csd-mgmt-port", {NULL}, 3071, "tcp"}, -{"csd-mgmt-port", {NULL}, 3071, "udp"}, -{"csd-monitor", {NULL}, 3072, "tcp"}, -{"csd-monitor", {NULL}, 3072, "udp"}, -{"vcrp", {NULL}, 3073, "tcp"}, -{"vcrp", {NULL}, 3073, "udp"}, -{"xbox", {NULL}, 3074, "tcp"}, -{"xbox", {NULL}, 3074, "udp"}, -{"orbix-locator", {NULL}, 3075, "tcp"}, -{"orbix-locator", {NULL}, 3075, "udp"}, -{"orbix-config", {NULL}, 3076, "tcp"}, -{"orbix-config", {NULL}, 3076, "udp"}, -{"orbix-loc-ssl", {NULL}, 3077, "tcp"}, -{"orbix-loc-ssl", {NULL}, 3077, "udp"}, -{"orbix-cfg-ssl", {NULL}, 3078, "tcp"}, -{"orbix-cfg-ssl", {NULL}, 3078, "udp"}, -{"lv-frontpanel", {NULL}, 3079, "tcp"}, -{"lv-frontpanel", {NULL}, 3079, "udp"}, -{"stm_pproc", {NULL}, 3080, "tcp"}, -{"stm_pproc", {NULL}, 3080, "udp"}, -{"tl1-lv", {NULL}, 3081, "tcp"}, -{"tl1-lv", {NULL}, 3081, "udp"}, -{"tl1-raw", {NULL}, 3082, "tcp"}, -{"tl1-raw", {NULL}, 3082, "udp"}, -{"tl1-telnet", {NULL}, 3083, "tcp"}, -{"tl1-telnet", {NULL}, 3083, "udp"}, -{"itm-mccs", {NULL}, 3084, "tcp"}, -{"itm-mccs", {NULL}, 3084, "udp"}, -{"pcihreq", {NULL}, 3085, "tcp"}, -{"pcihreq", {NULL}, 3085, "udp"}, -{"jdl-dbkitchen", {NULL}, 3086, "tcp"}, -{"jdl-dbkitchen", {NULL}, 3086, "udp"}, -{"asoki-sma", {NULL}, 3087, "tcp"}, -{"asoki-sma", {NULL}, 3087, "udp"}, -{"xdtp", {NULL}, 3088, "tcp"}, -{"xdtp", {NULL}, 3088, "udp"}, -{"ptk-alink", {NULL}, 3089, "tcp"}, -{"ptk-alink", {NULL}, 3089, "udp"}, -{"stss", {NULL}, 3090, "tcp"}, -{"stss", {NULL}, 3090, "udp"}, -{"1ci-smcs", {NULL}, 3091, "tcp"}, -{"1ci-smcs", {NULL}, 3091, "udp"}, -{"rapidmq-center", {NULL}, 3093, "tcp"}, -{"rapidmq-center", {NULL}, 3093, "udp"}, -{"rapidmq-reg", {NULL}, 3094, "tcp"}, -{"rapidmq-reg", {NULL}, 3094, "udp"}, -{"panasas", {NULL}, 3095, "tcp"}, -{"panasas", {NULL}, 3095, "udp"}, -{"ndl-aps", {NULL}, 3096, "tcp"}, -{"ndl-aps", {NULL}, 3096, "udp"}, -{"itu-bicc-stc", {NULL}, 3097, "sctp"}, -{"umm-port", {NULL}, 3098, "tcp"}, -{"umm-port", {NULL}, 3098, "udp"}, -{"chmd", {NULL}, 3099, "tcp"}, -{"chmd", {NULL}, 3099, "udp"}, -{"opcon-xps", {NULL}, 3100, "tcp"}, -{"opcon-xps", {NULL}, 3100, "udp"}, -{"hp-pxpib", {NULL}, 3101, "tcp"}, -{"hp-pxpib", {NULL}, 3101, "udp"}, -{"slslavemon", {NULL}, 3102, "tcp"}, -{"slslavemon", {NULL}, 3102, "udp"}, -{"autocuesmi", {NULL}, 3103, "tcp"}, -{"autocuesmi", {NULL}, 3103, "udp"}, -{"autocuelog", {NULL}, 3104, "tcp"}, -{"autocuetime", {NULL}, 3104, "udp"}, -{"cardbox", {NULL}, 3105, "tcp"}, -{"cardbox", {NULL}, 3105, "udp"}, -{"cardbox-http", {NULL}, 3106, "tcp"}, -{"cardbox-http", {NULL}, 3106, "udp"}, -{"business", {NULL}, 3107, "tcp"}, -{"business", {NULL}, 3107, "udp"}, -{"geolocate", {NULL}, 3108, "tcp"}, -{"geolocate", {NULL}, 3108, "udp"}, -{"personnel", {NULL}, 3109, "tcp"}, -{"personnel", {NULL}, 3109, "udp"}, -{"sim-control", {NULL}, 3110, "tcp"}, -{"sim-control", {NULL}, 3110, "udp"}, -{"wsynch", {NULL}, 3111, "tcp"}, -{"wsynch", {NULL}, 3111, "udp"}, -{"ksysguard", {NULL}, 3112, "tcp"}, -{"ksysguard", {NULL}, 3112, "udp"}, -{"cs-auth-svr", {NULL}, 3113, "tcp"}, -{"cs-auth-svr", {NULL}, 3113, "udp"}, -{"ccmad", {NULL}, 3114, "tcp"}, -{"ccmad", {NULL}, 3114, "udp"}, -{"mctet-master", {NULL}, 3115, "tcp"}, -{"mctet-master", {NULL}, 3115, "udp"}, -{"mctet-gateway", {NULL}, 3116, "tcp"}, -{"mctet-gateway", {NULL}, 3116, "udp"}, -{"mctet-jserv", {NULL}, 3117, "tcp"}, -{"mctet-jserv", {NULL}, 3117, "udp"}, -{"pkagent", {NULL}, 3118, "tcp"}, -{"pkagent", {NULL}, 3118, "udp"}, -{"d2000kernel", {NULL}, 3119, "tcp"}, -{"d2000kernel", {NULL}, 3119, "udp"}, -{"d2000webserver", {NULL}, 3120, "tcp"}, -{"d2000webserver", {NULL}, 3120, "udp"}, -{"vtr-emulator", {NULL}, 3122, "tcp"}, -{"vtr-emulator", {NULL}, 3122, "udp"}, -{"edix", {NULL}, 3123, "tcp"}, -{"edix", {NULL}, 3123, "udp"}, -{"beacon-port", {NULL}, 3124, "tcp"}, -{"beacon-port", {NULL}, 3124, "udp"}, -{"a13-an", {NULL}, 3125, "tcp"}, -{"a13-an", {NULL}, 3125, "udp"}, -{"ctx-bridge", {NULL}, 3127, "tcp"}, -{"ctx-bridge", {NULL}, 3127, "udp"}, -{"ndl-aas", {NULL}, 3128, "tcp"}, -{"ndl-aas", {NULL}, 3128, "udp"}, -{"netport-id", {NULL}, 3129, "tcp"}, -{"netport-id", {NULL}, 3129, "udp"}, -{"icpv2", {NULL}, 3130, "tcp"}, -{"icpv2", {NULL}, 3130, "udp"}, -{"netbookmark", {NULL}, 3131, "tcp"}, -{"netbookmark", {NULL}, 3131, "udp"}, -{"ms-rule-engine", {NULL}, 3132, "tcp"}, -{"ms-rule-engine", {NULL}, 3132, "udp"}, -{"prism-deploy", {NULL}, 3133, "tcp"}, -{"prism-deploy", {NULL}, 3133, "udp"}, -{"ecp", {NULL}, 3134, "tcp"}, -{"ecp", {NULL}, 3134, "udp"}, -{"peerbook-port", {NULL}, 3135, "tcp"}, -{"peerbook-port", {NULL}, 3135, "udp"}, -{"grubd", {NULL}, 3136, "tcp"}, -{"grubd", {NULL}, 3136, "udp"}, -{"rtnt-1", {NULL}, 3137, "tcp"}, -{"rtnt-1", {NULL}, 3137, "udp"}, -{"rtnt-2", {NULL}, 3138, "tcp"}, -{"rtnt-2", {NULL}, 3138, "udp"}, -{"incognitorv", {NULL}, 3139, "tcp"}, -{"incognitorv", {NULL}, 3139, "udp"}, -{"ariliamulti", {NULL}, 3140, "tcp"}, -{"ariliamulti", {NULL}, 3140, "udp"}, -{"vmodem", {NULL}, 3141, "tcp"}, -{"vmodem", {NULL}, 3141, "udp"}, -{"rdc-wh-eos", {NULL}, 3142, "tcp"}, -{"rdc-wh-eos", {NULL}, 3142, "udp"}, -{"seaview", {NULL}, 3143, "tcp"}, -{"seaview", {NULL}, 3143, "udp"}, -{"tarantella", {NULL}, 3144, "tcp"}, -{"tarantella", {NULL}, 3144, "udp"}, -{"csi-lfap", {NULL}, 3145, "tcp"}, -{"csi-lfap", {NULL}, 3145, "udp"}, -{"bears-02", {NULL}, 3146, "tcp"}, -{"bears-02", {NULL}, 3146, "udp"}, -{"rfio", {NULL}, 3147, "tcp"}, -{"rfio", {NULL}, 3147, "udp"}, -{"nm-game-admin", {NULL}, 3148, "tcp"}, -{"nm-game-admin", {NULL}, 3148, "udp"}, -{"nm-game-server", {NULL}, 3149, "tcp"}, -{"nm-game-server", {NULL}, 3149, "udp"}, -{"nm-asses-admin", {NULL}, 3150, "tcp"}, -{"nm-asses-admin", {NULL}, 3150, "udp"}, -{"nm-assessor", {NULL}, 3151, "tcp"}, -{"nm-assessor", {NULL}, 3151, "udp"}, -{"feitianrockey", {NULL}, 3152, "tcp"}, -{"feitianrockey", {NULL}, 3152, "udp"}, -{"s8-client-port", {NULL}, 3153, "tcp"}, -{"s8-client-port", {NULL}, 3153, "udp"}, -{"ccmrmi", {NULL}, 3154, "tcp"}, -{"ccmrmi", {NULL}, 3154, "udp"}, -{"jpegmpeg", {NULL}, 3155, "tcp"}, -{"jpegmpeg", {NULL}, 3155, "udp"}, -{"indura", {NULL}, 3156, "tcp"}, -{"indura", {NULL}, 3156, "udp"}, -{"e3consultants", {NULL}, 3157, "tcp"}, -{"e3consultants", {NULL}, 3157, "udp"}, -{"stvp", {NULL}, 3158, "tcp"}, -{"stvp", {NULL}, 3158, "udp"}, -{"navegaweb-port", {NULL}, 3159, "tcp"}, -{"navegaweb-port", {NULL}, 3159, "udp"}, -{"tip-app-server", {NULL}, 3160, "tcp"}, -{"tip-app-server", {NULL}, 3160, "udp"}, -{"doc1lm", {NULL}, 3161, "tcp"}, -{"doc1lm", {NULL}, 3161, "udp"}, -{"sflm", {NULL}, 3162, "tcp"}, -{"sflm", {NULL}, 3162, "udp"}, -{"res-sap", {NULL}, 3163, "tcp"}, -{"res-sap", {NULL}, 3163, "udp"}, -{"imprs", {NULL}, 3164, "tcp"}, -{"imprs", {NULL}, 3164, "udp"}, -{"newgenpay", {NULL}, 3165, "tcp"}, -{"newgenpay", {NULL}, 3165, "udp"}, -{"sossecollector", {NULL}, 3166, "tcp"}, -{"sossecollector", {NULL}, 3166, "udp"}, -{"nowcontact", {NULL}, 3167, "tcp"}, -{"nowcontact", {NULL}, 3167, "udp"}, -{"poweronnud", {NULL}, 3168, "tcp"}, -{"poweronnud", {NULL}, 3168, "udp"}, -{"serverview-as", {NULL}, 3169, "tcp"}, -{"serverview-as", {NULL}, 3169, "udp"}, -{"serverview-asn", {NULL}, 3170, "tcp"}, -{"serverview-asn", {NULL}, 3170, "udp"}, -{"serverview-gf", {NULL}, 3171, "tcp"}, -{"serverview-gf", {NULL}, 3171, "udp"}, -{"serverview-rm", {NULL}, 3172, "tcp"}, -{"serverview-rm", {NULL}, 3172, "udp"}, -{"serverview-icc", {NULL}, 3173, "tcp"}, -{"serverview-icc", {NULL}, 3173, "udp"}, -{"armi-server", {NULL}, 3174, "tcp"}, -{"armi-server", {NULL}, 3174, "udp"}, -{"t1-e1-over-ip", {NULL}, 3175, "tcp"}, -{"t1-e1-over-ip", {NULL}, 3175, "udp"}, -{"ars-master", {NULL}, 3176, "tcp"}, -{"ars-master", {NULL}, 3176, "udp"}, -{"phonex-port", {NULL}, 3177, "tcp"}, -{"phonex-port", {NULL}, 3177, "udp"}, -{"radclientport", {NULL}, 3178, "tcp"}, -{"radclientport", {NULL}, 3178, "udp"}, -{"h2gf-w-2m", {NULL}, 3179, "tcp"}, -{"h2gf-w-2m", {NULL}, 3179, "udp"}, -{"mc-brk-srv", {NULL}, 3180, "tcp"}, -{"mc-brk-srv", {NULL}, 3180, "udp"}, -{"bmcpatrolagent", {NULL}, 3181, "tcp"}, -{"bmcpatrolagent", {NULL}, 3181, "udp"}, -{"bmcpatrolrnvu", {NULL}, 3182, "tcp"}, -{"bmcpatrolrnvu", {NULL}, 3182, "udp"}, -{"cops-tls", {NULL}, 3183, "tcp"}, -{"cops-tls", {NULL}, 3183, "udp"}, -{"apogeex-port", {NULL}, 3184, "tcp"}, -{"apogeex-port", {NULL}, 3184, "udp"}, -{"smpppd", {NULL}, 3185, "tcp"}, -{"smpppd", {NULL}, 3185, "udp"}, -{"iiw-port", {NULL}, 3186, "tcp"}, -{"iiw-port", {NULL}, 3186, "udp"}, -{"odi-port", {NULL}, 3187, "tcp"}, -{"odi-port", {NULL}, 3187, "udp"}, -{"brcm-comm-port", {NULL}, 3188, "tcp"}, -{"brcm-comm-port", {NULL}, 3188, "udp"}, -{"pcle-infex", {NULL}, 3189, "tcp"}, -{"pcle-infex", {NULL}, 3189, "udp"}, -{"csvr-proxy", {NULL}, 3190, "tcp"}, -{"csvr-proxy", {NULL}, 3190, "udp"}, -{"csvr-sslproxy", {NULL}, 3191, "tcp"}, -{"csvr-sslproxy", {NULL}, 3191, "udp"}, -{"firemonrcc", {NULL}, 3192, "tcp"}, -{"firemonrcc", {NULL}, 3192, "udp"}, -{"spandataport", {NULL}, 3193, "tcp"}, -{"spandataport", {NULL}, 3193, "udp"}, -{"magbind", {NULL}, 3194, "tcp"}, -{"magbind", {NULL}, 3194, "udp"}, -{"ncu-1", {NULL}, 3195, "tcp"}, -{"ncu-1", {NULL}, 3195, "udp"}, -{"ncu-2", {NULL}, 3196, "tcp"}, -{"ncu-2", {NULL}, 3196, "udp"}, -{"embrace-dp-s", {NULL}, 3197, "tcp"}, -{"embrace-dp-s", {NULL}, 3197, "udp"}, -{"embrace-dp-c", {NULL}, 3198, "tcp"}, -{"embrace-dp-c", {NULL}, 3198, "udp"}, -{"dmod-workspace", {NULL}, 3199, "tcp"}, -{"dmod-workspace", {NULL}, 3199, "udp"}, -{"tick-port", {NULL}, 3200, "tcp"}, -{"tick-port", {NULL}, 3200, "udp"}, -{"cpq-tasksmart", {NULL}, 3201, "tcp"}, -{"cpq-tasksmart", {NULL}, 3201, "udp"}, -{"intraintra", {NULL}, 3202, "tcp"}, -{"intraintra", {NULL}, 3202, "udp"}, -{"netwatcher-mon", {NULL}, 3203, "tcp"}, -{"netwatcher-mon", {NULL}, 3203, "udp"}, -{"netwatcher-db", {NULL}, 3204, "tcp"}, -{"netwatcher-db", {NULL}, 3204, "udp"}, -{"isns", {NULL}, 3205, "tcp"}, -{"isns", {NULL}, 3205, "udp"}, -{"ironmail", {NULL}, 3206, "tcp"}, -{"ironmail", {NULL}, 3206, "udp"}, -{"vx-auth-port", {NULL}, 3207, "tcp"}, -{"vx-auth-port", {NULL}, 3207, "udp"}, -{"pfu-prcallback", {NULL}, 3208, "tcp"}, -{"pfu-prcallback", {NULL}, 3208, "udp"}, -{"netwkpathengine", {NULL}, 3209, "tcp"}, -{"netwkpathengine", {NULL}, 3209, "udp"}, -{"flamenco-proxy", {NULL}, 3210, "tcp"}, -{"flamenco-proxy", {NULL}, 3210, "udp"}, -{"avsecuremgmt", {NULL}, 3211, "tcp"}, -{"avsecuremgmt", {NULL}, 3211, "udp"}, -{"surveyinst", {NULL}, 3212, "tcp"}, -{"surveyinst", {NULL}, 3212, "udp"}, -{"neon24x7", {NULL}, 3213, "tcp"}, -{"neon24x7", {NULL}, 3213, "udp"}, -{"jmq-daemon-1", {NULL}, 3214, "tcp"}, -{"jmq-daemon-1", {NULL}, 3214, "udp"}, -{"jmq-daemon-2", {NULL}, 3215, "tcp"}, -{"jmq-daemon-2", {NULL}, 3215, "udp"}, -{"ferrari-foam", {NULL}, 3216, "tcp"}, -{"ferrari-foam", {NULL}, 3216, "udp"}, -{"unite", {NULL}, 3217, "tcp"}, -{"unite", {NULL}, 3217, "udp"}, -{"smartpackets", {NULL}, 3218, "tcp"}, -{"smartpackets", {NULL}, 3218, "udp"}, -{"wms-messenger", {NULL}, 3219, "tcp"}, -{"wms-messenger", {NULL}, 3219, "udp"}, -{"xnm-ssl", {NULL}, 3220, "tcp"}, -{"xnm-ssl", {NULL}, 3220, "udp"}, -{"xnm-clear-text", {NULL}, 3221, "tcp"}, -{"xnm-clear-text", {NULL}, 3221, "udp"}, -{"glbp", {NULL}, 3222, "tcp"}, -{"glbp", {NULL}, 3222, "udp"}, -{"digivote", {NULL}, 3223, "tcp"}, -{"digivote", {NULL}, 3223, "udp"}, -{"aes-discovery", {NULL}, 3224, "tcp"}, -{"aes-discovery", {NULL}, 3224, "udp"}, -{"fcip-port", {NULL}, 3225, "tcp"}, -{"fcip-port", {NULL}, 3225, "udp"}, -{"isi-irp", {NULL}, 3226, "tcp"}, -{"isi-irp", {NULL}, 3226, "udp"}, -{"dwnmshttp", {NULL}, 3227, "tcp"}, -{"dwnmshttp", {NULL}, 3227, "udp"}, -{"dwmsgserver", {NULL}, 3228, "tcp"}, -{"dwmsgserver", {NULL}, 3228, "udp"}, -{"global-cd-port", {NULL}, 3229, "tcp"}, -{"global-cd-port", {NULL}, 3229, "udp"}, -{"sftdst-port", {NULL}, 3230, "tcp"}, -{"sftdst-port", {NULL}, 3230, "udp"}, -{"vidigo", {NULL}, 3231, "tcp"}, -{"vidigo", {NULL}, 3231, "udp"}, -{"mdtp", {NULL}, 3232, "tcp"}, -{"mdtp", {NULL}, 3232, "udp"}, -{"whisker", {NULL}, 3233, "tcp"}, -{"whisker", {NULL}, 3233, "udp"}, -{"alchemy", {NULL}, 3234, "tcp"}, -{"alchemy", {NULL}, 3234, "udp"}, -{"mdap-port", {NULL}, 3235, "tcp"}, -{"mdap-port", {NULL}, 3235, "udp"}, -{"apparenet-ts", {NULL}, 3236, "tcp"}, -{"apparenet-ts", {NULL}, 3236, "udp"}, -{"apparenet-tps", {NULL}, 3237, "tcp"}, -{"apparenet-tps", {NULL}, 3237, "udp"}, -{"apparenet-as", {NULL}, 3238, "tcp"}, -{"apparenet-as", {NULL}, 3238, "udp"}, -{"apparenet-ui", {NULL}, 3239, "tcp"}, -{"apparenet-ui", {NULL}, 3239, "udp"}, -{"triomotion", {NULL}, 3240, "tcp"}, -{"triomotion", {NULL}, 3240, "udp"}, -{"sysorb", {NULL}, 3241, "tcp"}, -{"sysorb", {NULL}, 3241, "udp"}, -{"sdp-id-port", {NULL}, 3242, "tcp"}, -{"sdp-id-port", {NULL}, 3242, "udp"}, -{"timelot", {NULL}, 3243, "tcp"}, -{"timelot", {NULL}, 3243, "udp"}, -{"onesaf", {NULL}, 3244, "tcp"}, -{"onesaf", {NULL}, 3244, "udp"}, -{"vieo-fe", {NULL}, 3245, "tcp"}, -{"vieo-fe", {NULL}, 3245, "udp"}, -{"dvt-system", {NULL}, 3246, "tcp"}, -{"dvt-system", {NULL}, 3246, "udp"}, -{"dvt-data", {NULL}, 3247, "tcp"}, -{"dvt-data", {NULL}, 3247, "udp"}, -{"procos-lm", {NULL}, 3248, "tcp"}, -{"procos-lm", {NULL}, 3248, "udp"}, -{"ssp", {NULL}, 3249, "tcp"}, -{"ssp", {NULL}, 3249, "udp"}, -{"hicp", {NULL}, 3250, "tcp"}, -{"hicp", {NULL}, 3250, "udp"}, -{"sysscanner", {NULL}, 3251, "tcp"}, -{"sysscanner", {NULL}, 3251, "udp"}, -{"dhe", {NULL}, 3252, "tcp"}, -{"dhe", {NULL}, 3252, "udp"}, -{"pda-data", {NULL}, 3253, "tcp"}, -{"pda-data", {NULL}, 3253, "udp"}, -{"pda-sys", {NULL}, 3254, "tcp"}, -{"pda-sys", {NULL}, 3254, "udp"}, -{"semaphore", {NULL}, 3255, "tcp"}, -{"semaphore", {NULL}, 3255, "udp"}, -{"cpqrpm-agent", {NULL}, 3256, "tcp"}, -{"cpqrpm-agent", {NULL}, 3256, "udp"}, -{"cpqrpm-server", {NULL}, 3257, "tcp"}, -{"cpqrpm-server", {NULL}, 3257, "udp"}, -{"ivecon-port", {NULL}, 3258, "tcp"}, -{"ivecon-port", {NULL}, 3258, "udp"}, -{"epncdp2", {NULL}, 3259, "tcp"}, -{"epncdp2", {NULL}, 3259, "udp"}, -{"iscsi-target", {NULL}, 3260, "tcp"}, -{"iscsi-target", {NULL}, 3260, "udp"}, -{"winshadow", {NULL}, 3261, "tcp"}, -{"winshadow", {NULL}, 3261, "udp"}, -{"necp", {NULL}, 3262, "tcp"}, -{"necp", {NULL}, 3262, "udp"}, -{"ecolor-imager", {NULL}, 3263, "tcp"}, -{"ecolor-imager", {NULL}, 3263, "udp"}, -{"ccmail", {NULL}, 3264, "tcp"}, -{"ccmail", {NULL}, 3264, "udp"}, -{"altav-tunnel", {NULL}, 3265, "tcp"}, -{"altav-tunnel", {NULL}, 3265, "udp"}, -{"ns-cfg-server", {NULL}, 3266, "tcp"}, -{"ns-cfg-server", {NULL}, 3266, "udp"}, -{"ibm-dial-out", {NULL}, 3267, "tcp"}, -{"ibm-dial-out", {NULL}, 3267, "udp"}, -{"msft-gc", {NULL}, 3268, "tcp"}, -{"msft-gc", {NULL}, 3268, "udp"}, -{"msft-gc-ssl", {NULL}, 3269, "tcp"}, -{"msft-gc-ssl", {NULL}, 3269, "udp"}, -{"verismart", {NULL}, 3270, "tcp"}, -{"verismart", {NULL}, 3270, "udp"}, -{"csoft-prev", {NULL}, 3271, "tcp"}, -{"csoft-prev", {NULL}, 3271, "udp"}, -{"user-manager", {NULL}, 3272, "tcp"}, -{"user-manager", {NULL}, 3272, "udp"}, -{"sxmp", {NULL}, 3273, "tcp"}, -{"sxmp", {NULL}, 3273, "udp"}, -{"ordinox-server", {NULL}, 3274, "tcp"}, -{"ordinox-server", {NULL}, 3274, "udp"}, -{"samd", {NULL}, 3275, "tcp"}, -{"samd", {NULL}, 3275, "udp"}, -{"maxim-asics", {NULL}, 3276, "tcp"}, -{"maxim-asics", {NULL}, 3276, "udp"}, -{"awg-proxy", {NULL}, 3277, "tcp"}, -{"awg-proxy", {NULL}, 3277, "udp"}, -{"lkcmserver", {NULL}, 3278, "tcp"}, -{"lkcmserver", {NULL}, 3278, "udp"}, -{"admind", {NULL}, 3279, "tcp"}, -{"admind", {NULL}, 3279, "udp"}, -{"vs-server", {NULL}, 3280, "tcp"}, -{"vs-server", {NULL}, 3280, "udp"}, -{"sysopt", {NULL}, 3281, "tcp"}, -{"sysopt", {NULL}, 3281, "udp"}, -{"datusorb", {NULL}, 3282, "tcp"}, -{"datusorb", {NULL}, 3282, "udp"}, -{"net-assistant", {NULL}, 3283, "tcp"}, -{"net-assistant", {NULL}, 3283, "udp"}, -{"4talk", {NULL}, 3284, "tcp"}, -{"4talk", {NULL}, 3284, "udp"}, -{"plato", {NULL}, 3285, "tcp"}, -{"plato", {NULL}, 3285, "udp"}, -{"e-net", {NULL}, 3286, "tcp"}, -{"e-net", {NULL}, 3286, "udp"}, -{"directvdata", {NULL}, 3287, "tcp"}, -{"directvdata", {NULL}, 3287, "udp"}, -{"cops", {NULL}, 3288, "tcp"}, -{"cops", {NULL}, 3288, "udp"}, -{"enpc", {NULL}, 3289, "tcp"}, -{"enpc", {NULL}, 3289, "udp"}, -{"caps-lm", {NULL}, 3290, "tcp"}, -{"caps-lm", {NULL}, 3290, "udp"}, -{"sah-lm", {NULL}, 3291, "tcp"}, -{"sah-lm", {NULL}, 3291, "udp"}, -{"cart-o-rama", {NULL}, 3292, "tcp"}, -{"cart-o-rama", {NULL}, 3292, "udp"}, -{"fg-fps", {NULL}, 3293, "tcp"}, -{"fg-fps", {NULL}, 3293, "udp"}, -{"fg-gip", {NULL}, 3294, "tcp"}, -{"fg-gip", {NULL}, 3294, "udp"}, -{"dyniplookup", {NULL}, 3295, "tcp"}, -{"dyniplookup", {NULL}, 3295, "udp"}, -{"rib-slm", {NULL}, 3296, "tcp"}, -{"rib-slm", {NULL}, 3296, "udp"}, -{"cytel-lm", {NULL}, 3297, "tcp"}, -{"cytel-lm", {NULL}, 3297, "udp"}, -{"deskview", {NULL}, 3298, "tcp"}, -{"deskview", {NULL}, 3298, "udp"}, -{"pdrncs", {NULL}, 3299, "tcp"}, -{"pdrncs", {NULL}, 3299, "udp"}, -{"mcs-fastmail", {NULL}, 3302, "tcp"}, -{"mcs-fastmail", {NULL}, 3302, "udp"}, -{"opsession-clnt", {NULL}, 3303, "tcp"}, -{"opsession-clnt", {NULL}, 3303, "udp"}, -{"opsession-srvr", {NULL}, 3304, "tcp"}, -{"opsession-srvr", {NULL}, 3304, "udp"}, -{"odette-ftp", {NULL}, 3305, "tcp"}, -{"odette-ftp", {NULL}, 3305, "udp"}, -{"mysql", {NULL}, 3306, "tcp"}, -{"mysql", {NULL}, 3306, "udp"}, -{"opsession-prxy", {NULL}, 3307, "tcp"}, -{"opsession-prxy", {NULL}, 3307, "udp"}, -{"tns-server", {NULL}, 3308, "tcp"}, -{"tns-server", {NULL}, 3308, "udp"}, -{"tns-adv", {NULL}, 3309, "tcp"}, -{"tns-adv", {NULL}, 3309, "udp"}, -{"dyna-access", {NULL}, 3310, "tcp"}, -{"dyna-access", {NULL}, 3310, "udp"}, -{"mcns-tel-ret", {NULL}, 3311, "tcp"}, -{"mcns-tel-ret", {NULL}, 3311, "udp"}, -{"appman-server", {NULL}, 3312, "tcp"}, -{"appman-server", {NULL}, 3312, "udp"}, -{"uorb", {NULL}, 3313, "tcp"}, -{"uorb", {NULL}, 3313, "udp"}, -{"uohost", {NULL}, 3314, "tcp"}, -{"uohost", {NULL}, 3314, "udp"}, -{"cdid", {NULL}, 3315, "tcp"}, -{"cdid", {NULL}, 3315, "udp"}, -{"aicc-cmi", {NULL}, 3316, "tcp"}, -{"aicc-cmi", {NULL}, 3316, "udp"}, -{"vsaiport", {NULL}, 3317, "tcp"}, -{"vsaiport", {NULL}, 3317, "udp"}, -{"ssrip", {NULL}, 3318, "tcp"}, -{"ssrip", {NULL}, 3318, "udp"}, -{"sdt-lmd", {NULL}, 3319, "tcp"}, -{"sdt-lmd", {NULL}, 3319, "udp"}, -{"officelink2000", {NULL}, 3320, "tcp"}, -{"officelink2000", {NULL}, 3320, "udp"}, -{"vnsstr", {NULL}, 3321, "tcp"}, -{"vnsstr", {NULL}, 3321, "udp"}, -{"sftu", {NULL}, 3326, "tcp"}, -{"sftu", {NULL}, 3326, "udp"}, -{"bbars", {NULL}, 3327, "tcp"}, -{"bbars", {NULL}, 3327, "udp"}, -{"egptlm", {NULL}, 3328, "tcp"}, -{"egptlm", {NULL}, 3328, "udp"}, -{"hp-device-disc", {NULL}, 3329, "tcp"}, -{"hp-device-disc", {NULL}, 3329, "udp"}, -{"mcs-calypsoicf", {NULL}, 3330, "tcp"}, -{"mcs-calypsoicf", {NULL}, 3330, "udp"}, -{"mcs-messaging", {NULL}, 3331, "tcp"}, -{"mcs-messaging", {NULL}, 3331, "udp"}, -{"mcs-mailsvr", {NULL}, 3332, "tcp"}, -{"mcs-mailsvr", {NULL}, 3332, "udp"}, -{"dec-notes", {NULL}, 3333, "tcp"}, -{"dec-notes", {NULL}, 3333, "udp"}, -{"directv-web", {NULL}, 3334, "tcp"}, -{"directv-web", {NULL}, 3334, "udp"}, -{"directv-soft", {NULL}, 3335, "tcp"}, -{"directv-soft", {NULL}, 3335, "udp"}, -{"directv-tick", {NULL}, 3336, "tcp"}, -{"directv-tick", {NULL}, 3336, "udp"}, -{"directv-catlg", {NULL}, 3337, "tcp"}, -{"directv-catlg", {NULL}, 3337, "udp"}, -{"anet-b", {NULL}, 3338, "tcp"}, -{"anet-b", {NULL}, 3338, "udp"}, -{"anet-l", {NULL}, 3339, "tcp"}, -{"anet-l", {NULL}, 3339, "udp"}, -{"anet-m", {NULL}, 3340, "tcp"}, -{"anet-m", {NULL}, 3340, "udp"}, -{"anet-h", {NULL}, 3341, "tcp"}, -{"anet-h", {NULL}, 3341, "udp"}, -{"webtie", {NULL}, 3342, "tcp"}, -{"webtie", {NULL}, 3342, "udp"}, -{"ms-cluster-net", {NULL}, 3343, "tcp"}, -{"ms-cluster-net", {NULL}, 3343, "udp"}, -{"bnt-manager", {NULL}, 3344, "tcp"}, -{"bnt-manager", {NULL}, 3344, "udp"}, -{"influence", {NULL}, 3345, "tcp"}, -{"influence", {NULL}, 3345, "udp"}, -{"trnsprntproxy", {NULL}, 3346, "tcp"}, -{"trnsprntproxy", {NULL}, 3346, "udp"}, -{"phoenix-rpc", {NULL}, 3347, "tcp"}, -{"phoenix-rpc", {NULL}, 3347, "udp"}, -{"pangolin-laser", {NULL}, 3348, "tcp"}, -{"pangolin-laser", {NULL}, 3348, "udp"}, -{"chevinservices", {NULL}, 3349, "tcp"}, -{"chevinservices", {NULL}, 3349, "udp"}, -{"findviatv", {NULL}, 3350, "tcp"}, -{"findviatv", {NULL}, 3350, "udp"}, -{"btrieve", {NULL}, 3351, "tcp"}, -{"btrieve", {NULL}, 3351, "udp"}, -{"ssql", {NULL}, 3352, "tcp"}, -{"ssql", {NULL}, 3352, "udp"}, -{"fatpipe", {NULL}, 3353, "tcp"}, -{"fatpipe", {NULL}, 3353, "udp"}, -{"suitjd", {NULL}, 3354, "tcp"}, -{"suitjd", {NULL}, 3354, "udp"}, -{"ordinox-dbase", {NULL}, 3355, "tcp"}, -{"ordinox-dbase", {NULL}, 3355, "udp"}, -{"upnotifyps", {NULL}, 3356, "tcp"}, -{"upnotifyps", {NULL}, 3356, "udp"}, -{"adtech-test", {NULL}, 3357, "tcp"}, -{"adtech-test", {NULL}, 3357, "udp"}, -{"mpsysrmsvr", {NULL}, 3358, "tcp"}, -{"mpsysrmsvr", {NULL}, 3358, "udp"}, -{"wg-netforce", {NULL}, 3359, "tcp"}, -{"wg-netforce", {NULL}, 3359, "udp"}, -{"kv-server", {NULL}, 3360, "tcp"}, -{"kv-server", {NULL}, 3360, "udp"}, -{"kv-agent", {NULL}, 3361, "tcp"}, -{"kv-agent", {NULL}, 3361, "udp"}, -{"dj-ilm", {NULL}, 3362, "tcp"}, -{"dj-ilm", {NULL}, 3362, "udp"}, -{"nati-vi-server", {NULL}, 3363, "tcp"}, -{"nati-vi-server", {NULL}, 3363, "udp"}, -{"creativeserver", {NULL}, 3364, "tcp"}, -{"creativeserver", {NULL}, 3364, "udp"}, -{"contentserver", {NULL}, 3365, "tcp"}, -{"contentserver", {NULL}, 3365, "udp"}, -{"creativepartnr", {NULL}, 3366, "tcp"}, -{"creativepartnr", {NULL}, 3366, "udp"}, -{"tip2", {NULL}, 3372, "tcp"}, -{"tip2", {NULL}, 3372, "udp"}, -{"lavenir-lm", {NULL}, 3373, "tcp"}, -{"lavenir-lm", {NULL}, 3373, "udp"}, -{"cluster-disc", {NULL}, 3374, "tcp"}, -{"cluster-disc", {NULL}, 3374, "udp"}, -{"vsnm-agent", {NULL}, 3375, "tcp"}, -{"vsnm-agent", {NULL}, 3375, "udp"}, -{"cdbroker", {NULL}, 3376, "tcp"}, -{"cdbroker", {NULL}, 3376, "udp"}, -{"cogsys-lm", {NULL}, 3377, "tcp"}, -{"cogsys-lm", {NULL}, 3377, "udp"}, -{"wsicopy", {NULL}, 3378, "tcp"}, -{"wsicopy", {NULL}, 3378, "udp"}, -{"socorfs", {NULL}, 3379, "tcp"}, -{"socorfs", {NULL}, 3379, "udp"}, -{"sns-channels", {NULL}, 3380, "tcp"}, -{"sns-channels", {NULL}, 3380, "udp"}, -{"geneous", {NULL}, 3381, "tcp"}, -{"geneous", {NULL}, 3381, "udp"}, -{"fujitsu-neat", {NULL}, 3382, "tcp"}, -{"fujitsu-neat", {NULL}, 3382, "udp"}, -{"esp-lm", {NULL}, 3383, "tcp"}, -{"esp-lm", {NULL}, 3383, "udp"}, -{"hp-clic", {NULL}, 3384, "tcp"}, -{"hp-clic", {NULL}, 3384, "udp"}, -{"qnxnetman", {NULL}, 3385, "tcp"}, -{"qnxnetman", {NULL}, 3385, "udp"}, -{"gprs-data", {NULL}, 3386, "tcp"}, -{"gprs-sig", {NULL}, 3386, "udp"}, -{"backroomnet", {NULL}, 3387, "tcp"}, -{"backroomnet", {NULL}, 3387, "udp"}, -{"cbserver", {NULL}, 3388, "tcp"}, -{"cbserver", {NULL}, 3388, "udp"}, -{"ms-wbt-server", {NULL}, 3389, "tcp"}, -{"ms-wbt-server", {NULL}, 3389, "udp"}, -{"dsc", {NULL}, 3390, "tcp"}, -{"dsc", {NULL}, 3390, "udp"}, -{"savant", {NULL}, 3391, "tcp"}, -{"savant", {NULL}, 3391, "udp"}, -{"efi-lm", {NULL}, 3392, "tcp"}, -{"efi-lm", {NULL}, 3392, "udp"}, -{"d2k-tapestry1", {NULL}, 3393, "tcp"}, -{"d2k-tapestry1", {NULL}, 3393, "udp"}, -{"d2k-tapestry2", {NULL}, 3394, "tcp"}, -{"d2k-tapestry2", {NULL}, 3394, "udp"}, -{"dyna-lm", {NULL}, 3395, "tcp"}, -{"dyna-lm", {NULL}, 3395, "udp"}, -{"printer_agent", {NULL}, 3396, "tcp"}, -{"printer_agent", {NULL}, 3396, "udp"}, -{"cloanto-lm", {NULL}, 3397, "tcp"}, -{"cloanto-lm", {NULL}, 3397, "udp"}, -{"mercantile", {NULL}, 3398, "tcp"}, -{"mercantile", {NULL}, 3398, "udp"}, -{"csms", {NULL}, 3399, "tcp"}, -{"csms", {NULL}, 3399, "udp"}, -{"csms2", {NULL}, 3400, "tcp"}, -{"csms2", {NULL}, 3400, "udp"}, -{"filecast", {NULL}, 3401, "tcp"}, -{"filecast", {NULL}, 3401, "udp"}, -{"fxaengine-net", {NULL}, 3402, "tcp"}, -{"fxaengine-net", {NULL}, 3402, "udp"}, -{"nokia-ann-ch1", {NULL}, 3405, "tcp"}, -{"nokia-ann-ch1", {NULL}, 3405, "udp"}, -{"nokia-ann-ch2", {NULL}, 3406, "tcp"}, -{"nokia-ann-ch2", {NULL}, 3406, "udp"}, -{"ldap-admin", {NULL}, 3407, "tcp"}, -{"ldap-admin", {NULL}, 3407, "udp"}, -{"BESApi", {NULL}, 3408, "tcp"}, -{"BESApi", {NULL}, 3408, "udp"}, -{"networklens", {NULL}, 3409, "tcp"}, -{"networklens", {NULL}, 3409, "udp"}, -{"networklenss", {NULL}, 3410, "tcp"}, -{"networklenss", {NULL}, 3410, "udp"}, -{"biolink-auth", {NULL}, 3411, "tcp"}, -{"biolink-auth", {NULL}, 3411, "udp"}, -{"xmlblaster", {NULL}, 3412, "tcp"}, -{"xmlblaster", {NULL}, 3412, "udp"}, -{"svnet", {NULL}, 3413, "tcp"}, -{"svnet", {NULL}, 3413, "udp"}, -{"wip-port", {NULL}, 3414, "tcp"}, -{"wip-port", {NULL}, 3414, "udp"}, -{"bcinameservice", {NULL}, 3415, "tcp"}, -{"bcinameservice", {NULL}, 3415, "udp"}, -{"commandport", {NULL}, 3416, "tcp"}, -{"commandport", {NULL}, 3416, "udp"}, -{"csvr", {NULL}, 3417, "tcp"}, -{"csvr", {NULL}, 3417, "udp"}, -{"rnmap", {NULL}, 3418, "tcp"}, -{"rnmap", {NULL}, 3418, "udp"}, -{"softaudit", {NULL}, 3419, "tcp"}, -{"softaudit", {NULL}, 3419, "udp"}, -{"ifcp-port", {NULL}, 3420, "tcp"}, -{"ifcp-port", {NULL}, 3420, "udp"}, -{"bmap", {NULL}, 3421, "tcp"}, -{"bmap", {NULL}, 3421, "udp"}, -{"rusb-sys-port", {NULL}, 3422, "tcp"}, -{"rusb-sys-port", {NULL}, 3422, "udp"}, -{"xtrm", {NULL}, 3423, "tcp"}, -{"xtrm", {NULL}, 3423, "udp"}, -{"xtrms", {NULL}, 3424, "tcp"}, -{"xtrms", {NULL}, 3424, "udp"}, -{"agps-port", {NULL}, 3425, "tcp"}, -{"agps-port", {NULL}, 3425, "udp"}, -{"arkivio", {NULL}, 3426, "tcp"}, -{"arkivio", {NULL}, 3426, "udp"}, -{"websphere-snmp", {NULL}, 3427, "tcp"}, -{"websphere-snmp", {NULL}, 3427, "udp"}, -{"twcss", {NULL}, 3428, "tcp"}, -{"twcss", {NULL}, 3428, "udp"}, -{"gcsp", {NULL}, 3429, "tcp"}, -{"gcsp", {NULL}, 3429, "udp"}, -{"ssdispatch", {NULL}, 3430, "tcp"}, -{"ssdispatch", {NULL}, 3430, "udp"}, -{"ndl-als", {NULL}, 3431, "tcp"}, -{"ndl-als", {NULL}, 3431, "udp"}, -{"osdcp", {NULL}, 3432, "tcp"}, -{"osdcp", {NULL}, 3432, "udp"}, -{"alta-smp", {NULL}, 3433, "tcp"}, -{"alta-smp", {NULL}, 3433, "udp"}, -{"opencm", {NULL}, 3434, "tcp"}, -{"opencm", {NULL}, 3434, "udp"}, -{"pacom", {NULL}, 3435, "tcp"}, -{"pacom", {NULL}, 3435, "udp"}, -{"gc-config", {NULL}, 3436, "tcp"}, -{"gc-config", {NULL}, 3436, "udp"}, -{"autocueds", {NULL}, 3437, "tcp"}, -{"autocueds", {NULL}, 3437, "udp"}, -{"spiral-admin", {NULL}, 3438, "tcp"}, -{"spiral-admin", {NULL}, 3438, "udp"}, -{"hri-port", {NULL}, 3439, "tcp"}, -{"hri-port", {NULL}, 3439, "udp"}, -{"ans-console", {NULL}, 3440, "tcp"}, -{"ans-console", {NULL}, 3440, "udp"}, -{"connect-client", {NULL}, 3441, "tcp"}, -{"connect-client", {NULL}, 3441, "udp"}, -{"connect-server", {NULL}, 3442, "tcp"}, -{"connect-server", {NULL}, 3442, "udp"}, -{"ov-nnm-websrv", {NULL}, 3443, "tcp"}, -{"ov-nnm-websrv", {NULL}, 3443, "udp"}, -{"denali-server", {NULL}, 3444, "tcp"}, -{"denali-server", {NULL}, 3444, "udp"}, -{"monp", {NULL}, 3445, "tcp"}, -{"monp", {NULL}, 3445, "udp"}, -{"3comfaxrpc", {NULL}, 3446, "tcp"}, -{"3comfaxrpc", {NULL}, 3446, "udp"}, -{"directnet", {NULL}, 3447, "tcp"}, -{"directnet", {NULL}, 3447, "udp"}, -{"dnc-port", {NULL}, 3448, "tcp"}, -{"dnc-port", {NULL}, 3448, "udp"}, -{"hotu-chat", {NULL}, 3449, "tcp"}, -{"hotu-chat", {NULL}, 3449, "udp"}, -{"castorproxy", {NULL}, 3450, "tcp"}, -{"castorproxy", {NULL}, 3450, "udp"}, -{"asam", {NULL}, 3451, "tcp"}, -{"asam", {NULL}, 3451, "udp"}, -{"sabp-signal", {NULL}, 3452, "tcp"}, -{"sabp-signal", {NULL}, 3452, "udp"}, -{"pscupd", {NULL}, 3453, "tcp"}, -{"pscupd", {NULL}, 3453, "udp"}, -{"mira", {NULL}, 3454, "tcp"}, -{"prsvp", {NULL}, 3455, "tcp"}, -{"prsvp", {NULL}, 3455, "udp"}, -{"vat", {NULL}, 3456, "tcp"}, -{"vat", {NULL}, 3456, "udp"}, -{"vat-control", {NULL}, 3457, "tcp"}, -{"vat-control", {NULL}, 3457, "udp"}, -{"d3winosfi", {NULL}, 3458, "tcp"}, -{"d3winosfi", {NULL}, 3458, "udp"}, -{"integral", {NULL}, 3459, "tcp"}, -{"integral", {NULL}, 3459, "udp"}, -{"edm-manager", {NULL}, 3460, "tcp"}, -{"edm-manager", {NULL}, 3460, "udp"}, -{"edm-stager", {NULL}, 3461, "tcp"}, -{"edm-stager", {NULL}, 3461, "udp"}, -{"edm-std-notify", {NULL}, 3462, "tcp"}, -{"edm-std-notify", {NULL}, 3462, "udp"}, -{"edm-adm-notify", {NULL}, 3463, "tcp"}, -{"edm-adm-notify", {NULL}, 3463, "udp"}, -{"edm-mgr-sync", {NULL}, 3464, "tcp"}, -{"edm-mgr-sync", {NULL}, 3464, "udp"}, -{"edm-mgr-cntrl", {NULL}, 3465, "tcp"}, -{"edm-mgr-cntrl", {NULL}, 3465, "udp"}, -{"workflow", {NULL}, 3466, "tcp"}, -{"workflow", {NULL}, 3466, "udp"}, -{"rcst", {NULL}, 3467, "tcp"}, -{"rcst", {NULL}, 3467, "udp"}, -{"ttcmremotectrl", {NULL}, 3468, "tcp"}, -{"ttcmremotectrl", {NULL}, 3468, "udp"}, -{"pluribus", {NULL}, 3469, "tcp"}, -{"pluribus", {NULL}, 3469, "udp"}, -{"jt400", {NULL}, 3470, "tcp"}, -{"jt400", {NULL}, 3470, "udp"}, -{"jt400-ssl", {NULL}, 3471, "tcp"}, -{"jt400-ssl", {NULL}, 3471, "udp"}, -{"jaugsremotec-1", {NULL}, 3472, "tcp"}, -{"jaugsremotec-1", {NULL}, 3472, "udp"}, -{"jaugsremotec-2", {NULL}, 3473, "tcp"}, -{"jaugsremotec-2", {NULL}, 3473, "udp"}, -{"ttntspauto", {NULL}, 3474, "tcp"}, -{"ttntspauto", {NULL}, 3474, "udp"}, -{"genisar-port", {NULL}, 3475, "tcp"}, -{"genisar-port", {NULL}, 3475, "udp"}, -{"nppmp", {NULL}, 3476, "tcp"}, -{"nppmp", {NULL}, 3476, "udp"}, -{"ecomm", {NULL}, 3477, "tcp"}, -{"ecomm", {NULL}, 3477, "udp"}, -{"stun", {NULL}, 3478, "tcp"}, -{"stun", {NULL}, 3478, "udp"}, -{"turn", {NULL}, 3478, "tcp"}, -{"turn", {NULL}, 3478, "udp"}, -{"stun-behavior", {NULL}, 3478, "tcp"}, -{"stun-behavior", {NULL}, 3478, "udp"}, -{"twrpc", {NULL}, 3479, "tcp"}, -{"twrpc", {NULL}, 3479, "udp"}, -{"plethora", {NULL}, 3480, "tcp"}, -{"plethora", {NULL}, 3480, "udp"}, -{"cleanerliverc", {NULL}, 3481, "tcp"}, -{"cleanerliverc", {NULL}, 3481, "udp"}, -{"vulture", {NULL}, 3482, "tcp"}, -{"vulture", {NULL}, 3482, "udp"}, -{"slim-devices", {NULL}, 3483, "tcp"}, -{"slim-devices", {NULL}, 3483, "udp"}, -{"gbs-stp", {NULL}, 3484, "tcp"}, -{"gbs-stp", {NULL}, 3484, "udp"}, -{"celatalk", {NULL}, 3485, "tcp"}, -{"celatalk", {NULL}, 3485, "udp"}, -{"ifsf-hb-port", {NULL}, 3486, "tcp"}, -{"ifsf-hb-port", {NULL}, 3486, "udp"}, -{"ltctcp", {NULL}, 3487, "tcp"}, -{"ltcudp", {NULL}, 3487, "udp"}, -{"fs-rh-srv", {NULL}, 3488, "tcp"}, -{"fs-rh-srv", {NULL}, 3488, "udp"}, -{"dtp-dia", {NULL}, 3489, "tcp"}, -{"dtp-dia", {NULL}, 3489, "udp"}, -{"colubris", {NULL}, 3490, "tcp"}, -{"colubris", {NULL}, 3490, "udp"}, -{"swr-port", {NULL}, 3491, "tcp"}, -{"swr-port", {NULL}, 3491, "udp"}, -{"tvdumtray-port", {NULL}, 3492, "tcp"}, -{"tvdumtray-port", {NULL}, 3492, "udp"}, -{"nut", {NULL}, 3493, "tcp"}, -{"nut", {NULL}, 3493, "udp"}, -{"ibm3494", {NULL}, 3494, "tcp"}, -{"ibm3494", {NULL}, 3494, "udp"}, -{"seclayer-tcp", {NULL}, 3495, "tcp"}, -{"seclayer-tcp", {NULL}, 3495, "udp"}, -{"seclayer-tls", {NULL}, 3496, "tcp"}, -{"seclayer-tls", {NULL}, 3496, "udp"}, -{"ipether232port", {NULL}, 3497, "tcp"}, -{"ipether232port", {NULL}, 3497, "udp"}, -{"dashpas-port", {NULL}, 3498, "tcp"}, -{"dashpas-port", {NULL}, 3498, "udp"}, -{"sccip-media", {NULL}, 3499, "tcp"}, -{"sccip-media", {NULL}, 3499, "udp"}, -{"rtmp-port", {NULL}, 3500, "tcp"}, -{"rtmp-port", {NULL}, 3500, "udp"}, -{"isoft-p2p", {NULL}, 3501, "tcp"}, -{"isoft-p2p", {NULL}, 3501, "udp"}, -{"avinstalldisc", {NULL}, 3502, "tcp"}, -{"avinstalldisc", {NULL}, 3502, "udp"}, -{"lsp-ping", {NULL}, 3503, "tcp"}, -{"lsp-ping", {NULL}, 3503, "udp"}, -{"ironstorm", {NULL}, 3504, "tcp"}, -{"ironstorm", {NULL}, 3504, "udp"}, -{"ccmcomm", {NULL}, 3505, "tcp"}, -{"ccmcomm", {NULL}, 3505, "udp"}, -{"apc-3506", {NULL}, 3506, "tcp"}, -{"apc-3506", {NULL}, 3506, "udp"}, -{"nesh-broker", {NULL}, 3507, "tcp"}, -{"nesh-broker", {NULL}, 3507, "udp"}, -{"interactionweb", {NULL}, 3508, "tcp"}, -{"interactionweb", {NULL}, 3508, "udp"}, -{"vt-ssl", {NULL}, 3509, "tcp"}, -{"vt-ssl", {NULL}, 3509, "udp"}, -{"xss-port", {NULL}, 3510, "tcp"}, -{"xss-port", {NULL}, 3510, "udp"}, -{"webmail-2", {NULL}, 3511, "tcp"}, -{"webmail-2", {NULL}, 3511, "udp"}, -{"aztec", {NULL}, 3512, "tcp"}, -{"aztec", {NULL}, 3512, "udp"}, -{"arcpd", {NULL}, 3513, "tcp"}, -{"arcpd", {NULL}, 3513, "udp"}, -{"must-p2p", {NULL}, 3514, "tcp"}, -{"must-p2p", {NULL}, 3514, "udp"}, -{"must-backplane", {NULL}, 3515, "tcp"}, -{"must-backplane", {NULL}, 3515, "udp"}, -{"smartcard-port", {NULL}, 3516, "tcp"}, -{"smartcard-port", {NULL}, 3516, "udp"}, -{"802-11-iapp", {NULL}, 3517, "tcp"}, -{"802-11-iapp", {NULL}, 3517, "udp"}, -{"artifact-msg", {NULL}, 3518, "tcp"}, -{"artifact-msg", {NULL}, 3518, "udp"}, -{"nvmsgd", {NULL}, 3519, "tcp"}, -{"galileo", {NULL}, 3519, "udp"}, -{"galileolog", {NULL}, 3520, "tcp"}, -{"galileolog", {NULL}, 3520, "udp"}, -{"mc3ss", {NULL}, 3521, "tcp"}, -{"mc3ss", {NULL}, 3521, "udp"}, -{"nssocketport", {NULL}, 3522, "tcp"}, -{"nssocketport", {NULL}, 3522, "udp"}, -{"odeumservlink", {NULL}, 3523, "tcp"}, -{"odeumservlink", {NULL}, 3523, "udp"}, -{"ecmport", {NULL}, 3524, "tcp"}, -{"ecmport", {NULL}, 3524, "udp"}, -{"eisport", {NULL}, 3525, "tcp"}, -{"eisport", {NULL}, 3525, "udp"}, -{"starquiz-port", {NULL}, 3526, "tcp"}, -{"starquiz-port", {NULL}, 3526, "udp"}, -{"beserver-msg-q", {NULL}, 3527, "tcp"}, -{"beserver-msg-q", {NULL}, 3527, "udp"}, -{"jboss-iiop", {NULL}, 3528, "tcp"}, -{"jboss-iiop", {NULL}, 3528, "udp"}, -{"jboss-iiop-ssl", {NULL}, 3529, "tcp"}, -{"jboss-iiop-ssl", {NULL}, 3529, "udp"}, -{"gf", {NULL}, 3530, "tcp"}, -{"gf", {NULL}, 3530, "udp"}, -{"joltid", {NULL}, 3531, "tcp"}, -{"joltid", {NULL}, 3531, "udp"}, -{"raven-rmp", {NULL}, 3532, "tcp"}, -{"raven-rmp", {NULL}, 3532, "udp"}, -{"raven-rdp", {NULL}, 3533, "tcp"}, -{"raven-rdp", {NULL}, 3533, "udp"}, -{"urld-port", {NULL}, 3534, "tcp"}, -{"urld-port", {NULL}, 3534, "udp"}, -{"ms-la", {NULL}, 3535, "tcp"}, -{"ms-la", {NULL}, 3535, "udp"}, -{"snac", {NULL}, 3536, "tcp"}, -{"snac", {NULL}, 3536, "udp"}, -{"ni-visa-remote", {NULL}, 3537, "tcp"}, -{"ni-visa-remote", {NULL}, 3537, "udp"}, -{"ibm-diradm", {NULL}, 3538, "tcp"}, -{"ibm-diradm", {NULL}, 3538, "udp"}, -{"ibm-diradm-ssl", {NULL}, 3539, "tcp"}, -{"ibm-diradm-ssl", {NULL}, 3539, "udp"}, -{"pnrp-port", {NULL}, 3540, "tcp"}, -{"pnrp-port", {NULL}, 3540, "udp"}, -{"voispeed-port", {NULL}, 3541, "tcp"}, -{"voispeed-port", {NULL}, 3541, "udp"}, -{"hacl-monitor", {NULL}, 3542, "tcp"}, -{"hacl-monitor", {NULL}, 3542, "udp"}, -{"qftest-lookup", {NULL}, 3543, "tcp"}, -{"qftest-lookup", {NULL}, 3543, "udp"}, -{"teredo", {NULL}, 3544, "tcp"}, -{"teredo", {NULL}, 3544, "udp"}, -{"camac", {NULL}, 3545, "tcp"}, -{"camac", {NULL}, 3545, "udp"}, -{"symantec-sim", {NULL}, 3547, "tcp"}, -{"symantec-sim", {NULL}, 3547, "udp"}, -{"interworld", {NULL}, 3548, "tcp"}, -{"interworld", {NULL}, 3548, "udp"}, -{"tellumat-nms", {NULL}, 3549, "tcp"}, -{"tellumat-nms", {NULL}, 3549, "udp"}, -{"ssmpp", {NULL}, 3550, "tcp"}, -{"ssmpp", {NULL}, 3550, "udp"}, -{"apcupsd", {NULL}, 3551, "tcp"}, -{"apcupsd", {NULL}, 3551, "udp"}, -{"taserver", {NULL}, 3552, "tcp"}, -{"taserver", {NULL}, 3552, "udp"}, -{"rbr-discovery", {NULL}, 3553, "tcp"}, -{"rbr-discovery", {NULL}, 3553, "udp"}, -{"questnotify", {NULL}, 3554, "tcp"}, -{"questnotify", {NULL}, 3554, "udp"}, -{"razor", {NULL}, 3555, "tcp"}, -{"razor", {NULL}, 3555, "udp"}, -{"sky-transport", {NULL}, 3556, "tcp"}, -{"sky-transport", {NULL}, 3556, "udp"}, -{"personalos-001", {NULL}, 3557, "tcp"}, -{"personalos-001", {NULL}, 3557, "udp"}, -{"mcp-port", {NULL}, 3558, "tcp"}, -{"mcp-port", {NULL}, 3558, "udp"}, -{"cctv-port", {NULL}, 3559, "tcp"}, -{"cctv-port", {NULL}, 3559, "udp"}, -{"iniserve-port", {NULL}, 3560, "tcp"}, -{"iniserve-port", {NULL}, 3560, "udp"}, -{"bmc-onekey", {NULL}, 3561, "tcp"}, -{"bmc-onekey", {NULL}, 3561, "udp"}, -{"sdbproxy", {NULL}, 3562, "tcp"}, -{"sdbproxy", {NULL}, 3562, "udp"}, -{"watcomdebug", {NULL}, 3563, "tcp"}, -{"watcomdebug", {NULL}, 3563, "udp"}, -{"esimport", {NULL}, 3564, "tcp"}, -{"esimport", {NULL}, 3564, "udp"}, -{"m2pa", {NULL}, 3565, "tcp"}, -{"m2pa", {NULL}, 3565, "sctp"}, -{"quest-data-hub", {NULL}, 3566, "tcp"}, -{"oap", {NULL}, 3567, "tcp"}, -{"oap", {NULL}, 3567, "udp"}, -{"oap-s", {NULL}, 3568, "tcp"}, -{"oap-s", {NULL}, 3568, "udp"}, -{"mbg-ctrl", {NULL}, 3569, "tcp"}, -{"mbg-ctrl", {NULL}, 3569, "udp"}, -{"mccwebsvr-port", {NULL}, 3570, "tcp"}, -{"mccwebsvr-port", {NULL}, 3570, "udp"}, -{"megardsvr-port", {NULL}, 3571, "tcp"}, -{"megardsvr-port", {NULL}, 3571, "udp"}, -{"megaregsvrport", {NULL}, 3572, "tcp"}, -{"megaregsvrport", {NULL}, 3572, "udp"}, -{"tag-ups-1", {NULL}, 3573, "tcp"}, -{"tag-ups-1", {NULL}, 3573, "udp"}, -{"dmaf-server", {NULL}, 3574, "tcp"}, -{"dmaf-caster", {NULL}, 3574, "udp"}, -{"ccm-port", {NULL}, 3575, "tcp"}, -{"ccm-port", {NULL}, 3575, "udp"}, -{"cmc-port", {NULL}, 3576, "tcp"}, -{"cmc-port", {NULL}, 3576, "udp"}, -{"config-port", {NULL}, 3577, "tcp"}, -{"config-port", {NULL}, 3577, "udp"}, -{"data-port", {NULL}, 3578, "tcp"}, -{"data-port", {NULL}, 3578, "udp"}, -{"ttat3lb", {NULL}, 3579, "tcp"}, -{"ttat3lb", {NULL}, 3579, "udp"}, -{"nati-svrloc", {NULL}, 3580, "tcp"}, -{"nati-svrloc", {NULL}, 3580, "udp"}, -{"kfxaclicensing", {NULL}, 3581, "tcp"}, -{"kfxaclicensing", {NULL}, 3581, "udp"}, -{"press", {NULL}, 3582, "tcp"}, -{"press", {NULL}, 3582, "udp"}, -{"canex-watch", {NULL}, 3583, "tcp"}, -{"canex-watch", {NULL}, 3583, "udp"}, -{"u-dbap", {NULL}, 3584, "tcp"}, -{"u-dbap", {NULL}, 3584, "udp"}, -{"emprise-lls", {NULL}, 3585, "tcp"}, -{"emprise-lls", {NULL}, 3585, "udp"}, -{"emprise-lsc", {NULL}, 3586, "tcp"}, -{"emprise-lsc", {NULL}, 3586, "udp"}, -{"p2pgroup", {NULL}, 3587, "tcp"}, -{"p2pgroup", {NULL}, 3587, "udp"}, -{"sentinel", {NULL}, 3588, "tcp"}, -{"sentinel", {NULL}, 3588, "udp"}, -{"isomair", {NULL}, 3589, "tcp"}, -{"isomair", {NULL}, 3589, "udp"}, -{"wv-csp-sms", {NULL}, 3590, "tcp"}, -{"wv-csp-sms", {NULL}, 3590, "udp"}, -{"gtrack-server", {NULL}, 3591, "tcp"}, -{"gtrack-server", {NULL}, 3591, "udp"}, -{"gtrack-ne", {NULL}, 3592, "tcp"}, -{"gtrack-ne", {NULL}, 3592, "udp"}, -{"bpmd", {NULL}, 3593, "tcp"}, -{"bpmd", {NULL}, 3593, "udp"}, -{"mediaspace", {NULL}, 3594, "tcp"}, -{"mediaspace", {NULL}, 3594, "udp"}, -{"shareapp", {NULL}, 3595, "tcp"}, -{"shareapp", {NULL}, 3595, "udp"}, -{"iw-mmogame", {NULL}, 3596, "tcp"}, -{"iw-mmogame", {NULL}, 3596, "udp"}, -{"a14", {NULL}, 3597, "tcp"}, -{"a14", {NULL}, 3597, "udp"}, -{"a15", {NULL}, 3598, "tcp"}, -{"a15", {NULL}, 3598, "udp"}, -{"quasar-server", {NULL}, 3599, "tcp"}, -{"quasar-server", {NULL}, 3599, "udp"}, -{"trap-daemon", {NULL}, 3600, "tcp"}, -{"trap-daemon", {NULL}, 3600, "udp"}, -{"visinet-gui", {NULL}, 3601, "tcp"}, -{"visinet-gui", {NULL}, 3601, "udp"}, -{"infiniswitchcl", {NULL}, 3602, "tcp"}, -{"infiniswitchcl", {NULL}, 3602, "udp"}, -{"int-rcv-cntrl", {NULL}, 3603, "tcp"}, -{"int-rcv-cntrl", {NULL}, 3603, "udp"}, -{"bmc-jmx-port", {NULL}, 3604, "tcp"}, -{"bmc-jmx-port", {NULL}, 3604, "udp"}, -{"comcam-io", {NULL}, 3605, "tcp"}, -{"comcam-io", {NULL}, 3605, "udp"}, -{"splitlock", {NULL}, 3606, "tcp"}, -{"splitlock", {NULL}, 3606, "udp"}, -{"precise-i3", {NULL}, 3607, "tcp"}, -{"precise-i3", {NULL}, 3607, "udp"}, -{"trendchip-dcp", {NULL}, 3608, "tcp"}, -{"trendchip-dcp", {NULL}, 3608, "udp"}, -{"cpdi-pidas-cm", {NULL}, 3609, "tcp"}, -{"cpdi-pidas-cm", {NULL}, 3609, "udp"}, -{"echonet", {NULL}, 3610, "tcp"}, -{"echonet", {NULL}, 3610, "udp"}, -{"six-degrees", {NULL}, 3611, "tcp"}, -{"six-degrees", {NULL}, 3611, "udp"}, -{"hp-dataprotect", {NULL}, 3612, "tcp"}, -{"hp-dataprotect", {NULL}, 3612, "udp"}, -{"alaris-disc", {NULL}, 3613, "tcp"}, -{"alaris-disc", {NULL}, 3613, "udp"}, -{"sigma-port", {NULL}, 3614, "tcp"}, -{"sigma-port", {NULL}, 3614, "udp"}, -{"start-network", {NULL}, 3615, "tcp"}, -{"start-network", {NULL}, 3615, "udp"}, -{"cd3o-protocol", {NULL}, 3616, "tcp"}, -{"cd3o-protocol", {NULL}, 3616, "udp"}, -{"sharp-server", {NULL}, 3617, "tcp"}, -{"sharp-server", {NULL}, 3617, "udp"}, -{"aairnet-1", {NULL}, 3618, "tcp"}, -{"aairnet-1", {NULL}, 3618, "udp"}, -{"aairnet-2", {NULL}, 3619, "tcp"}, -{"aairnet-2", {NULL}, 3619, "udp"}, -{"ep-pcp", {NULL}, 3620, "tcp"}, -{"ep-pcp", {NULL}, 3620, "udp"}, -{"ep-nsp", {NULL}, 3621, "tcp"}, -{"ep-nsp", {NULL}, 3621, "udp"}, -{"ff-lr-port", {NULL}, 3622, "tcp"}, -{"ff-lr-port", {NULL}, 3622, "udp"}, -{"haipe-discover", {NULL}, 3623, "tcp"}, -{"haipe-discover", {NULL}, 3623, "udp"}, -{"dist-upgrade", {NULL}, 3624, "tcp"}, -{"dist-upgrade", {NULL}, 3624, "udp"}, -{"volley", {NULL}, 3625, "tcp"}, -{"volley", {NULL}, 3625, "udp"}, -{"bvcdaemon-port", {NULL}, 3626, "tcp"}, -{"bvcdaemon-port", {NULL}, 3626, "udp"}, -{"jamserverport", {NULL}, 3627, "tcp"}, -{"jamserverport", {NULL}, 3627, "udp"}, -{"ept-machine", {NULL}, 3628, "tcp"}, -{"ept-machine", {NULL}, 3628, "udp"}, -{"escvpnet", {NULL}, 3629, "tcp"}, -{"escvpnet", {NULL}, 3629, "udp"}, -{"cs-remote-db", {NULL}, 3630, "tcp"}, -{"cs-remote-db", {NULL}, 3630, "udp"}, -{"cs-services", {NULL}, 3631, "tcp"}, -{"cs-services", {NULL}, 3631, "udp"}, -{"distcc", {NULL}, 3632, "tcp"}, -{"distcc", {NULL}, 3632, "udp"}, -{"wacp", {NULL}, 3633, "tcp"}, -{"wacp", {NULL}, 3633, "udp"}, -{"hlibmgr", {NULL}, 3634, "tcp"}, -{"hlibmgr", {NULL}, 3634, "udp"}, -{"sdo", {NULL}, 3635, "tcp"}, -{"sdo", {NULL}, 3635, "udp"}, -{"servistaitsm", {NULL}, 3636, "tcp"}, -{"servistaitsm", {NULL}, 3636, "udp"}, -{"scservp", {NULL}, 3637, "tcp"}, -{"scservp", {NULL}, 3637, "udp"}, -{"ehp-backup", {NULL}, 3638, "tcp"}, -{"ehp-backup", {NULL}, 3638, "udp"}, -{"xap-ha", {NULL}, 3639, "tcp"}, -{"xap-ha", {NULL}, 3639, "udp"}, -{"netplay-port1", {NULL}, 3640, "tcp"}, -{"netplay-port1", {NULL}, 3640, "udp"}, -{"netplay-port2", {NULL}, 3641, "tcp"}, -{"netplay-port2", {NULL}, 3641, "udp"}, -{"juxml-port", {NULL}, 3642, "tcp"}, -{"juxml-port", {NULL}, 3642, "udp"}, -{"audiojuggler", {NULL}, 3643, "tcp"}, -{"audiojuggler", {NULL}, 3643, "udp"}, -{"ssowatch", {NULL}, 3644, "tcp"}, -{"ssowatch", {NULL}, 3644, "udp"}, -{"cyc", {NULL}, 3645, "tcp"}, -{"cyc", {NULL}, 3645, "udp"}, -{"xss-srv-port", {NULL}, 3646, "tcp"}, -{"xss-srv-port", {NULL}, 3646, "udp"}, -{"splitlock-gw", {NULL}, 3647, "tcp"}, -{"splitlock-gw", {NULL}, 3647, "udp"}, -{"fjcp", {NULL}, 3648, "tcp"}, -{"fjcp", {NULL}, 3648, "udp"}, -{"nmmp", {NULL}, 3649, "tcp"}, -{"nmmp", {NULL}, 3649, "udp"}, -{"prismiq-plugin", {NULL}, 3650, "tcp"}, -{"prismiq-plugin", {NULL}, 3650, "udp"}, -{"xrpc-registry", {NULL}, 3651, "tcp"}, -{"xrpc-registry", {NULL}, 3651, "udp"}, -{"vxcrnbuport", {NULL}, 3652, "tcp"}, -{"vxcrnbuport", {NULL}, 3652, "udp"}, -{"tsp", {NULL}, 3653, "tcp"}, -{"tsp", {NULL}, 3653, "udp"}, -{"vaprtm", {NULL}, 3654, "tcp"}, -{"vaprtm", {NULL}, 3654, "udp"}, -{"abatemgr", {NULL}, 3655, "tcp"}, -{"abatemgr", {NULL}, 3655, "udp"}, -{"abatjss", {NULL}, 3656, "tcp"}, -{"abatjss", {NULL}, 3656, "udp"}, -{"immedianet-bcn", {NULL}, 3657, "tcp"}, -{"immedianet-bcn", {NULL}, 3657, "udp"}, -{"ps-ams", {NULL}, 3658, "tcp"}, -{"ps-ams", {NULL}, 3658, "udp"}, -{"apple-sasl", {NULL}, 3659, "tcp"}, -{"apple-sasl", {NULL}, 3659, "udp"}, -{"can-nds-ssl", {NULL}, 3660, "tcp"}, -{"can-nds-ssl", {NULL}, 3660, "udp"}, -{"can-ferret-ssl", {NULL}, 3661, "tcp"}, -{"can-ferret-ssl", {NULL}, 3661, "udp"}, -{"pserver", {NULL}, 3662, "tcp"}, -{"pserver", {NULL}, 3662, "udp"}, -{"dtp", {NULL}, 3663, "tcp"}, -{"dtp", {NULL}, 3663, "udp"}, -{"ups-engine", {NULL}, 3664, "tcp"}, -{"ups-engine", {NULL}, 3664, "udp"}, -{"ent-engine", {NULL}, 3665, "tcp"}, -{"ent-engine", {NULL}, 3665, "udp"}, -{"eserver-pap", {NULL}, 3666, "tcp"}, -{"eserver-pap", {NULL}, 3666, "udp"}, -{"infoexch", {NULL}, 3667, "tcp"}, -{"infoexch", {NULL}, 3667, "udp"}, -{"dell-rm-port", {NULL}, 3668, "tcp"}, -{"dell-rm-port", {NULL}, 3668, "udp"}, -{"casanswmgmt", {NULL}, 3669, "tcp"}, -{"casanswmgmt", {NULL}, 3669, "udp"}, -{"smile", {NULL}, 3670, "tcp"}, -{"smile", {NULL}, 3670, "udp"}, -{"efcp", {NULL}, 3671, "tcp"}, -{"efcp", {NULL}, 3671, "udp"}, -{"lispworks-orb", {NULL}, 3672, "tcp"}, -{"lispworks-orb", {NULL}, 3672, "udp"}, -{"mediavault-gui", {NULL}, 3673, "tcp"}, -{"mediavault-gui", {NULL}, 3673, "udp"}, -{"wininstall-ipc", {NULL}, 3674, "tcp"}, -{"wininstall-ipc", {NULL}, 3674, "udp"}, -{"calltrax", {NULL}, 3675, "tcp"}, -{"calltrax", {NULL}, 3675, "udp"}, -{"va-pacbase", {NULL}, 3676, "tcp"}, -{"va-pacbase", {NULL}, 3676, "udp"}, -{"roverlog", {NULL}, 3677, "tcp"}, -{"roverlog", {NULL}, 3677, "udp"}, -{"ipr-dglt", {NULL}, 3678, "tcp"}, -{"ipr-dglt", {NULL}, 3678, "udp"}, -{"newton-dock", {NULL}, 3679, "tcp"}, -{"newton-dock", {NULL}, 3679, "udp"}, -{"npds-tracker", {NULL}, 3680, "tcp"}, -{"npds-tracker", {NULL}, 3680, "udp"}, -{"bts-x73", {NULL}, 3681, "tcp"}, -{"bts-x73", {NULL}, 3681, "udp"}, -{"cas-mapi", {NULL}, 3682, "tcp"}, -{"cas-mapi", {NULL}, 3682, "udp"}, -{"bmc-ea", {NULL}, 3683, "tcp"}, -{"bmc-ea", {NULL}, 3683, "udp"}, -{"faxstfx-port", {NULL}, 3684, "tcp"}, -{"faxstfx-port", {NULL}, 3684, "udp"}, -{"dsx-agent", {NULL}, 3685, "tcp"}, -{"dsx-agent", {NULL}, 3685, "udp"}, -{"tnmpv2", {NULL}, 3686, "tcp"}, -{"tnmpv2", {NULL}, 3686, "udp"}, -{"simple-push", {NULL}, 3687, "tcp"}, -{"simple-push", {NULL}, 3687, "udp"}, -{"simple-push-s", {NULL}, 3688, "tcp"}, -{"simple-push-s", {NULL}, 3688, "udp"}, -{"daap", {NULL}, 3689, "tcp"}, -{"daap", {NULL}, 3689, "udp"}, -{"svn", {NULL}, 3690, "tcp"}, -{"svn", {NULL}, 3690, "udp"}, -{"magaya-network", {NULL}, 3691, "tcp"}, -{"magaya-network", {NULL}, 3691, "udp"}, -{"intelsync", {NULL}, 3692, "tcp"}, -{"intelsync", {NULL}, 3692, "udp"}, -{"bmc-data-coll", {NULL}, 3695, "tcp"}, -{"bmc-data-coll", {NULL}, 3695, "udp"}, -{"telnetcpcd", {NULL}, 3696, "tcp"}, -{"telnetcpcd", {NULL}, 3696, "udp"}, -{"nw-license", {NULL}, 3697, "tcp"}, -{"nw-license", {NULL}, 3697, "udp"}, -{"sagectlpanel", {NULL}, 3698, "tcp"}, -{"sagectlpanel", {NULL}, 3698, "udp"}, -{"kpn-icw", {NULL}, 3699, "tcp"}, -{"kpn-icw", {NULL}, 3699, "udp"}, -{"lrs-paging", {NULL}, 3700, "tcp"}, -{"lrs-paging", {NULL}, 3700, "udp"}, -{"netcelera", {NULL}, 3701, "tcp"}, -{"netcelera", {NULL}, 3701, "udp"}, -{"ws-discovery", {NULL}, 3702, "tcp"}, -{"ws-discovery", {NULL}, 3702, "udp"}, -{"adobeserver-3", {NULL}, 3703, "tcp"}, -{"adobeserver-3", {NULL}, 3703, "udp"}, -{"adobeserver-4", {NULL}, 3704, "tcp"}, -{"adobeserver-4", {NULL}, 3704, "udp"}, -{"adobeserver-5", {NULL}, 3705, "tcp"}, -{"adobeserver-5", {NULL}, 3705, "udp"}, -{"rt-event", {NULL}, 3706, "tcp"}, -{"rt-event", {NULL}, 3706, "udp"}, -{"rt-event-s", {NULL}, 3707, "tcp"}, -{"rt-event-s", {NULL}, 3707, "udp"}, -{"sun-as-iiops", {NULL}, 3708, "tcp"}, -{"sun-as-iiops", {NULL}, 3708, "udp"}, -{"ca-idms", {NULL}, 3709, "tcp"}, -{"ca-idms", {NULL}, 3709, "udp"}, -{"portgate-auth", {NULL}, 3710, "tcp"}, -{"portgate-auth", {NULL}, 3710, "udp"}, -{"edb-server2", {NULL}, 3711, "tcp"}, -{"edb-server2", {NULL}, 3711, "udp"}, -{"sentinel-ent", {NULL}, 3712, "tcp"}, -{"sentinel-ent", {NULL}, 3712, "udp"}, -{"tftps", {NULL}, 3713, "tcp"}, -{"tftps", {NULL}, 3713, "udp"}, -{"delos-dms", {NULL}, 3714, "tcp"}, -{"delos-dms", {NULL}, 3714, "udp"}, -{"anoto-rendezv", {NULL}, 3715, "tcp"}, -{"anoto-rendezv", {NULL}, 3715, "udp"}, -{"wv-csp-sms-cir", {NULL}, 3716, "tcp"}, -{"wv-csp-sms-cir", {NULL}, 3716, "udp"}, -{"wv-csp-udp-cir", {NULL}, 3717, "tcp"}, -{"wv-csp-udp-cir", {NULL}, 3717, "udp"}, -{"opus-services", {NULL}, 3718, "tcp"}, -{"opus-services", {NULL}, 3718, "udp"}, -{"itelserverport", {NULL}, 3719, "tcp"}, -{"itelserverport", {NULL}, 3719, "udp"}, -{"ufastro-instr", {NULL}, 3720, "tcp"}, -{"ufastro-instr", {NULL}, 3720, "udp"}, -{"xsync", {NULL}, 3721, "tcp"}, -{"xsync", {NULL}, 3721, "udp"}, -{"xserveraid", {NULL}, 3722, "tcp"}, -{"xserveraid", {NULL}, 3722, "udp"}, -{"sychrond", {NULL}, 3723, "tcp"}, -{"sychrond", {NULL}, 3723, "udp"}, -{"blizwow", {NULL}, 3724, "tcp"}, -{"blizwow", {NULL}, 3724, "udp"}, -{"na-er-tip", {NULL}, 3725, "tcp"}, -{"na-er-tip", {NULL}, 3725, "udp"}, -{"array-manager", {NULL}, 3726, "tcp"}, -{"array-manager", {NULL}, 3726, "udp"}, -{"e-mdu", {NULL}, 3727, "tcp"}, -{"e-mdu", {NULL}, 3727, "udp"}, -{"e-woa", {NULL}, 3728, "tcp"}, -{"e-woa", {NULL}, 3728, "udp"}, -{"fksp-audit", {NULL}, 3729, "tcp"}, -{"fksp-audit", {NULL}, 3729, "udp"}, -{"client-ctrl", {NULL}, 3730, "tcp"}, -{"client-ctrl", {NULL}, 3730, "udp"}, -{"smap", {NULL}, 3731, "tcp"}, -{"smap", {NULL}, 3731, "udp"}, -{"m-wnn", {NULL}, 3732, "tcp"}, -{"m-wnn", {NULL}, 3732, "udp"}, -{"multip-msg", {NULL}, 3733, "tcp"}, -{"multip-msg", {NULL}, 3733, "udp"}, -{"synel-data", {NULL}, 3734, "tcp"}, -{"synel-data", {NULL}, 3734, "udp"}, -{"pwdis", {NULL}, 3735, "tcp"}, -{"pwdis", {NULL}, 3735, "udp"}, -{"rs-rmi", {NULL}, 3736, "tcp"}, -{"rs-rmi", {NULL}, 3736, "udp"}, -{"xpanel", {NULL}, 3737, "tcp"}, -{"versatalk", {NULL}, 3738, "tcp"}, -{"versatalk", {NULL}, 3738, "udp"}, -{"launchbird-lm", {NULL}, 3739, "tcp"}, -{"launchbird-lm", {NULL}, 3739, "udp"}, -{"heartbeat", {NULL}, 3740, "tcp"}, -{"heartbeat", {NULL}, 3740, "udp"}, -{"wysdma", {NULL}, 3741, "tcp"}, -{"wysdma", {NULL}, 3741, "udp"}, -{"cst-port", {NULL}, 3742, "tcp"}, -{"cst-port", {NULL}, 3742, "udp"}, -{"ipcs-command", {NULL}, 3743, "tcp"}, -{"ipcs-command", {NULL}, 3743, "udp"}, -{"sasg", {NULL}, 3744, "tcp"}, -{"sasg", {NULL}, 3744, "udp"}, -{"gw-call-port", {NULL}, 3745, "tcp"}, -{"gw-call-port", {NULL}, 3745, "udp"}, -{"linktest", {NULL}, 3746, "tcp"}, -{"linktest", {NULL}, 3746, "udp"}, -{"linktest-s", {NULL}, 3747, "tcp"}, -{"linktest-s", {NULL}, 3747, "udp"}, -{"webdata", {NULL}, 3748, "tcp"}, -{"webdata", {NULL}, 3748, "udp"}, -{"cimtrak", {NULL}, 3749, "tcp"}, -{"cimtrak", {NULL}, 3749, "udp"}, -{"cbos-ip-port", {NULL}, 3750, "tcp"}, -{"cbos-ip-port", {NULL}, 3750, "udp"}, -{"gprs-cube", {NULL}, 3751, "tcp"}, -{"gprs-cube", {NULL}, 3751, "udp"}, -{"vipremoteagent", {NULL}, 3752, "tcp"}, -{"vipremoteagent", {NULL}, 3752, "udp"}, -{"nattyserver", {NULL}, 3753, "tcp"}, -{"nattyserver", {NULL}, 3753, "udp"}, -{"timestenbroker", {NULL}, 3754, "tcp"}, -{"timestenbroker", {NULL}, 3754, "udp"}, -{"sas-remote-hlp", {NULL}, 3755, "tcp"}, -{"sas-remote-hlp", {NULL}, 3755, "udp"}, -{"canon-capt", {NULL}, 3756, "tcp"}, -{"canon-capt", {NULL}, 3756, "udp"}, -{"grf-port", {NULL}, 3757, "tcp"}, -{"grf-port", {NULL}, 3757, "udp"}, -{"apw-registry", {NULL}, 3758, "tcp"}, -{"apw-registry", {NULL}, 3758, "udp"}, -{"exapt-lmgr", {NULL}, 3759, "tcp"}, -{"exapt-lmgr", {NULL}, 3759, "udp"}, -{"adtempusclient", {NULL}, 3760, "tcp"}, -{"adtempusclient", {NULL}, 3760, "udp"}, -{"gsakmp", {NULL}, 3761, "tcp"}, -{"gsakmp", {NULL}, 3761, "udp"}, -{"gbs-smp", {NULL}, 3762, "tcp"}, -{"gbs-smp", {NULL}, 3762, "udp"}, -{"xo-wave", {NULL}, 3763, "tcp"}, -{"xo-wave", {NULL}, 3763, "udp"}, -{"mni-prot-rout", {NULL}, 3764, "tcp"}, -{"mni-prot-rout", {NULL}, 3764, "udp"}, -{"rtraceroute", {NULL}, 3765, "tcp"}, -{"rtraceroute", {NULL}, 3765, "udp"}, -{"listmgr-port", {NULL}, 3767, "tcp"}, -{"listmgr-port", {NULL}, 3767, "udp"}, -{"rblcheckd", {NULL}, 3768, "tcp"}, -{"rblcheckd", {NULL}, 3768, "udp"}, -{"haipe-otnk", {NULL}, 3769, "tcp"}, -{"haipe-otnk", {NULL}, 3769, "udp"}, -{"cindycollab", {NULL}, 3770, "tcp"}, -{"cindycollab", {NULL}, 3770, "udp"}, -{"paging-port", {NULL}, 3771, "tcp"}, -{"paging-port", {NULL}, 3771, "udp"}, -{"ctp", {NULL}, 3772, "tcp"}, -{"ctp", {NULL}, 3772, "udp"}, -{"ctdhercules", {NULL}, 3773, "tcp"}, -{"ctdhercules", {NULL}, 3773, "udp"}, -{"zicom", {NULL}, 3774, "tcp"}, -{"zicom", {NULL}, 3774, "udp"}, -{"ispmmgr", {NULL}, 3775, "tcp"}, -{"ispmmgr", {NULL}, 3775, "udp"}, -{"dvcprov-port", {NULL}, 3776, "tcp"}, -{"dvcprov-port", {NULL}, 3776, "udp"}, -{"jibe-eb", {NULL}, 3777, "tcp"}, -{"jibe-eb", {NULL}, 3777, "udp"}, -{"c-h-it-port", {NULL}, 3778, "tcp"}, -{"c-h-it-port", {NULL}, 3778, "udp"}, -{"cognima", {NULL}, 3779, "tcp"}, -{"cognima", {NULL}, 3779, "udp"}, -{"nnp", {NULL}, 3780, "tcp"}, -{"nnp", {NULL}, 3780, "udp"}, -{"abcvoice-port", {NULL}, 3781, "tcp"}, -{"abcvoice-port", {NULL}, 3781, "udp"}, -{"iso-tp0s", {NULL}, 3782, "tcp"}, -{"iso-tp0s", {NULL}, 3782, "udp"}, -{"bim-pem", {NULL}, 3783, "tcp"}, -{"bim-pem", {NULL}, 3783, "udp"}, -{"bfd-control", {NULL}, 3784, "tcp"}, -{"bfd-control", {NULL}, 3784, "udp"}, -{"bfd-echo", {NULL}, 3785, "tcp"}, -{"bfd-echo", {NULL}, 3785, "udp"}, -{"upstriggervsw", {NULL}, 3786, "tcp"}, -{"upstriggervsw", {NULL}, 3786, "udp"}, -{"fintrx", {NULL}, 3787, "tcp"}, -{"fintrx", {NULL}, 3787, "udp"}, -{"isrp-port", {NULL}, 3788, "tcp"}, -{"isrp-port", {NULL}, 3788, "udp"}, -{"remotedeploy", {NULL}, 3789, "tcp"}, -{"remotedeploy", {NULL}, 3789, "udp"}, -{"quickbooksrds", {NULL}, 3790, "tcp"}, -{"quickbooksrds", {NULL}, 3790, "udp"}, -{"tvnetworkvideo", {NULL}, 3791, "tcp"}, -{"tvnetworkvideo", {NULL}, 3791, "udp"}, -{"sitewatch", {NULL}, 3792, "tcp"}, -{"sitewatch", {NULL}, 3792, "udp"}, -{"dcsoftware", {NULL}, 3793, "tcp"}, -{"dcsoftware", {NULL}, 3793, "udp"}, -{"jaus", {NULL}, 3794, "tcp"}, -{"jaus", {NULL}, 3794, "udp"}, -{"myblast", {NULL}, 3795, "tcp"}, -{"myblast", {NULL}, 3795, "udp"}, -{"spw-dialer", {NULL}, 3796, "tcp"}, -{"spw-dialer", {NULL}, 3796, "udp"}, -{"idps", {NULL}, 3797, "tcp"}, -{"idps", {NULL}, 3797, "udp"}, -{"minilock", {NULL}, 3798, "tcp"}, -{"minilock", {NULL}, 3798, "udp"}, -{"radius-dynauth", {NULL}, 3799, "tcp"}, -{"radius-dynauth", {NULL}, 3799, "udp"}, -{"pwgpsi", {NULL}, 3800, "tcp"}, -{"pwgpsi", {NULL}, 3800, "udp"}, -{"ibm-mgr", {NULL}, 3801, "tcp"}, -{"ibm-mgr", {NULL}, 3801, "udp"}, -{"vhd", {NULL}, 3802, "tcp"}, -{"vhd", {NULL}, 3802, "udp"}, -{"soniqsync", {NULL}, 3803, "tcp"}, -{"soniqsync", {NULL}, 3803, "udp"}, -{"iqnet-port", {NULL}, 3804, "tcp"}, -{"iqnet-port", {NULL}, 3804, "udp"}, -{"tcpdataserver", {NULL}, 3805, "tcp"}, -{"tcpdataserver", {NULL}, 3805, "udp"}, -{"wsmlb", {NULL}, 3806, "tcp"}, -{"wsmlb", {NULL}, 3806, "udp"}, -{"spugna", {NULL}, 3807, "tcp"}, -{"spugna", {NULL}, 3807, "udp"}, -{"sun-as-iiops-ca", {NULL}, 3808, "tcp"}, -{"sun-as-iiops-ca", {NULL}, 3808, "udp"}, -{"apocd", {NULL}, 3809, "tcp"}, -{"apocd", {NULL}, 3809, "udp"}, -{"wlanauth", {NULL}, 3810, "tcp"}, -{"wlanauth", {NULL}, 3810, "udp"}, -{"amp", {NULL}, 3811, "tcp"}, -{"amp", {NULL}, 3811, "udp"}, -{"neto-wol-server", {NULL}, 3812, "tcp"}, -{"neto-wol-server", {NULL}, 3812, "udp"}, -{"rap-ip", {NULL}, 3813, "tcp"}, -{"rap-ip", {NULL}, 3813, "udp"}, -{"neto-dcs", {NULL}, 3814, "tcp"}, -{"neto-dcs", {NULL}, 3814, "udp"}, -{"lansurveyorxml", {NULL}, 3815, "tcp"}, -{"lansurveyorxml", {NULL}, 3815, "udp"}, -{"sunlps-http", {NULL}, 3816, "tcp"}, -{"sunlps-http", {NULL}, 3816, "udp"}, -{"tapeware", {NULL}, 3817, "tcp"}, -{"tapeware", {NULL}, 3817, "udp"}, -{"crinis-hb", {NULL}, 3818, "tcp"}, -{"crinis-hb", {NULL}, 3818, "udp"}, -{"epl-slp", {NULL}, 3819, "tcp"}, -{"epl-slp", {NULL}, 3819, "udp"}, -{"scp", {NULL}, 3820, "tcp"}, -{"scp", {NULL}, 3820, "udp"}, -{"pmcp", {NULL}, 3821, "tcp"}, -{"pmcp", {NULL}, 3821, "udp"}, -{"acp-discovery", {NULL}, 3822, "tcp"}, -{"acp-discovery", {NULL}, 3822, "udp"}, -{"acp-conduit", {NULL}, 3823, "tcp"}, -{"acp-conduit", {NULL}, 3823, "udp"}, -{"acp-policy", {NULL}, 3824, "tcp"}, -{"acp-policy", {NULL}, 3824, "udp"}, -{"ffserver", {NULL}, 3825, "tcp"}, -{"ffserver", {NULL}, 3825, "udp"}, -{"wormux", {NULL}, 3826, "tcp"}, -{"wormux", {NULL}, 3826, "udp"}, -{"netmpi", {NULL}, 3827, "tcp"}, -{"netmpi", {NULL}, 3827, "udp"}, -{"neteh", {NULL}, 3828, "tcp"}, -{"neteh", {NULL}, 3828, "udp"}, -{"neteh-ext", {NULL}, 3829, "tcp"}, -{"neteh-ext", {NULL}, 3829, "udp"}, -{"cernsysmgmtagt", {NULL}, 3830, "tcp"}, -{"cernsysmgmtagt", {NULL}, 3830, "udp"}, -{"dvapps", {NULL}, 3831, "tcp"}, -{"dvapps", {NULL}, 3831, "udp"}, -{"xxnetserver", {NULL}, 3832, "tcp"}, -{"xxnetserver", {NULL}, 3832, "udp"}, -{"aipn-auth", {NULL}, 3833, "tcp"}, -{"aipn-auth", {NULL}, 3833, "udp"}, -{"spectardata", {NULL}, 3834, "tcp"}, -{"spectardata", {NULL}, 3834, "udp"}, -{"spectardb", {NULL}, 3835, "tcp"}, -{"spectardb", {NULL}, 3835, "udp"}, -{"markem-dcp", {NULL}, 3836, "tcp"}, -{"markem-dcp", {NULL}, 3836, "udp"}, -{"mkm-discovery", {NULL}, 3837, "tcp"}, -{"mkm-discovery", {NULL}, 3837, "udp"}, -{"sos", {NULL}, 3838, "tcp"}, -{"sos", {NULL}, 3838, "udp"}, -{"amx-rms", {NULL}, 3839, "tcp"}, -{"amx-rms", {NULL}, 3839, "udp"}, -{"flirtmitmir", {NULL}, 3840, "tcp"}, -{"flirtmitmir", {NULL}, 3840, "udp"}, -{"zfirm-shiprush3", {NULL}, 3841, "tcp"}, -{"zfirm-shiprush3", {NULL}, 3841, "udp"}, -{"nhci", {NULL}, 3842, "tcp"}, -{"nhci", {NULL}, 3842, "udp"}, -{"quest-agent", {NULL}, 3843, "tcp"}, -{"quest-agent", {NULL}, 3843, "udp"}, -{"rnm", {NULL}, 3844, "tcp"}, -{"rnm", {NULL}, 3844, "udp"}, -{"v-one-spp", {NULL}, 3845, "tcp"}, -{"v-one-spp", {NULL}, 3845, "udp"}, -{"an-pcp", {NULL}, 3846, "tcp"}, -{"an-pcp", {NULL}, 3846, "udp"}, -{"msfw-control", {NULL}, 3847, "tcp"}, -{"msfw-control", {NULL}, 3847, "udp"}, -{"item", {NULL}, 3848, "tcp"}, -{"item", {NULL}, 3848, "udp"}, -{"spw-dnspreload", {NULL}, 3849, "tcp"}, -{"spw-dnspreload", {NULL}, 3849, "udp"}, -{"qtms-bootstrap", {NULL}, 3850, "tcp"}, -{"qtms-bootstrap", {NULL}, 3850, "udp"}, -{"spectraport", {NULL}, 3851, "tcp"}, -{"spectraport", {NULL}, 3851, "udp"}, -{"sse-app-config", {NULL}, 3852, "tcp"}, -{"sse-app-config", {NULL}, 3852, "udp"}, -{"sscan", {NULL}, 3853, "tcp"}, -{"sscan", {NULL}, 3853, "udp"}, -{"stryker-com", {NULL}, 3854, "tcp"}, -{"stryker-com", {NULL}, 3854, "udp"}, -{"opentrac", {NULL}, 3855, "tcp"}, -{"opentrac", {NULL}, 3855, "udp"}, -{"informer", {NULL}, 3856, "tcp"}, -{"informer", {NULL}, 3856, "udp"}, -{"trap-port", {NULL}, 3857, "tcp"}, -{"trap-port", {NULL}, 3857, "udp"}, -{"trap-port-mom", {NULL}, 3858, "tcp"}, -{"trap-port-mom", {NULL}, 3858, "udp"}, -{"nav-port", {NULL}, 3859, "tcp"}, -{"nav-port", {NULL}, 3859, "udp"}, -{"sasp", {NULL}, 3860, "tcp"}, -{"sasp", {NULL}, 3860, "udp"}, -{"winshadow-hd", {NULL}, 3861, "tcp"}, -{"winshadow-hd", {NULL}, 3861, "udp"}, -{"giga-pocket", {NULL}, 3862, "tcp"}, -{"giga-pocket", {NULL}, 3862, "udp"}, -{"asap-tcp", {NULL}, 3863, "tcp"}, -{"asap-udp", {NULL}, 3863, "udp"}, -{"asap-sctp", {NULL}, 3863, "sctp"}, -{"asap-tcp-tls", {NULL}, 3864, "tcp"}, -{"asap-sctp-tls", {NULL}, 3864, "sctp"}, -{"xpl", {NULL}, 3865, "tcp"}, -{"xpl", {NULL}, 3865, "udp"}, -{"dzdaemon", {NULL}, 3866, "tcp"}, -{"dzdaemon", {NULL}, 3866, "udp"}, -{"dzoglserver", {NULL}, 3867, "tcp"}, -{"dzoglserver", {NULL}, 3867, "udp"}, -{"diameter", {NULL}, 3868, "tcp"}, -{"diameter", {NULL}, 3868, "sctp"}, -{"ovsam-mgmt", {NULL}, 3869, "tcp"}, -{"ovsam-mgmt", {NULL}, 3869, "udp"}, -{"ovsam-d-agent", {NULL}, 3870, "tcp"}, -{"ovsam-d-agent", {NULL}, 3870, "udp"}, -{"avocent-adsap", {NULL}, 3871, "tcp"}, -{"avocent-adsap", {NULL}, 3871, "udp"}, -{"oem-agent", {NULL}, 3872, "tcp"}, -{"oem-agent", {NULL}, 3872, "udp"}, -{"fagordnc", {NULL}, 3873, "tcp"}, -{"fagordnc", {NULL}, 3873, "udp"}, -{"sixxsconfig", {NULL}, 3874, "tcp"}, -{"sixxsconfig", {NULL}, 3874, "udp"}, -{"pnbscada", {NULL}, 3875, "tcp"}, -{"pnbscada", {NULL}, 3875, "udp"}, -{"dl_agent", {NULL}, 3876, "tcp"}, -{"dl_agent", {NULL}, 3876, "udp"}, -{"xmpcr-interface", {NULL}, 3877, "tcp"}, -{"xmpcr-interface", {NULL}, 3877, "udp"}, -{"fotogcad", {NULL}, 3878, "tcp"}, -{"fotogcad", {NULL}, 3878, "udp"}, -{"appss-lm", {NULL}, 3879, "tcp"}, -{"appss-lm", {NULL}, 3879, "udp"}, -{"igrs", {NULL}, 3880, "tcp"}, -{"igrs", {NULL}, 3880, "udp"}, -{"idac", {NULL}, 3881, "tcp"}, -{"idac", {NULL}, 3881, "udp"}, -{"msdts1", {NULL}, 3882, "tcp"}, -{"msdts1", {NULL}, 3882, "udp"}, -{"vrpn", {NULL}, 3883, "tcp"}, -{"vrpn", {NULL}, 3883, "udp"}, -{"softrack-meter", {NULL}, 3884, "tcp"}, -{"softrack-meter", {NULL}, 3884, "udp"}, -{"topflow-ssl", {NULL}, 3885, "tcp"}, -{"topflow-ssl", {NULL}, 3885, "udp"}, -{"nei-management", {NULL}, 3886, "tcp"}, -{"nei-management", {NULL}, 3886, "udp"}, -{"ciphire-data", {NULL}, 3887, "tcp"}, -{"ciphire-data", {NULL}, 3887, "udp"}, -{"ciphire-serv", {NULL}, 3888, "tcp"}, -{"ciphire-serv", {NULL}, 3888, "udp"}, -{"dandv-tester", {NULL}, 3889, "tcp"}, -{"dandv-tester", {NULL}, 3889, "udp"}, -{"ndsconnect", {NULL}, 3890, "tcp"}, -{"ndsconnect", {NULL}, 3890, "udp"}, -{"rtc-pm-port", {NULL}, 3891, "tcp"}, -{"rtc-pm-port", {NULL}, 3891, "udp"}, -{"pcc-image-port", {NULL}, 3892, "tcp"}, -{"pcc-image-port", {NULL}, 3892, "udp"}, -{"cgi-starapi", {NULL}, 3893, "tcp"}, -{"cgi-starapi", {NULL}, 3893, "udp"}, -{"syam-agent", {NULL}, 3894, "tcp"}, -{"syam-agent", {NULL}, 3894, "udp"}, -{"syam-smc", {NULL}, 3895, "tcp"}, -{"syam-smc", {NULL}, 3895, "udp"}, -{"sdo-tls", {NULL}, 3896, "tcp"}, -{"sdo-tls", {NULL}, 3896, "udp"}, -{"sdo-ssh", {NULL}, 3897, "tcp"}, -{"sdo-ssh", {NULL}, 3897, "udp"}, -{"senip", {NULL}, 3898, "tcp"}, -{"senip", {NULL}, 3898, "udp"}, -{"itv-control", {NULL}, 3899, "tcp"}, -{"itv-control", {NULL}, 3899, "udp"}, -{"udt_os", {NULL}, 3900, "tcp"}, -{"udt_os", {NULL}, 3900, "udp"}, -{"nimsh", {NULL}, 3901, "tcp"}, -{"nimsh", {NULL}, 3901, "udp"}, -{"nimaux", {NULL}, 3902, "tcp"}, -{"nimaux", {NULL}, 3902, "udp"}, -{"charsetmgr", {NULL}, 3903, "tcp"}, -{"charsetmgr", {NULL}, 3903, "udp"}, -{"omnilink-port", {NULL}, 3904, "tcp"}, -{"omnilink-port", {NULL}, 3904, "udp"}, -{"mupdate", {NULL}, 3905, "tcp"}, -{"mupdate", {NULL}, 3905, "udp"}, -{"topovista-data", {NULL}, 3906, "tcp"}, -{"topovista-data", {NULL}, 3906, "udp"}, -{"imoguia-port", {NULL}, 3907, "tcp"}, -{"imoguia-port", {NULL}, 3907, "udp"}, -{"hppronetman", {NULL}, 3908, "tcp"}, -{"hppronetman", {NULL}, 3908, "udp"}, -{"surfcontrolcpa", {NULL}, 3909, "tcp"}, -{"surfcontrolcpa", {NULL}, 3909, "udp"}, -{"prnrequest", {NULL}, 3910, "tcp"}, -{"prnrequest", {NULL}, 3910, "udp"}, -{"prnstatus", {NULL}, 3911, "tcp"}, -{"prnstatus", {NULL}, 3911, "udp"}, -{"gbmt-stars", {NULL}, 3912, "tcp"}, -{"gbmt-stars", {NULL}, 3912, "udp"}, -{"listcrt-port", {NULL}, 3913, "tcp"}, -{"listcrt-port", {NULL}, 3913, "udp"}, -{"listcrt-port-2", {NULL}, 3914, "tcp"}, -{"listcrt-port-2", {NULL}, 3914, "udp"}, -{"agcat", {NULL}, 3915, "tcp"}, -{"agcat", {NULL}, 3915, "udp"}, -{"wysdmc", {NULL}, 3916, "tcp"}, -{"wysdmc", {NULL}, 3916, "udp"}, -{"aftmux", {NULL}, 3917, "tcp"}, -{"aftmux", {NULL}, 3917, "udp"}, -{"pktcablemmcops", {NULL}, 3918, "tcp"}, -{"pktcablemmcops", {NULL}, 3918, "udp"}, -{"hyperip", {NULL}, 3919, "tcp"}, -{"hyperip", {NULL}, 3919, "udp"}, -{"exasoftport1", {NULL}, 3920, "tcp"}, -{"exasoftport1", {NULL}, 3920, "udp"}, -{"herodotus-net", {NULL}, 3921, "tcp"}, -{"herodotus-net", {NULL}, 3921, "udp"}, -{"sor-update", {NULL}, 3922, "tcp"}, -{"sor-update", {NULL}, 3922, "udp"}, -{"symb-sb-port", {NULL}, 3923, "tcp"}, -{"symb-sb-port", {NULL}, 3923, "udp"}, -{"mpl-gprs-port", {NULL}, 3924, "tcp"}, -{"mpl-gprs-port", {NULL}, 3924, "udp"}, -{"zmp", {NULL}, 3925, "tcp"}, -{"zmp", {NULL}, 3925, "udp"}, -{"winport", {NULL}, 3926, "tcp"}, -{"winport", {NULL}, 3926, "udp"}, -{"natdataservice", {NULL}, 3927, "tcp"}, -{"natdataservice", {NULL}, 3927, "udp"}, -{"netboot-pxe", {NULL}, 3928, "tcp"}, -{"netboot-pxe", {NULL}, 3928, "udp"}, -{"smauth-port", {NULL}, 3929, "tcp"}, -{"smauth-port", {NULL}, 3929, "udp"}, -{"syam-webserver", {NULL}, 3930, "tcp"}, -{"syam-webserver", {NULL}, 3930, "udp"}, -{"msr-plugin-port", {NULL}, 3931, "tcp"}, -{"msr-plugin-port", {NULL}, 3931, "udp"}, -{"dyn-site", {NULL}, 3932, "tcp"}, -{"dyn-site", {NULL}, 3932, "udp"}, -{"plbserve-port", {NULL}, 3933, "tcp"}, -{"plbserve-port", {NULL}, 3933, "udp"}, -{"sunfm-port", {NULL}, 3934, "tcp"}, -{"sunfm-port", {NULL}, 3934, "udp"}, -{"sdp-portmapper", {NULL}, 3935, "tcp"}, -{"sdp-portmapper", {NULL}, 3935, "udp"}, -{"mailprox", {NULL}, 3936, "tcp"}, -{"mailprox", {NULL}, 3936, "udp"}, -{"dvbservdsc", {NULL}, 3937, "tcp"}, -{"dvbservdsc", {NULL}, 3937, "udp"}, -{"dbcontrol_agent", {NULL}, 3938, "tcp"}, -{"dbcontrol_agent", {NULL}, 3938, "udp"}, -{"aamp", {NULL}, 3939, "tcp"}, -{"aamp", {NULL}, 3939, "udp"}, -{"xecp-node", {NULL}, 3940, "tcp"}, -{"xecp-node", {NULL}, 3940, "udp"}, -{"homeportal-web", {NULL}, 3941, "tcp"}, -{"homeportal-web", {NULL}, 3941, "udp"}, -{"srdp", {NULL}, 3942, "tcp"}, -{"srdp", {NULL}, 3942, "udp"}, -{"tig", {NULL}, 3943, "tcp"}, -{"tig", {NULL}, 3943, "udp"}, -{"sops", {NULL}, 3944, "tcp"}, -{"sops", {NULL}, 3944, "udp"}, -{"emcads", {NULL}, 3945, "tcp"}, -{"emcads", {NULL}, 3945, "udp"}, -{"backupedge", {NULL}, 3946, "tcp"}, -{"backupedge", {NULL}, 3946, "udp"}, -{"ccp", {NULL}, 3947, "tcp"}, -{"ccp", {NULL}, 3947, "udp"}, -{"apdap", {NULL}, 3948, "tcp"}, -{"apdap", {NULL}, 3948, "udp"}, -{"drip", {NULL}, 3949, "tcp"}, -{"drip", {NULL}, 3949, "udp"}, -{"namemunge", {NULL}, 3950, "tcp"}, -{"namemunge", {NULL}, 3950, "udp"}, -{"pwgippfax", {NULL}, 3951, "tcp"}, -{"pwgippfax", {NULL}, 3951, "udp"}, -{"i3-sessionmgr", {NULL}, 3952, "tcp"}, -{"i3-sessionmgr", {NULL}, 3952, "udp"}, -{"xmlink-connect", {NULL}, 3953, "tcp"}, -{"xmlink-connect", {NULL}, 3953, "udp"}, -{"adrep", {NULL}, 3954, "tcp"}, -{"adrep", {NULL}, 3954, "udp"}, -{"p2pcommunity", {NULL}, 3955, "tcp"}, -{"p2pcommunity", {NULL}, 3955, "udp"}, -{"gvcp", {NULL}, 3956, "tcp"}, -{"gvcp", {NULL}, 3956, "udp"}, -{"mqe-broker", {NULL}, 3957, "tcp"}, -{"mqe-broker", {NULL}, 3957, "udp"}, -{"mqe-agent", {NULL}, 3958, "tcp"}, -{"mqe-agent", {NULL}, 3958, "udp"}, -{"treehopper", {NULL}, 3959, "tcp"}, -{"treehopper", {NULL}, 3959, "udp"}, -{"bess", {NULL}, 3960, "tcp"}, -{"bess", {NULL}, 3960, "udp"}, -{"proaxess", {NULL}, 3961, "tcp"}, -{"proaxess", {NULL}, 3961, "udp"}, -{"sbi-agent", {NULL}, 3962, "tcp"}, -{"sbi-agent", {NULL}, 3962, "udp"}, -{"thrp", {NULL}, 3963, "tcp"}, -{"thrp", {NULL}, 3963, "udp"}, -{"sasggprs", {NULL}, 3964, "tcp"}, -{"sasggprs", {NULL}, 3964, "udp"}, -{"ati-ip-to-ncpe", {NULL}, 3965, "tcp"}, -{"ati-ip-to-ncpe", {NULL}, 3965, "udp"}, -{"bflckmgr", {NULL}, 3966, "tcp"}, -{"bflckmgr", {NULL}, 3966, "udp"}, -{"ppsms", {NULL}, 3967, "tcp"}, -{"ppsms", {NULL}, 3967, "udp"}, -{"ianywhere-dbns", {NULL}, 3968, "tcp"}, -{"ianywhere-dbns", {NULL}, 3968, "udp"}, -{"landmarks", {NULL}, 3969, "tcp"}, -{"landmarks", {NULL}, 3969, "udp"}, -{"lanrevagent", {NULL}, 3970, "tcp"}, -{"lanrevagent", {NULL}, 3970, "udp"}, -{"lanrevserver", {NULL}, 3971, "tcp"}, -{"lanrevserver", {NULL}, 3971, "udp"}, -{"iconp", {NULL}, 3972, "tcp"}, -{"iconp", {NULL}, 3972, "udp"}, -{"progistics", {NULL}, 3973, "tcp"}, -{"progistics", {NULL}, 3973, "udp"}, -{"citysearch", {NULL}, 3974, "tcp"}, -{"citysearch", {NULL}, 3974, "udp"}, -{"airshot", {NULL}, 3975, "tcp"}, -{"airshot", {NULL}, 3975, "udp"}, -{"opswagent", {NULL}, 3976, "tcp"}, -{"opswagent", {NULL}, 3976, "udp"}, -{"opswmanager", {NULL}, 3977, "tcp"}, -{"opswmanager", {NULL}, 3977, "udp"}, -{"secure-cfg-svr", {NULL}, 3978, "tcp"}, -{"secure-cfg-svr", {NULL}, 3978, "udp"}, -{"smwan", {NULL}, 3979, "tcp"}, -{"smwan", {NULL}, 3979, "udp"}, -{"acms", {NULL}, 3980, "tcp"}, -{"acms", {NULL}, 3980, "udp"}, -{"starfish", {NULL}, 3981, "tcp"}, -{"starfish", {NULL}, 3981, "udp"}, -{"eis", {NULL}, 3982, "tcp"}, -{"eis", {NULL}, 3982, "udp"}, -{"eisp", {NULL}, 3983, "tcp"}, -{"eisp", {NULL}, 3983, "udp"}, -{"mapper-nodemgr", {NULL}, 3984, "tcp"}, -{"mapper-nodemgr", {NULL}, 3984, "udp"}, -{"mapper-mapethd", {NULL}, 3985, "tcp"}, -{"mapper-mapethd", {NULL}, 3985, "udp"}, -{"mapper-ws_ethd", {NULL}, 3986, "tcp"}, -{"mapper-ws_ethd", {NULL}, 3986, "udp"}, -{"centerline", {NULL}, 3987, "tcp"}, -{"centerline", {NULL}, 3987, "udp"}, -{"dcs-config", {NULL}, 3988, "tcp"}, -{"dcs-config", {NULL}, 3988, "udp"}, -{"bv-queryengine", {NULL}, 3989, "tcp"}, -{"bv-queryengine", {NULL}, 3989, "udp"}, -{"bv-is", {NULL}, 3990, "tcp"}, -{"bv-is", {NULL}, 3990, "udp"}, -{"bv-smcsrv", {NULL}, 3991, "tcp"}, -{"bv-smcsrv", {NULL}, 3991, "udp"}, -{"bv-ds", {NULL}, 3992, "tcp"}, -{"bv-ds", {NULL}, 3992, "udp"}, -{"bv-agent", {NULL}, 3993, "tcp"}, -{"bv-agent", {NULL}, 3993, "udp"}, -{"iss-mgmt-ssl", {NULL}, 3995, "tcp"}, -{"iss-mgmt-ssl", {NULL}, 3995, "udp"}, -{"abcsoftware", {NULL}, 3996, "tcp"}, -{"abcsoftware", {NULL}, 3996, "udp"}, -{"agentsease-db", {NULL}, 3997, "tcp"}, -{"agentsease-db", {NULL}, 3997, "udp"}, -{"dnx", {NULL}, 3998, "tcp"}, -{"dnx", {NULL}, 3998, "udp"}, -{"nvcnet", {NULL}, 3999, "tcp"}, -{"nvcnet", {NULL}, 3999, "udp"}, -{"terabase", {NULL}, 4000, "tcp"}, -{"terabase", {NULL}, 4000, "udp"}, -{"newoak", {NULL}, 4001, "tcp"}, -{"newoak", {NULL}, 4001, "udp"}, -{"pxc-spvr-ft", {NULL}, 4002, "tcp"}, -{"pxc-spvr-ft", {NULL}, 4002, "udp"}, -{"pxc-splr-ft", {NULL}, 4003, "tcp"}, -{"pxc-splr-ft", {NULL}, 4003, "udp"}, -{"pxc-roid", {NULL}, 4004, "tcp"}, -{"pxc-roid", {NULL}, 4004, "udp"}, -{"pxc-pin", {NULL}, 4005, "tcp"}, -{"pxc-pin", {NULL}, 4005, "udp"}, -{"pxc-spvr", {NULL}, 4006, "tcp"}, -{"pxc-spvr", {NULL}, 4006, "udp"}, -{"pxc-splr", {NULL}, 4007, "tcp"}, -{"pxc-splr", {NULL}, 4007, "udp"}, -{"netcheque", {NULL}, 4008, "tcp"}, -{"netcheque", {NULL}, 4008, "udp"}, -{"chimera-hwm", {NULL}, 4009, "tcp"}, -{"chimera-hwm", {NULL}, 4009, "udp"}, -{"samsung-unidex", {NULL}, 4010, "tcp"}, -{"samsung-unidex", {NULL}, 4010, "udp"}, -{"altserviceboot", {NULL}, 4011, "tcp"}, -{"altserviceboot", {NULL}, 4011, "udp"}, -{"pda-gate", {NULL}, 4012, "tcp"}, -{"pda-gate", {NULL}, 4012, "udp"}, -{"acl-manager", {NULL}, 4013, "tcp"}, -{"acl-manager", {NULL}, 4013, "udp"}, -{"taiclock", {NULL}, 4014, "tcp"}, -{"taiclock", {NULL}, 4014, "udp"}, -{"talarian-mcast1", {NULL}, 4015, "tcp"}, -{"talarian-mcast1", {NULL}, 4015, "udp"}, -{"talarian-mcast2", {NULL}, 4016, "tcp"}, -{"talarian-mcast2", {NULL}, 4016, "udp"}, -{"talarian-mcast3", {NULL}, 4017, "tcp"}, -{"talarian-mcast3", {NULL}, 4017, "udp"}, -{"talarian-mcast4", {NULL}, 4018, "tcp"}, -{"talarian-mcast4", {NULL}, 4018, "udp"}, -{"talarian-mcast5", {NULL}, 4019, "tcp"}, -{"talarian-mcast5", {NULL}, 4019, "udp"}, -{"trap", {NULL}, 4020, "tcp"}, -{"trap", {NULL}, 4020, "udp"}, -{"nexus-portal", {NULL}, 4021, "tcp"}, -{"nexus-portal", {NULL}, 4021, "udp"}, -{"dnox", {NULL}, 4022, "tcp"}, -{"dnox", {NULL}, 4022, "udp"}, -{"esnm-zoning", {NULL}, 4023, "tcp"}, -{"esnm-zoning", {NULL}, 4023, "udp"}, -{"tnp1-port", {NULL}, 4024, "tcp"}, -{"tnp1-port", {NULL}, 4024, "udp"}, -{"partimage", {NULL}, 4025, "tcp"}, -{"partimage", {NULL}, 4025, "udp"}, -{"as-debug", {NULL}, 4026, "tcp"}, -{"as-debug", {NULL}, 4026, "udp"}, -{"bxp", {NULL}, 4027, "tcp"}, -{"bxp", {NULL}, 4027, "udp"}, -{"dtserver-port", {NULL}, 4028, "tcp"}, -{"dtserver-port", {NULL}, 4028, "udp"}, -{"ip-qsig", {NULL}, 4029, "tcp"}, -{"ip-qsig", {NULL}, 4029, "udp"}, -{"jdmn-port", {NULL}, 4030, "tcp"}, -{"jdmn-port", {NULL}, 4030, "udp"}, -{"suucp", {NULL}, 4031, "tcp"}, -{"suucp", {NULL}, 4031, "udp"}, -{"vrts-auth-port", {NULL}, 4032, "tcp"}, -{"vrts-auth-port", {NULL}, 4032, "udp"}, -{"sanavigator", {NULL}, 4033, "tcp"}, -{"sanavigator", {NULL}, 4033, "udp"}, -{"ubxd", {NULL}, 4034, "tcp"}, -{"ubxd", {NULL}, 4034, "udp"}, -{"wap-push-http", {NULL}, 4035, "tcp"}, -{"wap-push-http", {NULL}, 4035, "udp"}, -{"wap-push-https", {NULL}, 4036, "tcp"}, -{"wap-push-https", {NULL}, 4036, "udp"}, -{"ravehd", {NULL}, 4037, "tcp"}, -{"ravehd", {NULL}, 4037, "udp"}, -{"fazzt-ptp", {NULL}, 4038, "tcp"}, -{"fazzt-ptp", {NULL}, 4038, "udp"}, -{"fazzt-admin", {NULL}, 4039, "tcp"}, -{"fazzt-admin", {NULL}, 4039, "udp"}, -{"yo-main", {NULL}, 4040, "tcp"}, -{"yo-main", {NULL}, 4040, "udp"}, -{"houston", {NULL}, 4041, "tcp"}, -{"houston", {NULL}, 4041, "udp"}, -{"ldxp", {NULL}, 4042, "tcp"}, -{"ldxp", {NULL}, 4042, "udp"}, -{"nirp", {NULL}, 4043, "tcp"}, -{"nirp", {NULL}, 4043, "udp"}, -{"ltp", {NULL}, 4044, "tcp"}, -{"ltp", {NULL}, 4044, "udp"}, -{"npp", {NULL}, 4045, "tcp"}, -{"npp", {NULL}, 4045, "udp"}, -{"acp-proto", {NULL}, 4046, "tcp"}, -{"acp-proto", {NULL}, 4046, "udp"}, -{"ctp-state", {NULL}, 4047, "tcp"}, -{"ctp-state", {NULL}, 4047, "udp"}, -{"wafs", {NULL}, 4049, "tcp"}, -{"wafs", {NULL}, 4049, "udp"}, -{"cisco-wafs", {NULL}, 4050, "tcp"}, -{"cisco-wafs", {NULL}, 4050, "udp"}, -{"cppdp", {NULL}, 4051, "tcp"}, -{"cppdp", {NULL}, 4051, "udp"}, -{"interact", {NULL}, 4052, "tcp"}, -{"interact", {NULL}, 4052, "udp"}, -{"ccu-comm-1", {NULL}, 4053, "tcp"}, -{"ccu-comm-1", {NULL}, 4053, "udp"}, -{"ccu-comm-2", {NULL}, 4054, "tcp"}, -{"ccu-comm-2", {NULL}, 4054, "udp"}, -{"ccu-comm-3", {NULL}, 4055, "tcp"}, -{"ccu-comm-3", {NULL}, 4055, "udp"}, -{"lms", {NULL}, 4056, "tcp"}, -{"lms", {NULL}, 4056, "udp"}, -{"wfm", {NULL}, 4057, "tcp"}, -{"wfm", {NULL}, 4057, "udp"}, -{"kingfisher", {NULL}, 4058, "tcp"}, -{"kingfisher", {NULL}, 4058, "udp"}, -{"dlms-cosem", {NULL}, 4059, "tcp"}, -{"dlms-cosem", {NULL}, 4059, "udp"}, -{"dsmeter_iatc", {NULL}, 4060, "tcp"}, -{"dsmeter_iatc", {NULL}, 4060, "udp"}, -{"ice-location", {NULL}, 4061, "tcp"}, -{"ice-location", {NULL}, 4061, "udp"}, -{"ice-slocation", {NULL}, 4062, "tcp"}, -{"ice-slocation", {NULL}, 4062, "udp"}, -{"ice-router", {NULL}, 4063, "tcp"}, -{"ice-router", {NULL}, 4063, "udp"}, -{"ice-srouter", {NULL}, 4064, "tcp"}, -{"ice-srouter", {NULL}, 4064, "udp"}, -{"avanti_cdp", {NULL}, 4065, "tcp"}, -{"avanti_cdp", {NULL}, 4065, "udp"}, -{"pmas", {NULL}, 4066, "tcp"}, -{"pmas", {NULL}, 4066, "udp"}, -{"idp", {NULL}, 4067, "tcp"}, -{"idp", {NULL}, 4067, "udp"}, -{"ipfltbcst", {NULL}, 4068, "tcp"}, -{"ipfltbcst", {NULL}, 4068, "udp"}, -{"minger", {NULL}, 4069, "tcp"}, -{"minger", {NULL}, 4069, "udp"}, -{"tripe", {NULL}, 4070, "tcp"}, -{"tripe", {NULL}, 4070, "udp"}, -{"aibkup", {NULL}, 4071, "tcp"}, -{"aibkup", {NULL}, 4071, "udp"}, -{"zieto-sock", {NULL}, 4072, "tcp"}, -{"zieto-sock", {NULL}, 4072, "udp"}, -{"iRAPP", {NULL}, 4073, "tcp"}, -{"iRAPP", {NULL}, 4073, "udp"}, -{"cequint-cityid", {NULL}, 4074, "tcp"}, -{"cequint-cityid", {NULL}, 4074, "udp"}, -{"perimlan", {NULL}, 4075, "tcp"}, -{"perimlan", {NULL}, 4075, "udp"}, -{"seraph", {NULL}, 4076, "tcp"}, -{"seraph", {NULL}, 4076, "udp"}, -{"ascomalarm", {NULL}, 4077, "udp"}, -{"cssp", {NULL}, 4078, "tcp"}, -{"santools", {NULL}, 4079, "tcp"}, -{"santools", {NULL}, 4079, "udp"}, -{"lorica-in", {NULL}, 4080, "tcp"}, -{"lorica-in", {NULL}, 4080, "udp"}, -{"lorica-in-sec", {NULL}, 4081, "tcp"}, -{"lorica-in-sec", {NULL}, 4081, "udp"}, -{"lorica-out", {NULL}, 4082, "tcp"}, -{"lorica-out", {NULL}, 4082, "udp"}, -{"lorica-out-sec", {NULL}, 4083, "tcp"}, -{"lorica-out-sec", {NULL}, 4083, "udp"}, -{"fortisphere-vm", {NULL}, 4084, "udp"}, -{"ezmessagesrv", {NULL}, 4085, "tcp"}, -{"ftsync", {NULL}, 4086, "udp"}, -{"applusservice", {NULL}, 4087, "tcp"}, -{"npsp", {NULL}, 4088, "tcp"}, -{"opencore", {NULL}, 4089, "tcp"}, -{"opencore", {NULL}, 4089, "udp"}, -{"omasgport", {NULL}, 4090, "tcp"}, -{"omasgport", {NULL}, 4090, "udp"}, -{"ewinstaller", {NULL}, 4091, "tcp"}, -{"ewinstaller", {NULL}, 4091, "udp"}, -{"ewdgs", {NULL}, 4092, "tcp"}, -{"ewdgs", {NULL}, 4092, "udp"}, -{"pvxpluscs", {NULL}, 4093, "tcp"}, -{"pvxpluscs", {NULL}, 4093, "udp"}, -{"sysrqd", {NULL}, 4094, "tcp"}, -{"sysrqd", {NULL}, 4094, "udp"}, -{"xtgui", {NULL}, 4095, "tcp"}, -{"xtgui", {NULL}, 4095, "udp"}, -{"bre", {NULL}, 4096, "tcp"}, -{"bre", {NULL}, 4096, "udp"}, -{"patrolview", {NULL}, 4097, "tcp"}, -{"patrolview", {NULL}, 4097, "udp"}, -{"drmsfsd", {NULL}, 4098, "tcp"}, -{"drmsfsd", {NULL}, 4098, "udp"}, -{"dpcp", {NULL}, 4099, "tcp"}, -{"dpcp", {NULL}, 4099, "udp"}, -{"igo-incognito", {NULL}, 4100, "tcp"}, -{"igo-incognito", {NULL}, 4100, "udp"}, -{"brlp-0", {NULL}, 4101, "tcp"}, -{"brlp-0", {NULL}, 4101, "udp"}, -{"brlp-1", {NULL}, 4102, "tcp"}, -{"brlp-1", {NULL}, 4102, "udp"}, -{"brlp-2", {NULL}, 4103, "tcp"}, -{"brlp-2", {NULL}, 4103, "udp"}, -{"brlp-3", {NULL}, 4104, "tcp"}, -{"brlp-3", {NULL}, 4104, "udp"}, -{"shofarplayer", {NULL}, 4105, "tcp"}, -{"shofarplayer", {NULL}, 4105, "udp"}, -{"synchronite", {NULL}, 4106, "tcp"}, -{"synchronite", {NULL}, 4106, "udp"}, -{"j-ac", {NULL}, 4107, "tcp"}, -{"j-ac", {NULL}, 4107, "udp"}, -{"accel", {NULL}, 4108, "tcp"}, -{"accel", {NULL}, 4108, "udp"}, -{"izm", {NULL}, 4109, "tcp"}, -{"izm", {NULL}, 4109, "udp"}, -{"g2tag", {NULL}, 4110, "tcp"}, -{"g2tag", {NULL}, 4110, "udp"}, -{"xgrid", {NULL}, 4111, "tcp"}, -{"xgrid", {NULL}, 4111, "udp"}, -{"apple-vpns-rp", {NULL}, 4112, "tcp"}, -{"apple-vpns-rp", {NULL}, 4112, "udp"}, -{"aipn-reg", {NULL}, 4113, "tcp"}, -{"aipn-reg", {NULL}, 4113, "udp"}, -{"jomamqmonitor", {NULL}, 4114, "tcp"}, -{"jomamqmonitor", {NULL}, 4114, "udp"}, -{"cds", {NULL}, 4115, "tcp"}, -{"cds", {NULL}, 4115, "udp"}, -{"smartcard-tls", {NULL}, 4116, "tcp"}, -{"smartcard-tls", {NULL}, 4116, "udp"}, -{"hillrserv", {NULL}, 4117, "tcp"}, -{"hillrserv", {NULL}, 4117, "udp"}, -{"netscript", {NULL}, 4118, "tcp"}, -{"netscript", {NULL}, 4118, "udp"}, -{"assuria-slm", {NULL}, 4119, "tcp"}, -{"assuria-slm", {NULL}, 4119, "udp"}, -{"e-builder", {NULL}, 4121, "tcp"}, -{"e-builder", {NULL}, 4121, "udp"}, -{"fprams", {NULL}, 4122, "tcp"}, -{"fprams", {NULL}, 4122, "udp"}, -{"z-wave", {NULL}, 4123, "tcp"}, -{"z-wave", {NULL}, 4123, "udp"}, -{"tigv2", {NULL}, 4124, "tcp"}, -{"tigv2", {NULL}, 4124, "udp"}, -{"opsview-envoy", {NULL}, 4125, "tcp"}, -{"opsview-envoy", {NULL}, 4125, "udp"}, -{"ddrepl", {NULL}, 4126, "tcp"}, -{"ddrepl", {NULL}, 4126, "udp"}, -{"unikeypro", {NULL}, 4127, "tcp"}, -{"unikeypro", {NULL}, 4127, "udp"}, -{"nufw", {NULL}, 4128, "tcp"}, -{"nufw", {NULL}, 4128, "udp"}, -{"nuauth", {NULL}, 4129, "tcp"}, -{"nuauth", {NULL}, 4129, "udp"}, -{"fronet", {NULL}, 4130, "tcp"}, -{"fronet", {NULL}, 4130, "udp"}, -{"stars", {NULL}, 4131, "tcp"}, -{"stars", {NULL}, 4131, "udp"}, -{"nuts_dem", {NULL}, 4132, "tcp"}, -{"nuts_dem", {NULL}, 4132, "udp"}, -{"nuts_bootp", {NULL}, 4133, "tcp"}, -{"nuts_bootp", {NULL}, 4133, "udp"}, -{"nifty-hmi", {NULL}, 4134, "tcp"}, -{"nifty-hmi", {NULL}, 4134, "udp"}, -{"cl-db-attach", {NULL}, 4135, "tcp"}, -{"cl-db-attach", {NULL}, 4135, "udp"}, -{"cl-db-request", {NULL}, 4136, "tcp"}, -{"cl-db-request", {NULL}, 4136, "udp"}, -{"cl-db-remote", {NULL}, 4137, "tcp"}, -{"cl-db-remote", {NULL}, 4137, "udp"}, -{"nettest", {NULL}, 4138, "tcp"}, -{"nettest", {NULL}, 4138, "udp"}, -{"thrtx", {NULL}, 4139, "tcp"}, -{"thrtx", {NULL}, 4139, "udp"}, -{"cedros_fds", {NULL}, 4140, "tcp"}, -{"cedros_fds", {NULL}, 4140, "udp"}, -{"oirtgsvc", {NULL}, 4141, "tcp"}, -{"oirtgsvc", {NULL}, 4141, "udp"}, -{"oidocsvc", {NULL}, 4142, "tcp"}, -{"oidocsvc", {NULL}, 4142, "udp"}, -{"oidsr", {NULL}, 4143, "tcp"}, -{"oidsr", {NULL}, 4143, "udp"}, -{"vvr-control", {NULL}, 4145, "tcp"}, -{"vvr-control", {NULL}, 4145, "udp"}, -{"tgcconnect", {NULL}, 4146, "tcp"}, -{"tgcconnect", {NULL}, 4146, "udp"}, -{"vrxpservman", {NULL}, 4147, "tcp"}, -{"vrxpservman", {NULL}, 4147, "udp"}, -{"hhb-handheld", {NULL}, 4148, "tcp"}, -{"hhb-handheld", {NULL}, 4148, "udp"}, -{"agslb", {NULL}, 4149, "tcp"}, -{"agslb", {NULL}, 4149, "udp"}, -{"PowerAlert-nsa", {NULL}, 4150, "tcp"}, -{"PowerAlert-nsa", {NULL}, 4150, "udp"}, -{"menandmice_noh", {NULL}, 4151, "tcp"}, -{"menandmice_noh", {NULL}, 4151, "udp"}, -{"idig_mux", {NULL}, 4152, "tcp"}, -{"idig_mux", {NULL}, 4152, "udp"}, -{"mbl-battd", {NULL}, 4153, "tcp"}, -{"mbl-battd", {NULL}, 4153, "udp"}, -{"atlinks", {NULL}, 4154, "tcp"}, -{"atlinks", {NULL}, 4154, "udp"}, -{"bzr", {NULL}, 4155, "tcp"}, -{"bzr", {NULL}, 4155, "udp"}, -{"stat-results", {NULL}, 4156, "tcp"}, -{"stat-results", {NULL}, 4156, "udp"}, -{"stat-scanner", {NULL}, 4157, "tcp"}, -{"stat-scanner", {NULL}, 4157, "udp"}, -{"stat-cc", {NULL}, 4158, "tcp"}, -{"stat-cc", {NULL}, 4158, "udp"}, -{"nss", {NULL}, 4159, "tcp"}, -{"nss", {NULL}, 4159, "udp"}, -{"jini-discovery", {NULL}, 4160, "tcp"}, -{"jini-discovery", {NULL}, 4160, "udp"}, -{"omscontact", {NULL}, 4161, "tcp"}, -{"omscontact", {NULL}, 4161, "udp"}, -{"omstopology", {NULL}, 4162, "tcp"}, -{"omstopology", {NULL}, 4162, "udp"}, -{"silverpeakpeer", {NULL}, 4163, "tcp"}, -{"silverpeakpeer", {NULL}, 4163, "udp"}, -{"silverpeakcomm", {NULL}, 4164, "tcp"}, -{"silverpeakcomm", {NULL}, 4164, "udp"}, -{"altcp", {NULL}, 4165, "tcp"}, -{"altcp", {NULL}, 4165, "udp"}, -{"joost", {NULL}, 4166, "tcp"}, -{"joost", {NULL}, 4166, "udp"}, -{"ddgn", {NULL}, 4167, "tcp"}, -{"ddgn", {NULL}, 4167, "udp"}, -{"pslicser", {NULL}, 4168, "tcp"}, -{"pslicser", {NULL}, 4168, "udp"}, -{"iadt", {NULL}, 4169, "tcp"}, -{"iadt-disc", {NULL}, 4169, "udp"}, -{"d-cinema-csp", {NULL}, 4170, "tcp"}, -{"ml-svnet", {NULL}, 4171, "tcp"}, -{"pcoip", {NULL}, 4172, "tcp"}, -{"pcoip", {NULL}, 4172, "udp"}, -{"smcluster", {NULL}, 4174, "tcp"}, -{"bccp", {NULL}, 4175, "tcp"}, -{"tl-ipcproxy", {NULL}, 4176, "tcp"}, -{"wello", {NULL}, 4177, "tcp"}, -{"wello", {NULL}, 4177, "udp"}, -{"storman", {NULL}, 4178, "tcp"}, -{"storman", {NULL}, 4178, "udp"}, -{"MaxumSP", {NULL}, 4179, "tcp"}, -{"MaxumSP", {NULL}, 4179, "udp"}, -{"httpx", {NULL}, 4180, "tcp"}, -{"httpx", {NULL}, 4180, "udp"}, -{"macbak", {NULL}, 4181, "tcp"}, -{"macbak", {NULL}, 4181, "udp"}, -{"pcptcpservice", {NULL}, 4182, "tcp"}, -{"pcptcpservice", {NULL}, 4182, "udp"}, -{"gmmp", {NULL}, 4183, "tcp"}, -{"gmmp", {NULL}, 4183, "udp"}, -{"universe_suite", {NULL}, 4184, "tcp"}, -{"universe_suite", {NULL}, 4184, "udp"}, -{"wcpp", {NULL}, 4185, "tcp"}, -{"wcpp", {NULL}, 4185, "udp"}, -{"boxbackupstore", {NULL}, 4186, "tcp"}, -{"csc_proxy", {NULL}, 4187, "tcp"}, -{"vatata", {NULL}, 4188, "tcp"}, -{"vatata", {NULL}, 4188, "udp"}, -{"pcep", {NULL}, 4189, "tcp"}, -{"sieve", {NULL}, 4190, "tcp"}, -{"dsmipv6", {NULL}, 4191, "udp"}, -{"azeti", {NULL}, 4192, "tcp"}, -{"azeti-bd", {NULL}, 4192, "udp"}, -{"pvxplusio", {NULL}, 4193, "tcp"}, -{"eims-admin", {NULL}, 4199, "tcp"}, -{"eims-admin", {NULL}, 4199, "udp"}, -{"corelccam", {NULL}, 4300, "tcp"}, -{"corelccam", {NULL}, 4300, "udp"}, -{"d-data", {NULL}, 4301, "tcp"}, -{"d-data", {NULL}, 4301, "udp"}, -{"d-data-control", {NULL}, 4302, "tcp"}, -{"d-data-control", {NULL}, 4302, "udp"}, -{"srcp", {NULL}, 4303, "tcp"}, -{"srcp", {NULL}, 4303, "udp"}, -{"owserver", {NULL}, 4304, "tcp"}, -{"owserver", {NULL}, 4304, "udp"}, -{"batman", {NULL}, 4305, "tcp"}, -{"batman", {NULL}, 4305, "udp"}, -{"pinghgl", {NULL}, 4306, "tcp"}, -{"pinghgl", {NULL}, 4306, "udp"}, -{"visicron-vs", {NULL}, 4307, "tcp"}, -{"visicron-vs", {NULL}, 4307, "udp"}, -{"compx-lockview", {NULL}, 4308, "tcp"}, -{"compx-lockview", {NULL}, 4308, "udp"}, -{"dserver", {NULL}, 4309, "tcp"}, -{"dserver", {NULL}, 4309, "udp"}, -{"mirrtex", {NULL}, 4310, "tcp"}, -{"mirrtex", {NULL}, 4310, "udp"}, -{"p6ssmc", {NULL}, 4311, "tcp"}, -{"pscl-mgt", {NULL}, 4312, "tcp"}, -{"perrla", {NULL}, 4313, "tcp"}, -{"fdt-rcatp", {NULL}, 4320, "tcp"}, -{"fdt-rcatp", {NULL}, 4320, "udp"}, -{"rwhois", {NULL}, 4321, "tcp"}, -{"rwhois", {NULL}, 4321, "udp"}, -{"trim-event", {NULL}, 4322, "tcp"}, -{"trim-event", {NULL}, 4322, "udp"}, -{"trim-ice", {NULL}, 4323, "tcp"}, -{"trim-ice", {NULL}, 4323, "udp"}, -{"balour", {NULL}, 4324, "tcp"}, -{"balour", {NULL}, 4324, "udp"}, -{"geognosisman", {NULL}, 4325, "tcp"}, -{"geognosisman", {NULL}, 4325, "udp"}, -{"geognosis", {NULL}, 4326, "tcp"}, -{"geognosis", {NULL}, 4326, "udp"}, -{"jaxer-web", {NULL}, 4327, "tcp"}, -{"jaxer-web", {NULL}, 4327, "udp"}, -{"jaxer-manager", {NULL}, 4328, "tcp"}, -{"jaxer-manager", {NULL}, 4328, "udp"}, -{"publiqare-sync", {NULL}, 4329, "tcp"}, -{"gaia", {NULL}, 4340, "tcp"}, -{"gaia", {NULL}, 4340, "udp"}, -{"lisp-data", {NULL}, 4341, "tcp"}, -{"lisp-data", {NULL}, 4341, "udp"}, -{"lisp-cons", {NULL}, 4342, "tcp"}, -{"lisp-control", {NULL}, 4342, "udp"}, -{"unicall", {NULL}, 4343, "tcp"}, -{"unicall", {NULL}, 4343, "udp"}, -{"vinainstall", {NULL}, 4344, "tcp"}, -{"vinainstall", {NULL}, 4344, "udp"}, -{"m4-network-as", {NULL}, 4345, "tcp"}, -{"m4-network-as", {NULL}, 4345, "udp"}, -{"elanlm", {NULL}, 4346, "tcp"}, -{"elanlm", {NULL}, 4346, "udp"}, -{"lansurveyor", {NULL}, 4347, "tcp"}, -{"lansurveyor", {NULL}, 4347, "udp"}, -{"itose", {NULL}, 4348, "tcp"}, -{"itose", {NULL}, 4348, "udp"}, -{"fsportmap", {NULL}, 4349, "tcp"}, -{"fsportmap", {NULL}, 4349, "udp"}, -{"net-device", {NULL}, 4350, "tcp"}, -{"net-device", {NULL}, 4350, "udp"}, -{"plcy-net-svcs", {NULL}, 4351, "tcp"}, -{"plcy-net-svcs", {NULL}, 4351, "udp"}, -{"pjlink", {NULL}, 4352, "tcp"}, -{"pjlink", {NULL}, 4352, "udp"}, -{"f5-iquery", {NULL}, 4353, "tcp"}, -{"f5-iquery", {NULL}, 4353, "udp"}, -{"qsnet-trans", {NULL}, 4354, "tcp"}, -{"qsnet-trans", {NULL}, 4354, "udp"}, -{"qsnet-workst", {NULL}, 4355, "tcp"}, -{"qsnet-workst", {NULL}, 4355, "udp"}, -{"qsnet-assist", {NULL}, 4356, "tcp"}, -{"qsnet-assist", {NULL}, 4356, "udp"}, -{"qsnet-cond", {NULL}, 4357, "tcp"}, -{"qsnet-cond", {NULL}, 4357, "udp"}, -{"qsnet-nucl", {NULL}, 4358, "tcp"}, -{"qsnet-nucl", {NULL}, 4358, "udp"}, -{"omabcastltkm", {NULL}, 4359, "tcp"}, -{"omabcastltkm", {NULL}, 4359, "udp"}, -{"matrix_vnet", {NULL}, 4360, "tcp"}, -{"nacnl", {NULL}, 4361, "udp"}, -{"afore-vdp-disc", {NULL}, 4362, "udp"}, -{"wxbrief", {NULL}, 4368, "tcp"}, -{"wxbrief", {NULL}, 4368, "udp"}, -{"epmd", {NULL}, 4369, "tcp"}, -{"epmd", {NULL}, 4369, "udp"}, -{"elpro_tunnel", {NULL}, 4370, "tcp"}, -{"elpro_tunnel", {NULL}, 4370, "udp"}, -{"l2c-control", {NULL}, 4371, "tcp"}, -{"l2c-disc", {NULL}, 4371, "udp"}, -{"l2c-data", {NULL}, 4372, "tcp"}, -{"l2c-data", {NULL}, 4372, "udp"}, -{"remctl", {NULL}, 4373, "tcp"}, -{"remctl", {NULL}, 4373, "udp"}, -{"psi-ptt", {NULL}, 4374, "tcp"}, -{"tolteces", {NULL}, 4375, "tcp"}, -{"tolteces", {NULL}, 4375, "udp"}, -{"bip", {NULL}, 4376, "tcp"}, -{"bip", {NULL}, 4376, "udp"}, -{"cp-spxsvr", {NULL}, 4377, "tcp"}, -{"cp-spxsvr", {NULL}, 4377, "udp"}, -{"cp-spxdpy", {NULL}, 4378, "tcp"}, -{"cp-spxdpy", {NULL}, 4378, "udp"}, -{"ctdb", {NULL}, 4379, "tcp"}, -{"ctdb", {NULL}, 4379, "udp"}, -{"xandros-cms", {NULL}, 4389, "tcp"}, -{"xandros-cms", {NULL}, 4389, "udp"}, -{"wiegand", {NULL}, 4390, "tcp"}, -{"wiegand", {NULL}, 4390, "udp"}, -{"apwi-imserver", {NULL}, 4391, "tcp"}, -{"apwi-rxserver", {NULL}, 4392, "tcp"}, -{"apwi-rxspooler", {NULL}, 4393, "tcp"}, -{"apwi-disc", {NULL}, 4394, "udp"}, -{"omnivisionesx", {NULL}, 4395, "tcp"}, -{"omnivisionesx", {NULL}, 4395, "udp"}, -{"fly", {NULL}, 4396, "tcp"}, -{"ds-srv", {NULL}, 4400, "tcp"}, -{"ds-srv", {NULL}, 4400, "udp"}, -{"ds-srvr", {NULL}, 4401, "tcp"}, -{"ds-srvr", {NULL}, 4401, "udp"}, -{"ds-clnt", {NULL}, 4402, "tcp"}, -{"ds-clnt", {NULL}, 4402, "udp"}, -{"ds-user", {NULL}, 4403, "tcp"}, -{"ds-user", {NULL}, 4403, "udp"}, -{"ds-admin", {NULL}, 4404, "tcp"}, -{"ds-admin", {NULL}, 4404, "udp"}, -{"ds-mail", {NULL}, 4405, "tcp"}, -{"ds-mail", {NULL}, 4405, "udp"}, -{"ds-slp", {NULL}, 4406, "tcp"}, -{"ds-slp", {NULL}, 4406, "udp"}, -{"nacagent", {NULL}, 4407, "tcp"}, -{"slscc", {NULL}, 4408, "tcp"}, -{"netcabinet-com", {NULL}, 4409, "tcp"}, -{"itwo-server", {NULL}, 4410, "tcp"}, -{"netrockey6", {NULL}, 4425, "tcp"}, -{"netrockey6", {NULL}, 4425, "udp"}, -{"beacon-port-2", {NULL}, 4426, "tcp"}, -{"beacon-port-2", {NULL}, 4426, "udp"}, -{"drizzle", {NULL}, 4427, "tcp"}, -{"omviserver", {NULL}, 4428, "tcp"}, -{"omviagent", {NULL}, 4429, "tcp"}, -{"rsqlserver", {NULL}, 4430, "tcp"}, -{"rsqlserver", {NULL}, 4430, "udp"}, -{"wspipe", {NULL}, 4431, "tcp"}, -{"netblox", {NULL}, 4441, "udp"}, -{"saris", {NULL}, 4442, "tcp"}, -{"saris", {NULL}, 4442, "udp"}, -{"pharos", {NULL}, 4443, "tcp"}, -{"pharos", {NULL}, 4443, "udp"}, -{"krb524", {NULL}, 4444, "tcp"}, -{"krb524", {NULL}, 4444, "udp"}, -{"nv-video", {NULL}, 4444, "tcp"}, -{"nv-video", {NULL}, 4444, "udp"}, -{"upnotifyp", {NULL}, 4445, "tcp"}, -{"upnotifyp", {NULL}, 4445, "udp"}, -{"n1-fwp", {NULL}, 4446, "tcp"}, -{"n1-fwp", {NULL}, 4446, "udp"}, -{"n1-rmgmt", {NULL}, 4447, "tcp"}, -{"n1-rmgmt", {NULL}, 4447, "udp"}, -{"asc-slmd", {NULL}, 4448, "tcp"}, -{"asc-slmd", {NULL}, 4448, "udp"}, -{"privatewire", {NULL}, 4449, "tcp"}, -{"privatewire", {NULL}, 4449, "udp"}, -{"camp", {NULL}, 4450, "tcp"}, -{"camp", {NULL}, 4450, "udp"}, -{"ctisystemmsg", {NULL}, 4451, "tcp"}, -{"ctisystemmsg", {NULL}, 4451, "udp"}, -{"ctiprogramload", {NULL}, 4452, "tcp"}, -{"ctiprogramload", {NULL}, 4452, "udp"}, -{"nssalertmgr", {NULL}, 4453, "tcp"}, -{"nssalertmgr", {NULL}, 4453, "udp"}, -{"nssagentmgr", {NULL}, 4454, "tcp"}, -{"nssagentmgr", {NULL}, 4454, "udp"}, -{"prchat-user", {NULL}, 4455, "tcp"}, -{"prchat-user", {NULL}, 4455, "udp"}, -{"prchat-server", {NULL}, 4456, "tcp"}, -{"prchat-server", {NULL}, 4456, "udp"}, -{"prRegister", {NULL}, 4457, "tcp"}, -{"prRegister", {NULL}, 4457, "udp"}, -{"mcp", {NULL}, 4458, "tcp"}, -{"mcp", {NULL}, 4458, "udp"}, -{"hpssmgmt", {NULL}, 4484, "tcp"}, -{"hpssmgmt", {NULL}, 4484, "udp"}, -{"assyst-dr", {NULL}, 4485, "tcp"}, -{"icms", {NULL}, 4486, "tcp"}, -{"icms", {NULL}, 4486, "udp"}, -{"prex-tcp", {NULL}, 4487, "tcp"}, -{"awacs-ice", {NULL}, 4488, "tcp"}, -{"awacs-ice", {NULL}, 4488, "udp"}, -{"ipsec-nat-t", {NULL}, 4500, "tcp"}, -{"ipsec-nat-t", {NULL}, 4500, "udp"}, -{"ehs", {NULL}, 4535, "tcp"}, -{"ehs", {NULL}, 4535, "udp"}, -{"ehs-ssl", {NULL}, 4536, "tcp"}, -{"ehs-ssl", {NULL}, 4536, "udp"}, -{"wssauthsvc", {NULL}, 4537, "tcp"}, -{"wssauthsvc", {NULL}, 4537, "udp"}, -{"swx-gate", {NULL}, 4538, "tcp"}, -{"swx-gate", {NULL}, 4538, "udp"}, -{"worldscores", {NULL}, 4545, "tcp"}, -{"worldscores", {NULL}, 4545, "udp"}, -{"sf-lm", {NULL}, 4546, "tcp"}, -{"sf-lm", {NULL}, 4546, "udp"}, -{"lanner-lm", {NULL}, 4547, "tcp"}, -{"lanner-lm", {NULL}, 4547, "udp"}, -{"synchromesh", {NULL}, 4548, "tcp"}, -{"synchromesh", {NULL}, 4548, "udp"}, -{"aegate", {NULL}, 4549, "tcp"}, -{"aegate", {NULL}, 4549, "udp"}, -{"gds-adppiw-db", {NULL}, 4550, "tcp"}, -{"gds-adppiw-db", {NULL}, 4550, "udp"}, -{"ieee-mih", {NULL}, 4551, "tcp"}, -{"ieee-mih", {NULL}, 4551, "udp"}, -{"menandmice-mon", {NULL}, 4552, "tcp"}, -{"menandmice-mon", {NULL}, 4552, "udp"}, -{"icshostsvc", {NULL}, 4553, "tcp"}, -{"msfrs", {NULL}, 4554, "tcp"}, -{"msfrs", {NULL}, 4554, "udp"}, -{"rsip", {NULL}, 4555, "tcp"}, -{"rsip", {NULL}, 4555, "udp"}, -{"dtn-bundle-tcp", {NULL}, 4556, "tcp"}, -{"dtn-bundle-udp", {NULL}, 4556, "udp"}, -{"mtcevrunqss", {NULL}, 4557, "udp"}, -{"mtcevrunqman", {NULL}, 4558, "udp"}, -{"hylafax", {NULL}, 4559, "tcp"}, -{"hylafax", {NULL}, 4559, "udp"}, -{"kwtc", {NULL}, 4566, "tcp"}, -{"kwtc", {NULL}, 4566, "udp"}, -{"tram", {NULL}, 4567, "tcp"}, -{"tram", {NULL}, 4567, "udp"}, -{"bmc-reporting", {NULL}, 4568, "tcp"}, -{"bmc-reporting", {NULL}, 4568, "udp"}, -{"iax", {NULL}, 4569, "tcp"}, -{"iax", {NULL}, 4569, "udp"}, -{"rid", {NULL}, 4590, "tcp"}, -{"l3t-at-an", {NULL}, 4591, "tcp"}, -{"l3t-at-an", {NULL}, 4591, "udp"}, -{"hrpd-ith-at-an", {NULL}, 4592, "udp"}, -{"ipt-anri-anri", {NULL}, 4593, "tcp"}, -{"ipt-anri-anri", {NULL}, 4593, "udp"}, -{"ias-session", {NULL}, 4594, "tcp"}, -{"ias-session", {NULL}, 4594, "udp"}, -{"ias-paging", {NULL}, 4595, "tcp"}, -{"ias-paging", {NULL}, 4595, "udp"}, -{"ias-neighbor", {NULL}, 4596, "tcp"}, -{"ias-neighbor", {NULL}, 4596, "udp"}, -{"a21-an-1xbs", {NULL}, 4597, "tcp"}, -{"a21-an-1xbs", {NULL}, 4597, "udp"}, -{"a16-an-an", {NULL}, 4598, "tcp"}, -{"a16-an-an", {NULL}, 4598, "udp"}, -{"a17-an-an", {NULL}, 4599, "tcp"}, -{"a17-an-an", {NULL}, 4599, "udp"}, -{"piranha1", {NULL}, 4600, "tcp"}, -{"piranha1", {NULL}, 4600, "udp"}, -{"piranha2", {NULL}, 4601, "tcp"}, -{"piranha2", {NULL}, 4601, "udp"}, -{"mtsserver", {NULL}, 4602, "tcp"}, -{"menandmice-upg", {NULL}, 4603, "tcp"}, -{"playsta2-app", {NULL}, 4658, "tcp"}, -{"playsta2-app", {NULL}, 4658, "udp"}, -{"playsta2-lob", {NULL}, 4659, "tcp"}, -{"playsta2-lob", {NULL}, 4659, "udp"}, -{"smaclmgr", {NULL}, 4660, "tcp"}, -{"smaclmgr", {NULL}, 4660, "udp"}, -{"kar2ouche", {NULL}, 4661, "tcp"}, -{"kar2ouche", {NULL}, 4661, "udp"}, -{"oms", {NULL}, 4662, "tcp"}, -{"oms", {NULL}, 4662, "udp"}, -{"noteit", {NULL}, 4663, "tcp"}, -{"noteit", {NULL}, 4663, "udp"}, -{"ems", {NULL}, 4664, "tcp"}, -{"ems", {NULL}, 4664, "udp"}, -{"contclientms", {NULL}, 4665, "tcp"}, -{"contclientms", {NULL}, 4665, "udp"}, -{"eportcomm", {NULL}, 4666, "tcp"}, -{"eportcomm", {NULL}, 4666, "udp"}, -{"mmacomm", {NULL}, 4667, "tcp"}, -{"mmacomm", {NULL}, 4667, "udp"}, -{"mmaeds", {NULL}, 4668, "tcp"}, -{"mmaeds", {NULL}, 4668, "udp"}, -{"eportcommdata", {NULL}, 4669, "tcp"}, -{"eportcommdata", {NULL}, 4669, "udp"}, -{"light", {NULL}, 4670, "tcp"}, -{"light", {NULL}, 4670, "udp"}, -{"acter", {NULL}, 4671, "tcp"}, -{"acter", {NULL}, 4671, "udp"}, -{"rfa", {NULL}, 4672, "tcp"}, -{"rfa", {NULL}, 4672, "udp"}, -{"cxws", {NULL}, 4673, "tcp"}, -{"cxws", {NULL}, 4673, "udp"}, -{"appiq-mgmt", {NULL}, 4674, "tcp"}, -{"appiq-mgmt", {NULL}, 4674, "udp"}, -{"dhct-status", {NULL}, 4675, "tcp"}, -{"dhct-status", {NULL}, 4675, "udp"}, -{"dhct-alerts", {NULL}, 4676, "tcp"}, -{"dhct-alerts", {NULL}, 4676, "udp"}, -{"bcs", {NULL}, 4677, "tcp"}, -{"bcs", {NULL}, 4677, "udp"}, -{"traversal", {NULL}, 4678, "tcp"}, -{"traversal", {NULL}, 4678, "udp"}, -{"mgesupervision", {NULL}, 4679, "tcp"}, -{"mgesupervision", {NULL}, 4679, "udp"}, -{"mgemanagement", {NULL}, 4680, "tcp"}, -{"mgemanagement", {NULL}, 4680, "udp"}, -{"parliant", {NULL}, 4681, "tcp"}, -{"parliant", {NULL}, 4681, "udp"}, -{"finisar", {NULL}, 4682, "tcp"}, -{"finisar", {NULL}, 4682, "udp"}, -{"spike", {NULL}, 4683, "tcp"}, -{"spike", {NULL}, 4683, "udp"}, -{"rfid-rp1", {NULL}, 4684, "tcp"}, -{"rfid-rp1", {NULL}, 4684, "udp"}, -{"autopac", {NULL}, 4685, "tcp"}, -{"autopac", {NULL}, 4685, "udp"}, -{"msp-os", {NULL}, 4686, "tcp"}, -{"msp-os", {NULL}, 4686, "udp"}, -{"nst", {NULL}, 4687, "tcp"}, -{"nst", {NULL}, 4687, "udp"}, -{"mobile-p2p", {NULL}, 4688, "tcp"}, -{"mobile-p2p", {NULL}, 4688, "udp"}, -{"altovacentral", {NULL}, 4689, "tcp"}, -{"altovacentral", {NULL}, 4689, "udp"}, -{"prelude", {NULL}, 4690, "tcp"}, -{"prelude", {NULL}, 4690, "udp"}, -{"mtn", {NULL}, 4691, "tcp"}, -{"mtn", {NULL}, 4691, "udp"}, -{"conspiracy", {NULL}, 4692, "tcp"}, -{"conspiracy", {NULL}, 4692, "udp"}, -{"netxms-agent", {NULL}, 4700, "tcp"}, -{"netxms-agent", {NULL}, 4700, "udp"}, -{"netxms-mgmt", {NULL}, 4701, "tcp"}, -{"netxms-mgmt", {NULL}, 4701, "udp"}, -{"netxms-sync", {NULL}, 4702, "tcp"}, -{"netxms-sync", {NULL}, 4702, "udp"}, -{"npqes-test", {NULL}, 4703, "tcp"}, -{"assuria-ins", {NULL}, 4704, "tcp"}, -{"truckstar", {NULL}, 4725, "tcp"}, -{"truckstar", {NULL}, 4725, "udp"}, -{"a26-fap-fgw", {NULL}, 4726, "udp"}, -{"fcis", {NULL}, 4727, "tcp"}, -{"fcis-disc", {NULL}, 4727, "udp"}, -{"capmux", {NULL}, 4728, "tcp"}, -{"capmux", {NULL}, 4728, "udp"}, -{"gsmtap", {NULL}, 4729, "udp"}, -{"gearman", {NULL}, 4730, "tcp"}, -{"gearman", {NULL}, 4730, "udp"}, -{"remcap", {NULL}, 4731, "tcp"}, -{"ohmtrigger", {NULL}, 4732, "udp"}, -{"resorcs", {NULL}, 4733, "tcp"}, -{"ipdr-sp", {NULL}, 4737, "tcp"}, -{"ipdr-sp", {NULL}, 4737, "udp"}, -{"solera-lpn", {NULL}, 4738, "tcp"}, -{"solera-lpn", {NULL}, 4738, "udp"}, -{"ipfix", {NULL}, 4739, "tcp"}, -{"ipfix", {NULL}, 4739, "udp"}, -{"ipfix", {NULL}, 4739, "sctp"}, -{"ipfixs", {NULL}, 4740, "tcp"}, -{"ipfixs", {NULL}, 4740, "sctp"}, -{"ipfixs", {NULL}, 4740, "udp"}, -{"lumimgrd", {NULL}, 4741, "tcp"}, -{"lumimgrd", {NULL}, 4741, "udp"}, -{"sicct", {NULL}, 4742, "tcp"}, -{"sicct-sdp", {NULL}, 4742, "udp"}, -{"openhpid", {NULL}, 4743, "tcp"}, -{"openhpid", {NULL}, 4743, "udp"}, -{"ifsp", {NULL}, 4744, "tcp"}, -{"ifsp", {NULL}, 4744, "udp"}, -{"fmp", {NULL}, 4745, "tcp"}, -{"fmp", {NULL}, 4745, "udp"}, -{"profilemac", {NULL}, 4749, "tcp"}, -{"profilemac", {NULL}, 4749, "udp"}, -{"ssad", {NULL}, 4750, "tcp"}, -{"ssad", {NULL}, 4750, "udp"}, -{"spocp", {NULL}, 4751, "tcp"}, -{"spocp", {NULL}, 4751, "udp"}, -{"snap", {NULL}, 4752, "tcp"}, -{"snap", {NULL}, 4752, "udp"}, -{"bfd-multi-ctl", {NULL}, 4784, "tcp"}, -{"bfd-multi-ctl", {NULL}, 4784, "udp"}, -{"cncp", {NULL}, 4785, "udp"}, -{"smart-install", {NULL}, 4786, "tcp"}, -{"sia-ctrl-plane", {NULL}, 4787, "tcp"}, -{"iims", {NULL}, 4800, "tcp"}, -{"iims", {NULL}, 4800, "udp"}, -{"iwec", {NULL}, 4801, "tcp"}, -{"iwec", {NULL}, 4801, "udp"}, -{"ilss", {NULL}, 4802, "tcp"}, -{"ilss", {NULL}, 4802, "udp"}, -{"notateit", {NULL}, 4803, "tcp"}, -{"notateit-disc", {NULL}, 4803, "udp"}, -{"aja-ntv4-disc", {NULL}, 4804, "udp"}, -{"htcp", {NULL}, 4827, "tcp"}, -{"htcp", {NULL}, 4827, "udp"}, -{"varadero-0", {NULL}, 4837, "tcp"}, -{"varadero-0", {NULL}, 4837, "udp"}, -{"varadero-1", {NULL}, 4838, "tcp"}, -{"varadero-1", {NULL}, 4838, "udp"}, -{"varadero-2", {NULL}, 4839, "tcp"}, -{"varadero-2", {NULL}, 4839, "udp"}, -{"opcua-tcp", {NULL}, 4840, "tcp"}, -{"opcua-udp", {NULL}, 4840, "udp"}, -{"quosa", {NULL}, 4841, "tcp"}, -{"quosa", {NULL}, 4841, "udp"}, -{"gw-asv", {NULL}, 4842, "tcp"}, -{"gw-asv", {NULL}, 4842, "udp"}, -{"opcua-tls", {NULL}, 4843, "tcp"}, -{"opcua-tls", {NULL}, 4843, "udp"}, -{"gw-log", {NULL}, 4844, "tcp"}, -{"gw-log", {NULL}, 4844, "udp"}, -{"wcr-remlib", {NULL}, 4845, "tcp"}, -{"wcr-remlib", {NULL}, 4845, "udp"}, -{"contamac_icm", {NULL}, 4846, "tcp"}, -{"contamac_icm", {NULL}, 4846, "udp"}, -{"wfc", {NULL}, 4847, "tcp"}, -{"wfc", {NULL}, 4847, "udp"}, -{"appserv-http", {NULL}, 4848, "tcp"}, -{"appserv-http", {NULL}, 4848, "udp"}, -{"appserv-https", {NULL}, 4849, "tcp"}, -{"appserv-https", {NULL}, 4849, "udp"}, -{"sun-as-nodeagt", {NULL}, 4850, "tcp"}, -{"sun-as-nodeagt", {NULL}, 4850, "udp"}, -{"derby-repli", {NULL}, 4851, "tcp"}, -{"derby-repli", {NULL}, 4851, "udp"}, -{"unify-debug", {NULL}, 4867, "tcp"}, -{"unify-debug", {NULL}, 4867, "udp"}, -{"phrelay", {NULL}, 4868, "tcp"}, -{"phrelay", {NULL}, 4868, "udp"}, -{"phrelaydbg", {NULL}, 4869, "tcp"}, -{"phrelaydbg", {NULL}, 4869, "udp"}, -{"cc-tracking", {NULL}, 4870, "tcp"}, -{"cc-tracking", {NULL}, 4870, "udp"}, -{"wired", {NULL}, 4871, "tcp"}, -{"wired", {NULL}, 4871, "udp"}, -{"tritium-can", {NULL}, 4876, "tcp"}, -{"tritium-can", {NULL}, 4876, "udp"}, -{"lmcs", {NULL}, 4877, "tcp"}, -{"lmcs", {NULL}, 4877, "udp"}, -{"inst-discovery", {NULL}, 4878, "udp"}, -{"wsdl-event", {NULL}, 4879, "tcp"}, -{"hislip", {NULL}, 4880, "tcp"}, -{"socp-t", {NULL}, 4881, "udp"}, -{"socp-c", {NULL}, 4882, "udp"}, -{"wmlserver", {NULL}, 4883, "tcp"}, -{"hivestor", {NULL}, 4884, "tcp"}, -{"hivestor", {NULL}, 4884, "udp"}, -{"abbs", {NULL}, 4885, "tcp"}, -{"abbs", {NULL}, 4885, "udp"}, -{"lyskom", {NULL}, 4894, "tcp"}, -{"lyskom", {NULL}, 4894, "udp"}, -{"radmin-port", {NULL}, 4899, "tcp"}, -{"radmin-port", {NULL}, 4899, "udp"}, -{"hfcs", {NULL}, 4900, "tcp"}, -{"hfcs", {NULL}, 4900, "udp"}, -{"flr_agent", {NULL}, 4901, "tcp"}, -{"magiccontrol", {NULL}, 4902, "tcp"}, -{"lutap", {NULL}, 4912, "tcp"}, -{"lutcp", {NULL}, 4913, "tcp"}, -{"bones", {NULL}, 4914, "tcp"}, -{"bones", {NULL}, 4914, "udp"}, -{"frcs", {NULL}, 4915, "tcp"}, -{"atsc-mh-ssc", {NULL}, 4937, "udp"}, -{"eq-office-4940", {NULL}, 4940, "tcp"}, -{"eq-office-4940", {NULL}, 4940, "udp"}, -{"eq-office-4941", {NULL}, 4941, "tcp"}, -{"eq-office-4941", {NULL}, 4941, "udp"}, -{"eq-office-4942", {NULL}, 4942, "tcp"}, -{"eq-office-4942", {NULL}, 4942, "udp"}, -{"munin", {NULL}, 4949, "tcp"}, -{"munin", {NULL}, 4949, "udp"}, -{"sybasesrvmon", {NULL}, 4950, "tcp"}, -{"sybasesrvmon", {NULL}, 4950, "udp"}, -{"pwgwims", {NULL}, 4951, "tcp"}, -{"pwgwims", {NULL}, 4951, "udp"}, -{"sagxtsds", {NULL}, 4952, "tcp"}, -{"sagxtsds", {NULL}, 4952, "udp"}, -{"dbsyncarbiter", {NULL}, 4953, "tcp"}, -{"ccss-qmm", {NULL}, 4969, "tcp"}, -{"ccss-qmm", {NULL}, 4969, "udp"}, -{"ccss-qsm", {NULL}, 4970, "tcp"}, -{"ccss-qsm", {NULL}, 4970, "udp"}, -{"webyast", {NULL}, 4984, "tcp"}, -{"gerhcs", {NULL}, 4985, "tcp"}, -{"mrip", {NULL}, 4986, "tcp"}, -{"mrip", {NULL}, 4986, "udp"}, -{"smar-se-port1", {NULL}, 4987, "tcp"}, -{"smar-se-port1", {NULL}, 4987, "udp"}, -{"smar-se-port2", {NULL}, 4988, "tcp"}, -{"smar-se-port2", {NULL}, 4988, "udp"}, -{"parallel", {NULL}, 4989, "tcp"}, -{"parallel", {NULL}, 4989, "udp"}, -{"busycal", {NULL}, 4990, "tcp"}, -{"busycal", {NULL}, 4990, "udp"}, -{"vrt", {NULL}, 4991, "tcp"}, -{"vrt", {NULL}, 4991, "udp"}, -{"hfcs-manager", {NULL}, 4999, "tcp"}, -{"hfcs-manager", {NULL}, 4999, "udp"}, -{"commplex-main", {NULL}, 5000, "tcp"}, -{"commplex-main", {NULL}, 5000, "udp"}, -{"commplex-link", {NULL}, 5001, "tcp"}, -{"commplex-link", {NULL}, 5001, "udp"}, -{"rfe", {NULL}, 5002, "tcp"}, -{"rfe", {NULL}, 5002, "udp"}, -{"fmpro-internal", {NULL}, 5003, "tcp"}, -{"fmpro-internal", {NULL}, 5003, "udp"}, -{"avt-profile-1", {NULL}, 5004, "tcp"}, -{"avt-profile-1", {NULL}, 5004, "udp"}, -{"avt-profile-1", {NULL}, 5004, "dccp"}, -{"avt-profile-2", {NULL}, 5005, "tcp"}, -{"avt-profile-2", {NULL}, 5005, "udp"}, -{"avt-profile-2", {NULL}, 5005, "dccp"}, -{"wsm-server", {NULL}, 5006, "tcp"}, -{"wsm-server", {NULL}, 5006, "udp"}, -{"wsm-server-ssl", {NULL}, 5007, "tcp"}, -{"wsm-server-ssl", {NULL}, 5007, "udp"}, -{"synapsis-edge", {NULL}, 5008, "tcp"}, -{"synapsis-edge", {NULL}, 5008, "udp"}, -{"winfs", {NULL}, 5009, "tcp"}, -{"winfs", {NULL}, 5009, "udp"}, -{"telelpathstart", {NULL}, 5010, "tcp"}, -{"telelpathstart", {NULL}, 5010, "udp"}, -{"telelpathattack", {NULL}, 5011, "tcp"}, -{"telelpathattack", {NULL}, 5011, "udp"}, -{"nsp", {NULL}, 5012, "tcp"}, -{"nsp", {NULL}, 5012, "udp"}, -{"fmpro-v6", {NULL}, 5013, "tcp"}, -{"fmpro-v6", {NULL}, 5013, "udp"}, -{"onpsocket", {NULL}, 5014, "udp"}, -{"fmwp", {NULL}, 5015, "tcp"}, -{"zenginkyo-1", {NULL}, 5020, "tcp"}, -{"zenginkyo-1", {NULL}, 5020, "udp"}, -{"zenginkyo-2", {NULL}, 5021, "tcp"}, -{"zenginkyo-2", {NULL}, 5021, "udp"}, -{"mice", {NULL}, 5022, "tcp"}, -{"mice", {NULL}, 5022, "udp"}, -{"htuilsrv", {NULL}, 5023, "tcp"}, -{"htuilsrv", {NULL}, 5023, "udp"}, -{"scpi-telnet", {NULL}, 5024, "tcp"}, -{"scpi-telnet", {NULL}, 5024, "udp"}, -{"scpi-raw", {NULL}, 5025, "tcp"}, -{"scpi-raw", {NULL}, 5025, "udp"}, -{"strexec-d", {NULL}, 5026, "tcp"}, -{"strexec-d", {NULL}, 5026, "udp"}, -{"strexec-s", {NULL}, 5027, "tcp"}, -{"strexec-s", {NULL}, 5027, "udp"}, -{"qvr", {NULL}, 5028, "tcp"}, -{"infobright", {NULL}, 5029, "tcp"}, -{"infobright", {NULL}, 5029, "udp"}, -{"surfpass", {NULL}, 5030, "tcp"}, -{"surfpass", {NULL}, 5030, "udp"}, -{"dmp", {NULL}, 5031, "udp"}, -{"asnaacceler8db", {NULL}, 5042, "tcp"}, -{"asnaacceler8db", {NULL}, 5042, "udp"}, -{"swxadmin", {NULL}, 5043, "tcp"}, -{"swxadmin", {NULL}, 5043, "udp"}, -{"lxi-evntsvc", {NULL}, 5044, "tcp"}, -{"lxi-evntsvc", {NULL}, 5044, "udp"}, -{"osp", {NULL}, 5045, "tcp"}, -{"vpm-udp", {NULL}, 5046, "udp"}, -{"iscape", {NULL}, 5047, "udp"}, -{"texai", {NULL}, 5048, "tcp"}, -{"ivocalize", {NULL}, 5049, "tcp"}, -{"ivocalize", {NULL}, 5049, "udp"}, -{"mmcc", {NULL}, 5050, "tcp"}, -{"mmcc", {NULL}, 5050, "udp"}, -{"ita-agent", {NULL}, 5051, "tcp"}, -{"ita-agent", {NULL}, 5051, "udp"}, -{"ita-manager", {NULL}, 5052, "tcp"}, -{"ita-manager", {NULL}, 5052, "udp"}, -{"rlm", {NULL}, 5053, "tcp"}, -{"rlm-admin", {NULL}, 5054, "tcp"}, -{"unot", {NULL}, 5055, "tcp"}, -{"unot", {NULL}, 5055, "udp"}, -{"intecom-ps1", {NULL}, 5056, "tcp"}, -{"intecom-ps1", {NULL}, 5056, "udp"}, -{"intecom-ps2", {NULL}, 5057, "tcp"}, -{"intecom-ps2", {NULL}, 5057, "udp"}, -{"locus-disc", {NULL}, 5058, "udp"}, -{"sds", {NULL}, 5059, "tcp"}, -{"sds", {NULL}, 5059, "udp"}, -{"sip", {NULL}, 5060, "tcp"}, -{"sip", {NULL}, 5060, "udp"}, -{"sip-tls", {NULL}, 5061, "tcp"}, -{"sip-tls", {NULL}, 5061, "udp"}, -{"na-localise", {NULL}, 5062, "tcp"}, -{"na-localise", {NULL}, 5062, "udp"}, -{"csrpc", {NULL}, 5063, "tcp"}, -{"ca-1", {NULL}, 5064, "tcp"}, -{"ca-1", {NULL}, 5064, "udp"}, -{"ca-2", {NULL}, 5065, "tcp"}, -{"ca-2", {NULL}, 5065, "udp"}, -{"stanag-5066", {NULL}, 5066, "tcp"}, -{"stanag-5066", {NULL}, 5066, "udp"}, -{"authentx", {NULL}, 5067, "tcp"}, -{"authentx", {NULL}, 5067, "udp"}, -{"bitforestsrv", {NULL}, 5068, "tcp"}, -{"i-net-2000-npr", {NULL}, 5069, "tcp"}, -{"i-net-2000-npr", {NULL}, 5069, "udp"}, -{"vtsas", {NULL}, 5070, "tcp"}, -{"vtsas", {NULL}, 5070, "udp"}, -{"powerschool", {NULL}, 5071, "tcp"}, -{"powerschool", {NULL}, 5071, "udp"}, -{"ayiya", {NULL}, 5072, "tcp"}, -{"ayiya", {NULL}, 5072, "udp"}, -{"tag-pm", {NULL}, 5073, "tcp"}, -{"tag-pm", {NULL}, 5073, "udp"}, -{"alesquery", {NULL}, 5074, "tcp"}, -{"alesquery", {NULL}, 5074, "udp"}, -{"cp-spxrpts", {NULL}, 5079, "udp"}, -{"onscreen", {NULL}, 5080, "tcp"}, -{"onscreen", {NULL}, 5080, "udp"}, -{"sdl-ets", {NULL}, 5081, "tcp"}, -{"sdl-ets", {NULL}, 5081, "udp"}, -{"qcp", {NULL}, 5082, "tcp"}, -{"qcp", {NULL}, 5082, "udp"}, -{"qfp", {NULL}, 5083, "tcp"}, -{"qfp", {NULL}, 5083, "udp"}, -{"llrp", {NULL}, 5084, "tcp"}, -{"llrp", {NULL}, 5084, "udp"}, -{"encrypted-llrp", {NULL}, 5085, "tcp"}, -{"encrypted-llrp", {NULL}, 5085, "udp"}, -{"aprigo-cs", {NULL}, 5086, "tcp"}, -{"car", {NULL}, 5090, "sctp"}, -{"cxtp", {NULL}, 5091, "sctp"}, -{"magpie", {NULL}, 5092, "udp"}, -{"sentinel-lm", {NULL}, 5093, "tcp"}, -{"sentinel-lm", {NULL}, 5093, "udp"}, -{"hart-ip", {NULL}, 5094, "tcp"}, -{"hart-ip", {NULL}, 5094, "udp"}, -{"sentlm-srv2srv", {NULL}, 5099, "tcp"}, -{"sentlm-srv2srv", {NULL}, 5099, "udp"}, -{"socalia", {NULL}, 5100, "tcp"}, -{"socalia", {NULL}, 5100, "udp"}, -{"talarian-tcp", {NULL}, 5101, "tcp"}, -{"talarian-udp", {NULL}, 5101, "udp"}, -{"oms-nonsecure", {NULL}, 5102, "tcp"}, -{"oms-nonsecure", {NULL}, 5102, "udp"}, -{"actifio-c2c", {NULL}, 5103, "tcp"}, -{"tinymessage", {NULL}, 5104, "udp"}, -{"hughes-ap", {NULL}, 5105, "udp"}, -{"taep-as-svc", {NULL}, 5111, "tcp"}, -{"taep-as-svc", {NULL}, 5111, "udp"}, -{"pm-cmdsvr", {NULL}, 5112, "tcp"}, -{"pm-cmdsvr", {NULL}, 5112, "udp"}, -{"ev-services", {NULL}, 5114, "tcp"}, -{"autobuild", {NULL}, 5115, "tcp"}, -{"emb-proj-cmd", {NULL}, 5116, "udp"}, -{"gradecam", {NULL}, 5117, "tcp"}, -{"nbt-pc", {NULL}, 5133, "tcp"}, -{"nbt-pc", {NULL}, 5133, "udp"}, -{"ppactivation", {NULL}, 5134, "tcp"}, -{"erp-scale", {NULL}, 5135, "tcp"}, -{"minotaur-sa", {NULL}, 5136, "udp"}, -{"ctsd", {NULL}, 5137, "tcp"}, -{"ctsd", {NULL}, 5137, "udp"}, -{"rmonitor_secure", {NULL}, 5145, "tcp"}, -{"rmonitor_secure", {NULL}, 5145, "udp"}, -{"social-alarm", {NULL}, 5146, "tcp"}, -{"atmp", {NULL}, 5150, "tcp"}, -{"atmp", {NULL}, 5150, "udp"}, -{"esri_sde", {NULL}, 5151, "tcp"}, -{"esri_sde", {NULL}, 5151, "udp"}, -{"sde-discovery", {NULL}, 5152, "tcp"}, -{"sde-discovery", {NULL}, 5152, "udp"}, -{"toruxserver", {NULL}, 5153, "tcp"}, -{"bzflag", {NULL}, 5154, "tcp"}, -{"bzflag", {NULL}, 5154, "udp"}, -{"asctrl-agent", {NULL}, 5155, "tcp"}, -{"asctrl-agent", {NULL}, 5155, "udp"}, -{"rugameonline", {NULL}, 5156, "tcp"}, -{"mediat", {NULL}, 5157, "tcp"}, -{"snmpssh", {NULL}, 5161, "tcp"}, -{"snmpssh-trap", {NULL}, 5162, "tcp"}, -{"sbackup", {NULL}, 5163, "tcp"}, -{"vpa", {NULL}, 5164, "tcp"}, -{"vpa-disc", {NULL}, 5164, "udp"}, -{"ife_icorp", {NULL}, 5165, "tcp"}, -{"ife_icorp", {NULL}, 5165, "udp"}, -{"winpcs", {NULL}, 5166, "tcp"}, -{"winpcs", {NULL}, 5166, "udp"}, -{"scte104", {NULL}, 5167, "tcp"}, -{"scte104", {NULL}, 5167, "udp"}, -{"scte30", {NULL}, 5168, "tcp"}, -{"scte30", {NULL}, 5168, "udp"}, -{"aol", {NULL}, 5190, "tcp"}, -{"aol", {NULL}, 5190, "udp"}, -{"aol-1", {NULL}, 5191, "tcp"}, -{"aol-1", {NULL}, 5191, "udp"}, -{"aol-2", {NULL}, 5192, "tcp"}, -{"aol-2", {NULL}, 5192, "udp"}, -{"aol-3", {NULL}, 5193, "tcp"}, -{"aol-3", {NULL}, 5193, "udp"}, -{"cpscomm", {NULL}, 5194, "tcp"}, -{"targus-getdata", {NULL}, 5200, "tcp"}, -{"targus-getdata", {NULL}, 5200, "udp"}, -{"targus-getdata1", {NULL}, 5201, "tcp"}, -{"targus-getdata1", {NULL}, 5201, "udp"}, -{"targus-getdata2", {NULL}, 5202, "tcp"}, -{"targus-getdata2", {NULL}, 5202, "udp"}, -{"targus-getdata3", {NULL}, 5203, "tcp"}, -{"targus-getdata3", {NULL}, 5203, "udp"}, -{"3exmp", {NULL}, 5221, "tcp"}, -{"xmpp-client", {NULL}, 5222, "tcp"}, -{"hpvirtgrp", {NULL}, 5223, "tcp"}, -{"hpvirtgrp", {NULL}, 5223, "udp"}, -{"hpvirtctrl", {NULL}, 5224, "tcp"}, -{"hpvirtctrl", {NULL}, 5224, "udp"}, -{"hp-server", {NULL}, 5225, "tcp"}, -{"hp-server", {NULL}, 5225, "udp"}, -{"hp-status", {NULL}, 5226, "tcp"}, -{"hp-status", {NULL}, 5226, "udp"}, -{"perfd", {NULL}, 5227, "tcp"}, -{"perfd", {NULL}, 5227, "udp"}, -{"hpvroom", {NULL}, 5228, "tcp"}, -{"csedaemon", {NULL}, 5232, "tcp"}, -{"enfs", {NULL}, 5233, "tcp"}, -{"eenet", {NULL}, 5234, "tcp"}, -{"eenet", {NULL}, 5234, "udp"}, -{"galaxy-network", {NULL}, 5235, "tcp"}, -{"galaxy-network", {NULL}, 5235, "udp"}, -{"padl2sim", {NULL}, 5236, "tcp"}, -{"padl2sim", {NULL}, 5236, "udp"}, -{"mnet-discovery", {NULL}, 5237, "tcp"}, -{"mnet-discovery", {NULL}, 5237, "udp"}, -{"downtools", {NULL}, 5245, "tcp"}, -{"downtools-disc", {NULL}, 5245, "udp"}, -{"capwap-control", {NULL}, 5246, "udp"}, -{"capwap-data", {NULL}, 5247, "udp"}, -{"caacws", {NULL}, 5248, "tcp"}, -{"caacws", {NULL}, 5248, "udp"}, -{"caaclang2", {NULL}, 5249, "tcp"}, -{"caaclang2", {NULL}, 5249, "udp"}, -{"soagateway", {NULL}, 5250, "tcp"}, -{"soagateway", {NULL}, 5250, "udp"}, -{"caevms", {NULL}, 5251, "tcp"}, -{"caevms", {NULL}, 5251, "udp"}, -{"movaz-ssc", {NULL}, 5252, "tcp"}, -{"movaz-ssc", {NULL}, 5252, "udp"}, -{"kpdp", {NULL}, 5253, "tcp"}, -{"3com-njack-1", {NULL}, 5264, "tcp"}, -{"3com-njack-1", {NULL}, 5264, "udp"}, -{"3com-njack-2", {NULL}, 5265, "tcp"}, -{"3com-njack-2", {NULL}, 5265, "udp"}, -{"xmpp-server", {NULL}, 5269, "tcp"}, -{"xmp", {NULL}, 5270, "tcp"}, -{"xmp", {NULL}, 5270, "udp"}, -{"cuelink", {NULL}, 5271, "tcp"}, -{"cuelink-disc", {NULL}, 5271, "udp"}, -{"pk", {NULL}, 5272, "tcp"}, -{"pk", {NULL}, 5272, "udp"}, -{"xmpp-bosh", {NULL}, 5280, "tcp"}, -{"undo-lm", {NULL}, 5281, "tcp"}, -{"transmit-port", {NULL}, 5282, "tcp"}, -{"transmit-port", {NULL}, 5282, "udp"}, -{"presence", {NULL}, 5298, "tcp"}, -{"presence", {NULL}, 5298, "udp"}, -{"nlg-data", {NULL}, 5299, "tcp"}, -{"nlg-data", {NULL}, 5299, "udp"}, -{"hacl-hb", {NULL}, 5300, "tcp"}, -{"hacl-hb", {NULL}, 5300, "udp"}, -{"hacl-gs", {NULL}, 5301, "tcp"}, -{"hacl-gs", {NULL}, 5301, "udp"}, -{"hacl-cfg", {NULL}, 5302, "tcp"}, -{"hacl-cfg", {NULL}, 5302, "udp"}, -{"hacl-probe", {NULL}, 5303, "tcp"}, -{"hacl-probe", {NULL}, 5303, "udp"}, -{"hacl-local", {NULL}, 5304, "tcp"}, -{"hacl-local", {NULL}, 5304, "udp"}, -{"hacl-test", {NULL}, 5305, "tcp"}, -{"hacl-test", {NULL}, 5305, "udp"}, -{"sun-mc-grp", {NULL}, 5306, "tcp"}, -{"sun-mc-grp", {NULL}, 5306, "udp"}, -{"sco-aip", {NULL}, 5307, "tcp"}, -{"sco-aip", {NULL}, 5307, "udp"}, -{"cfengine", {NULL}, 5308, "tcp"}, -{"cfengine", {NULL}, 5308, "udp"}, -{"jprinter", {NULL}, 5309, "tcp"}, -{"jprinter", {NULL}, 5309, "udp"}, -{"outlaws", {NULL}, 5310, "tcp"}, -{"outlaws", {NULL}, 5310, "udp"}, -{"permabit-cs", {NULL}, 5312, "tcp"}, -{"permabit-cs", {NULL}, 5312, "udp"}, -{"rrdp", {NULL}, 5313, "tcp"}, -{"rrdp", {NULL}, 5313, "udp"}, -{"opalis-rbt-ipc", {NULL}, 5314, "tcp"}, -{"opalis-rbt-ipc", {NULL}, 5314, "udp"}, -{"hacl-poll", {NULL}, 5315, "tcp"}, -{"hacl-poll", {NULL}, 5315, "udp"}, -{"hpdevms", {NULL}, 5316, "tcp"}, -{"hpdevms", {NULL}, 5316, "udp"}, -{"bsfserver-zn", {NULL}, 5320, "tcp"}, -{"bsfsvr-zn-ssl", {NULL}, 5321, "tcp"}, -{"kfserver", {NULL}, 5343, "tcp"}, -{"kfserver", {NULL}, 5343, "udp"}, -{"xkotodrcp", {NULL}, 5344, "tcp"}, -{"xkotodrcp", {NULL}, 5344, "udp"}, -{"stuns", {NULL}, 5349, "tcp"}, -{"stuns", {NULL}, 5349, "udp"}, -{"turns", {NULL}, 5349, "tcp"}, -{"turns", {NULL}, 5349, "udp"}, -{"stun-behaviors", {NULL}, 5349, "tcp"}, -{"stun-behaviors", {NULL}, 5349, "udp"}, -{"nat-pmp-status", {NULL}, 5350, "tcp"}, -{"nat-pmp-status", {NULL}, 5350, "udp"}, -{"nat-pmp", {NULL}, 5351, "tcp"}, -{"nat-pmp", {NULL}, 5351, "udp"}, -{"dns-llq", {NULL}, 5352, "tcp"}, -{"dns-llq", {NULL}, 5352, "udp"}, -{"mdns", {NULL}, 5353, "tcp"}, -{"mdns", {NULL}, 5353, "udp"}, -{"mdnsresponder", {NULL}, 5354, "tcp"}, -{"mdnsresponder", {NULL}, 5354, "udp"}, -{"llmnr", {NULL}, 5355, "tcp"}, -{"llmnr", {NULL}, 5355, "udp"}, -{"ms-smlbiz", {NULL}, 5356, "tcp"}, -{"ms-smlbiz", {NULL}, 5356, "udp"}, -{"wsdapi", {NULL}, 5357, "tcp"}, -{"wsdapi", {NULL}, 5357, "udp"}, -{"wsdapi-s", {NULL}, 5358, "tcp"}, -{"wsdapi-s", {NULL}, 5358, "udp"}, -{"ms-alerter", {NULL}, 5359, "tcp"}, -{"ms-alerter", {NULL}, 5359, "udp"}, -{"ms-sideshow", {NULL}, 5360, "tcp"}, -{"ms-sideshow", {NULL}, 5360, "udp"}, -{"ms-s-sideshow", {NULL}, 5361, "tcp"}, -{"ms-s-sideshow", {NULL}, 5361, "udp"}, -{"serverwsd2", {NULL}, 5362, "tcp"}, -{"serverwsd2", {NULL}, 5362, "udp"}, -{"net-projection", {NULL}, 5363, "tcp"}, -{"net-projection", {NULL}, 5363, "udp"}, -{"stresstester", {NULL}, 5397, "tcp"}, -{"stresstester", {NULL}, 5397, "udp"}, -{"elektron-admin", {NULL}, 5398, "tcp"}, -{"elektron-admin", {NULL}, 5398, "udp"}, -{"securitychase", {NULL}, 5399, "tcp"}, -{"securitychase", {NULL}, 5399, "udp"}, -{"excerpt", {NULL}, 5400, "tcp"}, -{"excerpt", {NULL}, 5400, "udp"}, -{"excerpts", {NULL}, 5401, "tcp"}, -{"excerpts", {NULL}, 5401, "udp"}, -{"mftp", {NULL}, 5402, "tcp"}, -{"mftp", {NULL}, 5402, "udp"}, -{"hpoms-ci-lstn", {NULL}, 5403, "tcp"}, -{"hpoms-ci-lstn", {NULL}, 5403, "udp"}, -{"hpoms-dps-lstn", {NULL}, 5404, "tcp"}, -{"hpoms-dps-lstn", {NULL}, 5404, "udp"}, -{"netsupport", {NULL}, 5405, "tcp"}, -{"netsupport", {NULL}, 5405, "udp"}, -{"systemics-sox", {NULL}, 5406, "tcp"}, -{"systemics-sox", {NULL}, 5406, "udp"}, -{"foresyte-clear", {NULL}, 5407, "tcp"}, -{"foresyte-clear", {NULL}, 5407, "udp"}, -{"foresyte-sec", {NULL}, 5408, "tcp"}, -{"foresyte-sec", {NULL}, 5408, "udp"}, -{"salient-dtasrv", {NULL}, 5409, "tcp"}, -{"salient-dtasrv", {NULL}, 5409, "udp"}, -{"salient-usrmgr", {NULL}, 5410, "tcp"}, -{"salient-usrmgr", {NULL}, 5410, "udp"}, -{"actnet", {NULL}, 5411, "tcp"}, -{"actnet", {NULL}, 5411, "udp"}, -{"continuus", {NULL}, 5412, "tcp"}, -{"continuus", {NULL}, 5412, "udp"}, -{"wwiotalk", {NULL}, 5413, "tcp"}, -{"wwiotalk", {NULL}, 5413, "udp"}, -{"statusd", {NULL}, 5414, "tcp"}, -{"statusd", {NULL}, 5414, "udp"}, -{"ns-server", {NULL}, 5415, "tcp"}, -{"ns-server", {NULL}, 5415, "udp"}, -{"sns-gateway", {NULL}, 5416, "tcp"}, -{"sns-gateway", {NULL}, 5416, "udp"}, -{"sns-agent", {NULL}, 5417, "tcp"}, -{"sns-agent", {NULL}, 5417, "udp"}, -{"mcntp", {NULL}, 5418, "tcp"}, -{"mcntp", {NULL}, 5418, "udp"}, -{"dj-ice", {NULL}, 5419, "tcp"}, -{"dj-ice", {NULL}, 5419, "udp"}, -{"cylink-c", {NULL}, 5420, "tcp"}, -{"cylink-c", {NULL}, 5420, "udp"}, -{"netsupport2", {NULL}, 5421, "tcp"}, -{"netsupport2", {NULL}, 5421, "udp"}, -{"salient-mux", {NULL}, 5422, "tcp"}, -{"salient-mux", {NULL}, 5422, "udp"}, -{"virtualuser", {NULL}, 5423, "tcp"}, -{"virtualuser", {NULL}, 5423, "udp"}, -{"beyond-remote", {NULL}, 5424, "tcp"}, -{"beyond-remote", {NULL}, 5424, "udp"}, -{"br-channel", {NULL}, 5425, "tcp"}, -{"br-channel", {NULL}, 5425, "udp"}, -{"devbasic", {NULL}, 5426, "tcp"}, -{"devbasic", {NULL}, 5426, "udp"}, -{"sco-peer-tta", {NULL}, 5427, "tcp"}, -{"sco-peer-tta", {NULL}, 5427, "udp"}, -{"telaconsole", {NULL}, 5428, "tcp"}, -{"telaconsole", {NULL}, 5428, "udp"}, -{"base", {NULL}, 5429, "tcp"}, -{"base", {NULL}, 5429, "udp"}, -{"radec-corp", {NULL}, 5430, "tcp"}, -{"radec-corp", {NULL}, 5430, "udp"}, -{"park-agent", {NULL}, 5431, "tcp"}, -{"park-agent", {NULL}, 5431, "udp"}, -{"postgresql", {NULL}, 5432, "tcp"}, -{"postgresql", {NULL}, 5432, "udp"}, -{"pyrrho", {NULL}, 5433, "tcp"}, -{"pyrrho", {NULL}, 5433, "udp"}, -{"sgi-arrayd", {NULL}, 5434, "tcp"}, -{"sgi-arrayd", {NULL}, 5434, "udp"}, -{"sceanics", {NULL}, 5435, "tcp"}, -{"sceanics", {NULL}, 5435, "udp"}, -{"pmip6-cntl", {NULL}, 5436, "udp"}, -{"pmip6-data", {NULL}, 5437, "udp"}, -{"spss", {NULL}, 5443, "tcp"}, -{"spss", {NULL}, 5443, "udp"}, -{"surebox", {NULL}, 5453, "tcp"}, -{"surebox", {NULL}, 5453, "udp"}, -{"apc-5454", {NULL}, 5454, "tcp"}, -{"apc-5454", {NULL}, 5454, "udp"}, -{"apc-5455", {NULL}, 5455, "tcp"}, -{"apc-5455", {NULL}, 5455, "udp"}, -{"apc-5456", {NULL}, 5456, "tcp"}, -{"apc-5456", {NULL}, 5456, "udp"}, -{"silkmeter", {NULL}, 5461, "tcp"}, -{"silkmeter", {NULL}, 5461, "udp"}, -{"ttl-publisher", {NULL}, 5462, "tcp"}, -{"ttl-publisher", {NULL}, 5462, "udp"}, -{"ttlpriceproxy", {NULL}, 5463, "tcp"}, -{"ttlpriceproxy", {NULL}, 5463, "udp"}, -{"quailnet", {NULL}, 5464, "tcp"}, -{"quailnet", {NULL}, 5464, "udp"}, -{"netops-broker", {NULL}, 5465, "tcp"}, -{"netops-broker", {NULL}, 5465, "udp"}, -{"fcp-addr-srvr1", {NULL}, 5500, "tcp"}, -{"fcp-addr-srvr1", {NULL}, 5500, "udp"}, -{"fcp-addr-srvr2", {NULL}, 5501, "tcp"}, -{"fcp-addr-srvr2", {NULL}, 5501, "udp"}, -{"fcp-srvr-inst1", {NULL}, 5502, "tcp"}, -{"fcp-srvr-inst1", {NULL}, 5502, "udp"}, -{"fcp-srvr-inst2", {NULL}, 5503, "tcp"}, -{"fcp-srvr-inst2", {NULL}, 5503, "udp"}, -{"fcp-cics-gw1", {NULL}, 5504, "tcp"}, -{"fcp-cics-gw1", {NULL}, 5504, "udp"}, -{"checkoutdb", {NULL}, 5505, "tcp"}, -{"checkoutdb", {NULL}, 5505, "udp"}, -{"amc", {NULL}, 5506, "tcp"}, -{"amc", {NULL}, 5506, "udp"}, -{"sgi-eventmond", {NULL}, 5553, "tcp"}, -{"sgi-eventmond", {NULL}, 5553, "udp"}, -{"sgi-esphttp", {NULL}, 5554, "tcp"}, -{"sgi-esphttp", {NULL}, 5554, "udp"}, -{"personal-agent", {NULL}, 5555, "tcp"}, -{"personal-agent", {NULL}, 5555, "udp"}, -{"freeciv", {NULL}, 5556, "tcp"}, -{"freeciv", {NULL}, 5556, "udp"}, -{"farenet", {NULL}, 5557, "tcp"}, -{"westec-connect", {NULL}, 5566, "tcp"}, -{"m-oap", {NULL}, 5567, "tcp"}, -{"m-oap", {NULL}, 5567, "udp"}, -{"sdt", {NULL}, 5568, "tcp"}, -{"sdt", {NULL}, 5568, "udp"}, -{"sdmmp", {NULL}, 5573, "tcp"}, -{"sdmmp", {NULL}, 5573, "udp"}, -{"lsi-bobcat", {NULL}, 5574, "tcp"}, -{"ora-oap", {NULL}, 5575, "tcp"}, -{"fdtracks", {NULL}, 5579, "tcp"}, -{"tmosms0", {NULL}, 5580, "tcp"}, -{"tmosms0", {NULL}, 5580, "udp"}, -{"tmosms1", {NULL}, 5581, "tcp"}, -{"tmosms1", {NULL}, 5581, "udp"}, -{"fac-restore", {NULL}, 5582, "tcp"}, -{"fac-restore", {NULL}, 5582, "udp"}, -{"tmo-icon-sync", {NULL}, 5583, "tcp"}, -{"tmo-icon-sync", {NULL}, 5583, "udp"}, -{"bis-web", {NULL}, 5584, "tcp"}, -{"bis-web", {NULL}, 5584, "udp"}, -{"bis-sync", {NULL}, 5585, "tcp"}, -{"bis-sync", {NULL}, 5585, "udp"}, -{"ininmessaging", {NULL}, 5597, "tcp"}, -{"ininmessaging", {NULL}, 5597, "udp"}, -{"mctfeed", {NULL}, 5598, "tcp"}, -{"mctfeed", {NULL}, 5598, "udp"}, -{"esinstall", {NULL}, 5599, "tcp"}, -{"esinstall", {NULL}, 5599, "udp"}, -{"esmmanager", {NULL}, 5600, "tcp"}, -{"esmmanager", {NULL}, 5600, "udp"}, -{"esmagent", {NULL}, 5601, "tcp"}, -{"esmagent", {NULL}, 5601, "udp"}, -{"a1-msc", {NULL}, 5602, "tcp"}, -{"a1-msc", {NULL}, 5602, "udp"}, -{"a1-bs", {NULL}, 5603, "tcp"}, -{"a1-bs", {NULL}, 5603, "udp"}, -{"a3-sdunode", {NULL}, 5604, "tcp"}, -{"a3-sdunode", {NULL}, 5604, "udp"}, -{"a4-sdunode", {NULL}, 5605, "tcp"}, -{"a4-sdunode", {NULL}, 5605, "udp"}, -{"ninaf", {NULL}, 5627, "tcp"}, -{"ninaf", {NULL}, 5627, "udp"}, -{"htrust", {NULL}, 5628, "tcp"}, -{"htrust", {NULL}, 5628, "udp"}, -{"symantec-sfdb", {NULL}, 5629, "tcp"}, -{"symantec-sfdb", {NULL}, 5629, "udp"}, -{"precise-comm", {NULL}, 5630, "tcp"}, -{"precise-comm", {NULL}, 5630, "udp"}, -{"pcanywheredata", {NULL}, 5631, "tcp"}, -{"pcanywheredata", {NULL}, 5631, "udp"}, -{"pcanywherestat", {NULL}, 5632, "tcp"}, -{"pcanywherestat", {NULL}, 5632, "udp"}, -{"beorl", {NULL}, 5633, "tcp"}, -{"beorl", {NULL}, 5633, "udp"}, -{"xprtld", {NULL}, 5634, "tcp"}, -{"xprtld", {NULL}, 5634, "udp"}, -{"sfmsso", {NULL}, 5635, "tcp"}, -{"sfm-db-server", {NULL}, 5636, "tcp"}, -{"cssc", {NULL}, 5637, "tcp"}, -{"amqps", {NULL}, 5671, "tcp"}, -{"amqps", {NULL}, 5671, "udp"}, -{"amqp", {NULL}, 5672, "tcp"}, -{"amqp", {NULL}, 5672, "udp"}, -{"amqp", {NULL}, 5672, "sctp"}, -{"jms", {NULL}, 5673, "tcp"}, -{"jms", {NULL}, 5673, "udp"}, -{"hyperscsi-port", {NULL}, 5674, "tcp"}, -{"hyperscsi-port", {NULL}, 5674, "udp"}, -{"v5ua", {NULL}, 5675, "tcp"}, -{"v5ua", {NULL}, 5675, "udp"}, -{"v5ua", {NULL}, 5675, "sctp"}, -{"raadmin", {NULL}, 5676, "tcp"}, -{"raadmin", {NULL}, 5676, "udp"}, -{"questdb2-lnchr", {NULL}, 5677, "tcp"}, -{"questdb2-lnchr", {NULL}, 5677, "udp"}, -{"rrac", {NULL}, 5678, "tcp"}, -{"rrac", {NULL}, 5678, "udp"}, -{"dccm", {NULL}, 5679, "tcp"}, -{"dccm", {NULL}, 5679, "udp"}, -{"auriga-router", {NULL}, 5680, "tcp"}, -{"auriga-router", {NULL}, 5680, "udp"}, -{"ncxcp", {NULL}, 5681, "tcp"}, -{"ncxcp", {NULL}, 5681, "udp"}, -{"brightcore", {NULL}, 5682, "udp"}, -{"ggz", {NULL}, 5688, "tcp"}, -{"ggz", {NULL}, 5688, "udp"}, -{"qmvideo", {NULL}, 5689, "tcp"}, -{"qmvideo", {NULL}, 5689, "udp"}, -{"proshareaudio", {NULL}, 5713, "tcp"}, -{"proshareaudio", {NULL}, 5713, "udp"}, -{"prosharevideo", {NULL}, 5714, "tcp"}, -{"prosharevideo", {NULL}, 5714, "udp"}, -{"prosharedata", {NULL}, 5715, "tcp"}, -{"prosharedata", {NULL}, 5715, "udp"}, -{"prosharerequest", {NULL}, 5716, "tcp"}, -{"prosharerequest", {NULL}, 5716, "udp"}, -{"prosharenotify", {NULL}, 5717, "tcp"}, -{"prosharenotify", {NULL}, 5717, "udp"}, -{"dpm", {NULL}, 5718, "tcp"}, -{"dpm", {NULL}, 5718, "udp"}, -{"dpm-agent", {NULL}, 5719, "tcp"}, -{"dpm-agent", {NULL}, 5719, "udp"}, -{"ms-licensing", {NULL}, 5720, "tcp"}, -{"ms-licensing", {NULL}, 5720, "udp"}, -{"dtpt", {NULL}, 5721, "tcp"}, -{"dtpt", {NULL}, 5721, "udp"}, -{"msdfsr", {NULL}, 5722, "tcp"}, -{"msdfsr", {NULL}, 5722, "udp"}, -{"omhs", {NULL}, 5723, "tcp"}, -{"omhs", {NULL}, 5723, "udp"}, -{"omsdk", {NULL}, 5724, "tcp"}, -{"omsdk", {NULL}, 5724, "udp"}, -{"ms-ilm", {NULL}, 5725, "tcp"}, -{"ms-ilm-sts", {NULL}, 5726, "tcp"}, -{"asgenf", {NULL}, 5727, "tcp"}, -{"io-dist-data", {NULL}, 5728, "tcp"}, -{"io-dist-group", {NULL}, 5728, "udp"}, -{"openmail", {NULL}, 5729, "tcp"}, -{"openmail", {NULL}, 5729, "udp"}, -{"unieng", {NULL}, 5730, "tcp"}, -{"unieng", {NULL}, 5730, "udp"}, -{"ida-discover1", {NULL}, 5741, "tcp"}, -{"ida-discover1", {NULL}, 5741, "udp"}, -{"ida-discover2", {NULL}, 5742, "tcp"}, -{"ida-discover2", {NULL}, 5742, "udp"}, -{"watchdoc-pod", {NULL}, 5743, "tcp"}, -{"watchdoc-pod", {NULL}, 5743, "udp"}, -{"watchdoc", {NULL}, 5744, "tcp"}, -{"watchdoc", {NULL}, 5744, "udp"}, -{"fcopy-server", {NULL}, 5745, "tcp"}, -{"fcopy-server", {NULL}, 5745, "udp"}, -{"fcopys-server", {NULL}, 5746, "tcp"}, -{"fcopys-server", {NULL}, 5746, "udp"}, -{"tunatic", {NULL}, 5747, "tcp"}, -{"tunatic", {NULL}, 5747, "udp"}, -{"tunalyzer", {NULL}, 5748, "tcp"}, -{"tunalyzer", {NULL}, 5748, "udp"}, -{"rscd", {NULL}, 5750, "tcp"}, -{"rscd", {NULL}, 5750, "udp"}, -{"openmailg", {NULL}, 5755, "tcp"}, -{"openmailg", {NULL}, 5755, "udp"}, -{"x500ms", {NULL}, 5757, "tcp"}, -{"x500ms", {NULL}, 5757, "udp"}, -{"openmailns", {NULL}, 5766, "tcp"}, -{"openmailns", {NULL}, 5766, "udp"}, -{"s-openmail", {NULL}, 5767, "tcp"}, -{"s-openmail", {NULL}, 5767, "udp"}, -{"openmailpxy", {NULL}, 5768, "tcp"}, -{"openmailpxy", {NULL}, 5768, "udp"}, -{"spramsca", {NULL}, 5769, "tcp"}, -{"spramsca", {NULL}, 5769, "udp"}, -{"spramsd", {NULL}, 5770, "tcp"}, -{"spramsd", {NULL}, 5770, "udp"}, -{"netagent", {NULL}, 5771, "tcp"}, -{"netagent", {NULL}, 5771, "udp"}, -{"dali-port", {NULL}, 5777, "tcp"}, -{"dali-port", {NULL}, 5777, "udp"}, -{"vts-rpc", {NULL}, 5780, "tcp"}, -{"3par-evts", {NULL}, 5781, "tcp"}, -{"3par-evts", {NULL}, 5781, "udp"}, -{"3par-mgmt", {NULL}, 5782, "tcp"}, -{"3par-mgmt", {NULL}, 5782, "udp"}, -{"3par-mgmt-ssl", {NULL}, 5783, "tcp"}, -{"3par-mgmt-ssl", {NULL}, 5783, "udp"}, -{"ibar", {NULL}, 5784, "udp"}, -{"3par-rcopy", {NULL}, 5785, "tcp"}, -{"3par-rcopy", {NULL}, 5785, "udp"}, -{"cisco-redu", {NULL}, 5786, "udp"}, -{"waascluster", {NULL}, 5787, "udp"}, -{"xtreamx", {NULL}, 5793, "tcp"}, -{"xtreamx", {NULL}, 5793, "udp"}, -{"spdp", {NULL}, 5794, "udp"}, -{"icmpd", {NULL}, 5813, "tcp"}, -{"icmpd", {NULL}, 5813, "udp"}, -{"spt-automation", {NULL}, 5814, "tcp"}, -{"spt-automation", {NULL}, 5814, "udp"}, -{"wherehoo", {NULL}, 5859, "tcp"}, -{"wherehoo", {NULL}, 5859, "udp"}, -{"ppsuitemsg", {NULL}, 5863, "tcp"}, -{"ppsuitemsg", {NULL}, 5863, "udp"}, -{"rfb", {NULL}, 5900, "tcp"}, -{"rfb", {NULL}, 5900, "udp"}, -{"cm", {NULL}, 5910, "tcp"}, -{"cm", {NULL}, 5910, "udp"}, -{"cpdlc", {NULL}, 5911, "tcp"}, -{"cpdlc", {NULL}, 5911, "udp"}, -{"fis", {NULL}, 5912, "tcp"}, -{"fis", {NULL}, 5912, "udp"}, -{"ads-c", {NULL}, 5913, "tcp"}, -{"ads-c", {NULL}, 5913, "udp"}, -{"indy", {NULL}, 5963, "tcp"}, -{"indy", {NULL}, 5963, "udp"}, -{"mppolicy-v5", {NULL}, 5968, "tcp"}, -{"mppolicy-v5", {NULL}, 5968, "udp"}, -{"mppolicy-mgr", {NULL}, 5969, "tcp"}, -{"mppolicy-mgr", {NULL}, 5969, "udp"}, -{"couchdb", {NULL}, 5984, "tcp"}, -{"couchdb", {NULL}, 5984, "udp"}, -{"wsman", {NULL}, 5985, "tcp"}, -{"wsman", {NULL}, 5985, "udp"}, -{"wsmans", {NULL}, 5986, "tcp"}, -{"wsmans", {NULL}, 5986, "udp"}, -{"wbem-rmi", {NULL}, 5987, "tcp"}, -{"wbem-rmi", {NULL}, 5987, "udp"}, -{"wbem-http", {NULL}, 5988, "tcp"}, -{"wbem-http", {NULL}, 5988, "udp"}, -{"wbem-https", {NULL}, 5989, "tcp"}, -{"wbem-https", {NULL}, 5989, "udp"}, -{"wbem-exp-https", {NULL}, 5990, "tcp"}, -{"wbem-exp-https", {NULL}, 5990, "udp"}, -{"nuxsl", {NULL}, 5991, "tcp"}, -{"nuxsl", {NULL}, 5991, "udp"}, -{"consul-insight", {NULL}, 5992, "tcp"}, -{"consul-insight", {NULL}, 5992, "udp"}, -{"cvsup", {NULL}, 5999, "tcp"}, -{"cvsup", {NULL}, 5999, "udp"}, -{"ndl-ahp-svc", {NULL}, 6064, "tcp"}, -{"ndl-ahp-svc", {NULL}, 6064, "udp"}, -{"winpharaoh", {NULL}, 6065, "tcp"}, -{"winpharaoh", {NULL}, 6065, "udp"}, -{"ewctsp", {NULL}, 6066, "tcp"}, -{"ewctsp", {NULL}, 6066, "udp"}, -{"gsmp", {NULL}, 6068, "tcp"}, -{"gsmp", {NULL}, 6068, "udp"}, -{"trip", {NULL}, 6069, "tcp"}, -{"trip", {NULL}, 6069, "udp"}, -{"messageasap", {NULL}, 6070, "tcp"}, -{"messageasap", {NULL}, 6070, "udp"}, -{"ssdtp", {NULL}, 6071, "tcp"}, -{"ssdtp", {NULL}, 6071, "udp"}, -{"diagnose-proc", {NULL}, 6072, "tcp"}, -{"diagnose-proc", {NULL}, 6072, "udp"}, -{"directplay8", {NULL}, 6073, "tcp"}, -{"directplay8", {NULL}, 6073, "udp"}, -{"max", {NULL}, 6074, "tcp"}, -{"max", {NULL}, 6074, "udp"}, -{"dpm-acm", {NULL}, 6075, "tcp"}, -{"miami-bcast", {NULL}, 6083, "udp"}, -{"p2p-sip", {NULL}, 6084, "tcp"}, -{"konspire2b", {NULL}, 6085, "tcp"}, -{"konspire2b", {NULL}, 6085, "udp"}, -{"pdtp", {NULL}, 6086, "tcp"}, -{"pdtp", {NULL}, 6086, "udp"}, -{"ldss", {NULL}, 6087, "tcp"}, -{"ldss", {NULL}, 6087, "udp"}, -{"raxa-mgmt", {NULL}, 6099, "tcp"}, -{"synchronet-db", {NULL}, 6100, "tcp"}, -{"synchronet-db", {NULL}, 6100, "udp"}, -{"synchronet-rtc", {NULL}, 6101, "tcp"}, -{"synchronet-rtc", {NULL}, 6101, "udp"}, -{"synchronet-upd", {NULL}, 6102, "tcp"}, -{"synchronet-upd", {NULL}, 6102, "udp"}, -{"rets", {NULL}, 6103, "tcp"}, -{"rets", {NULL}, 6103, "udp"}, -{"dbdb", {NULL}, 6104, "tcp"}, -{"dbdb", {NULL}, 6104, "udp"}, -{"primaserver", {NULL}, 6105, "tcp"}, -{"primaserver", {NULL}, 6105, "udp"}, -{"mpsserver", {NULL}, 6106, "tcp"}, -{"mpsserver", {NULL}, 6106, "udp"}, -{"etc-control", {NULL}, 6107, "tcp"}, -{"etc-control", {NULL}, 6107, "udp"}, -{"sercomm-scadmin", {NULL}, 6108, "tcp"}, -{"sercomm-scadmin", {NULL}, 6108, "udp"}, -{"globecast-id", {NULL}, 6109, "tcp"}, -{"globecast-id", {NULL}, 6109, "udp"}, -{"softcm", {NULL}, 6110, "tcp"}, -{"softcm", {NULL}, 6110, "udp"}, -{"spc", {NULL}, 6111, "tcp"}, -{"spc", {NULL}, 6111, "udp"}, -{"dtspcd", {NULL}, 6112, "tcp"}, -{"dtspcd", {NULL}, 6112, "udp"}, -{"dayliteserver", {NULL}, 6113, "tcp"}, -{"wrspice", {NULL}, 6114, "tcp"}, -{"xic", {NULL}, 6115, "tcp"}, -{"xtlserv", {NULL}, 6116, "tcp"}, -{"daylitetouch", {NULL}, 6117, "tcp"}, -{"spdy", {NULL}, 6121, "tcp"}, -{"bex-webadmin", {NULL}, 6122, "tcp"}, -{"bex-webadmin", {NULL}, 6122, "udp"}, -{"backup-express", {NULL}, 6123, "tcp"}, -{"backup-express", {NULL}, 6123, "udp"}, -{"pnbs", {NULL}, 6124, "tcp"}, -{"pnbs", {NULL}, 6124, "udp"}, -{"nbt-wol", {NULL}, 6133, "tcp"}, -{"nbt-wol", {NULL}, 6133, "udp"}, -{"pulsonixnls", {NULL}, 6140, "tcp"}, -{"pulsonixnls", {NULL}, 6140, "udp"}, -{"meta-corp", {NULL}, 6141, "tcp"}, -{"meta-corp", {NULL}, 6141, "udp"}, -{"aspentec-lm", {NULL}, 6142, "tcp"}, -{"aspentec-lm", {NULL}, 6142, "udp"}, -{"watershed-lm", {NULL}, 6143, "tcp"}, -{"watershed-lm", {NULL}, 6143, "udp"}, -{"statsci1-lm", {NULL}, 6144, "tcp"}, -{"statsci1-lm", {NULL}, 6144, "udp"}, -{"statsci2-lm", {NULL}, 6145, "tcp"}, -{"statsci2-lm", {NULL}, 6145, "udp"}, -{"lonewolf-lm", {NULL}, 6146, "tcp"}, -{"lonewolf-lm", {NULL}, 6146, "udp"}, -{"montage-lm", {NULL}, 6147, "tcp"}, -{"montage-lm", {NULL}, 6147, "udp"}, -{"ricardo-lm", {NULL}, 6148, "tcp"}, -{"ricardo-lm", {NULL}, 6148, "udp"}, -{"tal-pod", {NULL}, 6149, "tcp"}, -{"tal-pod", {NULL}, 6149, "udp"}, -{"efb-aci", {NULL}, 6159, "tcp"}, -{"patrol-ism", {NULL}, 6161, "tcp"}, -{"patrol-ism", {NULL}, 6161, "udp"}, -{"patrol-coll", {NULL}, 6162, "tcp"}, -{"patrol-coll", {NULL}, 6162, "udp"}, -{"pscribe", {NULL}, 6163, "tcp"}, -{"pscribe", {NULL}, 6163, "udp"}, -{"lm-x", {NULL}, 6200, "tcp"}, -{"lm-x", {NULL}, 6200, "udp"}, -{"radmind", {NULL}, 6222, "tcp"}, -{"radmind", {NULL}, 6222, "udp"}, -{"jeol-nsdtp-1", {NULL}, 6241, "tcp"}, -{"jeol-nsddp-1", {NULL}, 6241, "udp"}, -{"jeol-nsdtp-2", {NULL}, 6242, "tcp"}, -{"jeol-nsddp-2", {NULL}, 6242, "udp"}, -{"jeol-nsdtp-3", {NULL}, 6243, "tcp"}, -{"jeol-nsddp-3", {NULL}, 6243, "udp"}, -{"jeol-nsdtp-4", {NULL}, 6244, "tcp"}, -{"jeol-nsddp-4", {NULL}, 6244, "udp"}, -{"tl1-raw-ssl", {NULL}, 6251, "tcp"}, -{"tl1-raw-ssl", {NULL}, 6251, "udp"}, -{"tl1-ssh", {NULL}, 6252, "tcp"}, -{"tl1-ssh", {NULL}, 6252, "udp"}, -{"crip", {NULL}, 6253, "tcp"}, -{"crip", {NULL}, 6253, "udp"}, -{"gld", {NULL}, 6267, "tcp"}, -{"grid", {NULL}, 6268, "tcp"}, -{"grid", {NULL}, 6268, "udp"}, -{"grid-alt", {NULL}, 6269, "tcp"}, -{"grid-alt", {NULL}, 6269, "udp"}, -{"bmc-grx", {NULL}, 6300, "tcp"}, -{"bmc-grx", {NULL}, 6300, "udp"}, -{"bmc_ctd_ldap", {NULL}, 6301, "tcp"}, -{"bmc_ctd_ldap", {NULL}, 6301, "udp"}, -{"ufmp", {NULL}, 6306, "tcp"}, -{"ufmp", {NULL}, 6306, "udp"}, -{"scup", {NULL}, 6315, "tcp"}, -{"scup-disc", {NULL}, 6315, "udp"}, -{"abb-escp", {NULL}, 6316, "tcp"}, -{"abb-escp", {NULL}, 6316, "udp"}, -{"repsvc", {NULL}, 6320, "tcp"}, -{"repsvc", {NULL}, 6320, "udp"}, -{"emp-server1", {NULL}, 6321, "tcp"}, -{"emp-server1", {NULL}, 6321, "udp"}, -{"emp-server2", {NULL}, 6322, "tcp"}, -{"emp-server2", {NULL}, 6322, "udp"}, -{"sflow", {NULL}, 6343, "tcp"}, -{"sflow", {NULL}, 6343, "udp"}, -{"gnutella-svc", {NULL}, 6346, "tcp"}, -{"gnutella-svc", {NULL}, 6346, "udp"}, -{"gnutella-rtr", {NULL}, 6347, "tcp"}, -{"gnutella-rtr", {NULL}, 6347, "udp"}, -{"adap", {NULL}, 6350, "tcp"}, -{"adap", {NULL}, 6350, "udp"}, -{"pmcs", {NULL}, 6355, "tcp"}, -{"pmcs", {NULL}, 6355, "udp"}, -{"metaedit-mu", {NULL}, 6360, "tcp"}, -{"metaedit-mu", {NULL}, 6360, "udp"}, -{"metaedit-se", {NULL}, 6370, "tcp"}, -{"metaedit-se", {NULL}, 6370, "udp"}, -{"metatude-mds", {NULL}, 6382, "tcp"}, -{"metatude-mds", {NULL}, 6382, "udp"}, -{"clariion-evr01", {NULL}, 6389, "tcp"}, -{"clariion-evr01", {NULL}, 6389, "udp"}, -{"metaedit-ws", {NULL}, 6390, "tcp"}, -{"metaedit-ws", {NULL}, 6390, "udp"}, -{"faxcomservice", {NULL}, 6417, "tcp"}, -{"faxcomservice", {NULL}, 6417, "udp"}, -{"syserverremote", {NULL}, 6418, "tcp"}, -{"svdrp", {NULL}, 6419, "tcp"}, -{"nim-vdrshell", {NULL}, 6420, "tcp"}, -{"nim-vdrshell", {NULL}, 6420, "udp"}, -{"nim-wan", {NULL}, 6421, "tcp"}, -{"nim-wan", {NULL}, 6421, "udp"}, -{"pgbouncer", {NULL}, 6432, "tcp"}, -{"sun-sr-https", {NULL}, 6443, "tcp"}, -{"sun-sr-https", {NULL}, 6443, "udp"}, -{"sge_qmaster", {NULL}, 6444, "tcp"}, -{"sge_qmaster", {NULL}, 6444, "udp"}, -{"sge_execd", {NULL}, 6445, "tcp"}, -{"sge_execd", {NULL}, 6445, "udp"}, -{"mysql-proxy", {NULL}, 6446, "tcp"}, -{"mysql-proxy", {NULL}, 6446, "udp"}, -{"skip-cert-recv", {NULL}, 6455, "tcp"}, -{"skip-cert-send", {NULL}, 6456, "udp"}, -{"lvision-lm", {NULL}, 6471, "tcp"}, -{"lvision-lm", {NULL}, 6471, "udp"}, -{"sun-sr-http", {NULL}, 6480, "tcp"}, -{"sun-sr-http", {NULL}, 6480, "udp"}, -{"servicetags", {NULL}, 6481, "tcp"}, -{"servicetags", {NULL}, 6481, "udp"}, -{"ldoms-mgmt", {NULL}, 6482, "tcp"}, -{"ldoms-mgmt", {NULL}, 6482, "udp"}, -{"SunVTS-RMI", {NULL}, 6483, "tcp"}, -{"SunVTS-RMI", {NULL}, 6483, "udp"}, -{"sun-sr-jms", {NULL}, 6484, "tcp"}, -{"sun-sr-jms", {NULL}, 6484, "udp"}, -{"sun-sr-iiop", {NULL}, 6485, "tcp"}, -{"sun-sr-iiop", {NULL}, 6485, "udp"}, -{"sun-sr-iiops", {NULL}, 6486, "tcp"}, -{"sun-sr-iiops", {NULL}, 6486, "udp"}, -{"sun-sr-iiop-aut", {NULL}, 6487, "tcp"}, -{"sun-sr-iiop-aut", {NULL}, 6487, "udp"}, -{"sun-sr-jmx", {NULL}, 6488, "tcp"}, -{"sun-sr-jmx", {NULL}, 6488, "udp"}, -{"sun-sr-admin", {NULL}, 6489, "tcp"}, -{"sun-sr-admin", {NULL}, 6489, "udp"}, -{"boks", {NULL}, 6500, "tcp"}, -{"boks", {NULL}, 6500, "udp"}, -{"boks_servc", {NULL}, 6501, "tcp"}, -{"boks_servc", {NULL}, 6501, "udp"}, -{"boks_servm", {NULL}, 6502, "tcp"}, -{"boks_servm", {NULL}, 6502, "udp"}, -{"boks_clntd", {NULL}, 6503, "tcp"}, -{"boks_clntd", {NULL}, 6503, "udp"}, -{"badm_priv", {NULL}, 6505, "tcp"}, -{"badm_priv", {NULL}, 6505, "udp"}, -{"badm_pub", {NULL}, 6506, "tcp"}, -{"badm_pub", {NULL}, 6506, "udp"}, -{"bdir_priv", {NULL}, 6507, "tcp"}, -{"bdir_priv", {NULL}, 6507, "udp"}, -{"bdir_pub", {NULL}, 6508, "tcp"}, -{"bdir_pub", {NULL}, 6508, "udp"}, -{"mgcs-mfp-port", {NULL}, 6509, "tcp"}, -{"mgcs-mfp-port", {NULL}, 6509, "udp"}, -{"mcer-port", {NULL}, 6510, "tcp"}, -{"mcer-port", {NULL}, 6510, "udp"}, -{"netconf-tls", {NULL}, 6513, "tcp"}, -{"syslog-tls", {NULL}, 6514, "tcp"}, -{"syslog-tls", {NULL}, 6514, "udp"}, -{"syslog-tls", {NULL}, 6514, "dccp"}, -{"elipse-rec", {NULL}, 6515, "tcp"}, -{"elipse-rec", {NULL}, 6515, "udp"}, -{"lds-distrib", {NULL}, 6543, "tcp"}, -{"lds-distrib", {NULL}, 6543, "udp"}, -{"lds-dump", {NULL}, 6544, "tcp"}, -{"lds-dump", {NULL}, 6544, "udp"}, -{"apc-6547", {NULL}, 6547, "tcp"}, -{"apc-6547", {NULL}, 6547, "udp"}, -{"apc-6548", {NULL}, 6548, "tcp"}, -{"apc-6548", {NULL}, 6548, "udp"}, -{"apc-6549", {NULL}, 6549, "tcp"}, -{"apc-6549", {NULL}, 6549, "udp"}, -{"fg-sysupdate", {NULL}, 6550, "tcp"}, -{"fg-sysupdate", {NULL}, 6550, "udp"}, -{"sum", {NULL}, 6551, "tcp"}, -{"sum", {NULL}, 6551, "udp"}, -{"xdsxdm", {NULL}, 6558, "tcp"}, -{"xdsxdm", {NULL}, 6558, "udp"}, -{"sane-port", {NULL}, 6566, "tcp"}, -{"sane-port", {NULL}, 6566, "udp"}, -{"esp", {NULL}, 6567, "tcp"}, -{"esp", {NULL}, 6567, "udp"}, -{"canit_store", {NULL}, 6568, "tcp"}, -{"rp-reputation", {NULL}, 6568, "udp"}, -{"affiliate", {NULL}, 6579, "tcp"}, -{"affiliate", {NULL}, 6579, "udp"}, -{"parsec-master", {NULL}, 6580, "tcp"}, -{"parsec-master", {NULL}, 6580, "udp"}, -{"parsec-peer", {NULL}, 6581, "tcp"}, -{"parsec-peer", {NULL}, 6581, "udp"}, -{"parsec-game", {NULL}, 6582, "tcp"}, -{"parsec-game", {NULL}, 6582, "udp"}, -{"joaJewelSuite", {NULL}, 6583, "tcp"}, -{"joaJewelSuite", {NULL}, 6583, "udp"}, -{"mshvlm", {NULL}, 6600, "tcp"}, -{"mstmg-sstp", {NULL}, 6601, "tcp"}, -{"wsscomfrmwk", {NULL}, 6602, "tcp"}, -{"odette-ftps", {NULL}, 6619, "tcp"}, -{"odette-ftps", {NULL}, 6619, "udp"}, -{"kftp-data", {NULL}, 6620, "tcp"}, -{"kftp-data", {NULL}, 6620, "udp"}, -{"kftp", {NULL}, 6621, "tcp"}, -{"kftp", {NULL}, 6621, "udp"}, -{"mcftp", {NULL}, 6622, "tcp"}, -{"mcftp", {NULL}, 6622, "udp"}, -{"ktelnet", {NULL}, 6623, "tcp"}, -{"ktelnet", {NULL}, 6623, "udp"}, -{"datascaler-db", {NULL}, 6624, "tcp"}, -{"datascaler-ctl", {NULL}, 6625, "tcp"}, -{"wago-service", {NULL}, 6626, "tcp"}, -{"wago-service", {NULL}, 6626, "udp"}, -{"nexgen", {NULL}, 6627, "tcp"}, -{"nexgen", {NULL}, 6627, "udp"}, -{"afesc-mc", {NULL}, 6628, "tcp"}, -{"afesc-mc", {NULL}, 6628, "udp"}, -{"mxodbc-connect", {NULL}, 6632, "tcp"}, -{"pcs-sf-ui-man", {NULL}, 6655, "tcp"}, -{"emgmsg", {NULL}, 6656, "tcp"}, -{"palcom-disc", {NULL}, 6657, "udp"}, -{"vocaltec-gold", {NULL}, 6670, "tcp"}, -{"vocaltec-gold", {NULL}, 6670, "udp"}, -{"p4p-portal", {NULL}, 6671, "tcp"}, -{"p4p-portal", {NULL}, 6671, "udp"}, -{"vision_server", {NULL}, 6672, "tcp"}, -{"vision_server", {NULL}, 6672, "udp"}, -{"vision_elmd", {NULL}, 6673, "tcp"}, -{"vision_elmd", {NULL}, 6673, "udp"}, -{"vfbp", {NULL}, 6678, "tcp"}, -{"vfbp-disc", {NULL}, 6678, "udp"}, -{"osaut", {NULL}, 6679, "tcp"}, -{"osaut", {NULL}, 6679, "udp"}, -{"clever-ctrace", {NULL}, 6687, "tcp"}, -{"clever-tcpip", {NULL}, 6688, "tcp"}, -{"tsa", {NULL}, 6689, "tcp"}, -{"tsa", {NULL}, 6689, "udp"}, -{"babel", {NULL}, 6697, "udp"}, -{"kti-icad-srvr", {NULL}, 6701, "tcp"}, -{"kti-icad-srvr", {NULL}, 6701, "udp"}, -{"e-design-net", {NULL}, 6702, "tcp"}, -{"e-design-net", {NULL}, 6702, "udp"}, -{"e-design-web", {NULL}, 6703, "tcp"}, -{"e-design-web", {NULL}, 6703, "udp"}, -{"frc-hp", {NULL}, 6704, "sctp"}, -{"frc-mp", {NULL}, 6705, "sctp"}, -{"frc-lp", {NULL}, 6706, "sctp"}, -{"ibprotocol", {NULL}, 6714, "tcp"}, -{"ibprotocol", {NULL}, 6714, "udp"}, -{"fibotrader-com", {NULL}, 6715, "tcp"}, -{"fibotrader-com", {NULL}, 6715, "udp"}, -{"bmc-perf-agent", {NULL}, 6767, "tcp"}, -{"bmc-perf-agent", {NULL}, 6767, "udp"}, -{"bmc-perf-mgrd", {NULL}, 6768, "tcp"}, -{"bmc-perf-mgrd", {NULL}, 6768, "udp"}, -{"adi-gxp-srvprt", {NULL}, 6769, "tcp"}, -{"adi-gxp-srvprt", {NULL}, 6769, "udp"}, -{"plysrv-http", {NULL}, 6770, "tcp"}, -{"plysrv-http", {NULL}, 6770, "udp"}, -{"plysrv-https", {NULL}, 6771, "tcp"}, -{"plysrv-https", {NULL}, 6771, "udp"}, -{"dgpf-exchg", {NULL}, 6785, "tcp"}, -{"dgpf-exchg", {NULL}, 6785, "udp"}, -{"smc-jmx", {NULL}, 6786, "tcp"}, -{"smc-jmx", {NULL}, 6786, "udp"}, -{"smc-admin", {NULL}, 6787, "tcp"}, -{"smc-admin", {NULL}, 6787, "udp"}, -{"smc-http", {NULL}, 6788, "tcp"}, -{"smc-http", {NULL}, 6788, "udp"}, -{"smc-https", {NULL}, 6789, "tcp"}, -{"smc-https", {NULL}, 6789, "udp"}, -{"hnmp", {NULL}, 6790, "tcp"}, -{"hnmp", {NULL}, 6790, "udp"}, -{"hnm", {NULL}, 6791, "tcp"}, -{"hnm", {NULL}, 6791, "udp"}, -{"acnet", {NULL}, 6801, "tcp"}, -{"acnet", {NULL}, 6801, "udp"}, -{"pentbox-sim", {NULL}, 6817, "tcp"}, -{"ambit-lm", {NULL}, 6831, "tcp"}, -{"ambit-lm", {NULL}, 6831, "udp"}, -{"netmo-default", {NULL}, 6841, "tcp"}, -{"netmo-default", {NULL}, 6841, "udp"}, -{"netmo-http", {NULL}, 6842, "tcp"}, -{"netmo-http", {NULL}, 6842, "udp"}, -{"iccrushmore", {NULL}, 6850, "tcp"}, -{"iccrushmore", {NULL}, 6850, "udp"}, -{"acctopus-cc", {NULL}, 6868, "tcp"}, -{"acctopus-st", {NULL}, 6868, "udp"}, -{"muse", {NULL}, 6888, "tcp"}, -{"muse", {NULL}, 6888, "udp"}, -{"jetstream", {NULL}, 6901, "tcp"}, -{"xsmsvc", {NULL}, 6936, "tcp"}, -{"xsmsvc", {NULL}, 6936, "udp"}, -{"bioserver", {NULL}, 6946, "tcp"}, -{"bioserver", {NULL}, 6946, "udp"}, -{"otlp", {NULL}, 6951, "tcp"}, -{"otlp", {NULL}, 6951, "udp"}, -{"jmact3", {NULL}, 6961, "tcp"}, -{"jmact3", {NULL}, 6961, "udp"}, -{"jmevt2", {NULL}, 6962, "tcp"}, -{"jmevt2", {NULL}, 6962, "udp"}, -{"swismgr1", {NULL}, 6963, "tcp"}, -{"swismgr1", {NULL}, 6963, "udp"}, -{"swismgr2", {NULL}, 6964, "tcp"}, -{"swismgr2", {NULL}, 6964, "udp"}, -{"swistrap", {NULL}, 6965, "tcp"}, -{"swistrap", {NULL}, 6965, "udp"}, -{"swispol", {NULL}, 6966, "tcp"}, -{"swispol", {NULL}, 6966, "udp"}, -{"acmsoda", {NULL}, 6969, "tcp"}, -{"acmsoda", {NULL}, 6969, "udp"}, -{"MobilitySrv", {NULL}, 6997, "tcp"}, -{"MobilitySrv", {NULL}, 6997, "udp"}, -{"iatp-highpri", {NULL}, 6998, "tcp"}, -{"iatp-highpri", {NULL}, 6998, "udp"}, -{"iatp-normalpri", {NULL}, 6999, "tcp"}, -{"iatp-normalpri", {NULL}, 6999, "udp"}, -{"afs3-fileserver", {NULL}, 7000, "tcp"}, -{"afs3-fileserver", {NULL}, 7000, "udp"}, -{"afs3-callback", {NULL}, 7001, "tcp"}, -{"afs3-callback", {NULL}, 7001, "udp"}, -{"afs3-prserver", {NULL}, 7002, "tcp"}, -{"afs3-prserver", {NULL}, 7002, "udp"}, -{"afs3-vlserver", {NULL}, 7003, "tcp"}, -{"afs3-vlserver", {NULL}, 7003, "udp"}, -{"afs3-kaserver", {NULL}, 7004, "tcp"}, -{"afs3-kaserver", {NULL}, 7004, "udp"}, -{"afs3-volser", {NULL}, 7005, "tcp"}, -{"afs3-volser", {NULL}, 7005, "udp"}, -{"afs3-errors", {NULL}, 7006, "tcp"}, -{"afs3-errors", {NULL}, 7006, "udp"}, -{"afs3-bos", {NULL}, 7007, "tcp"}, -{"afs3-bos", {NULL}, 7007, "udp"}, -{"afs3-update", {NULL}, 7008, "tcp"}, -{"afs3-update", {NULL}, 7008, "udp"}, -{"afs3-rmtsys", {NULL}, 7009, "tcp"}, -{"afs3-rmtsys", {NULL}, 7009, "udp"}, -{"ups-onlinet", {NULL}, 7010, "tcp"}, -{"ups-onlinet", {NULL}, 7010, "udp"}, -{"talon-disc", {NULL}, 7011, "tcp"}, -{"talon-disc", {NULL}, 7011, "udp"}, -{"talon-engine", {NULL}, 7012, "tcp"}, -{"talon-engine", {NULL}, 7012, "udp"}, -{"microtalon-dis", {NULL}, 7013, "tcp"}, -{"microtalon-dis", {NULL}, 7013, "udp"}, -{"microtalon-com", {NULL}, 7014, "tcp"}, -{"microtalon-com", {NULL}, 7014, "udp"}, -{"talon-webserver", {NULL}, 7015, "tcp"}, -{"talon-webserver", {NULL}, 7015, "udp"}, -{"dpserve", {NULL}, 7020, "tcp"}, -{"dpserve", {NULL}, 7020, "udp"}, -{"dpserveadmin", {NULL}, 7021, "tcp"}, -{"dpserveadmin", {NULL}, 7021, "udp"}, -{"ctdp", {NULL}, 7022, "tcp"}, -{"ctdp", {NULL}, 7022, "udp"}, -{"ct2nmcs", {NULL}, 7023, "tcp"}, -{"ct2nmcs", {NULL}, 7023, "udp"}, -{"vmsvc", {NULL}, 7024, "tcp"}, -{"vmsvc", {NULL}, 7024, "udp"}, -{"vmsvc-2", {NULL}, 7025, "tcp"}, -{"vmsvc-2", {NULL}, 7025, "udp"}, -{"op-probe", {NULL}, 7030, "tcp"}, -{"op-probe", {NULL}, 7030, "udp"}, -{"arcp", {NULL}, 7070, "tcp"}, -{"arcp", {NULL}, 7070, "udp"}, -{"iwg1", {NULL}, 7071, "tcp"}, -{"iwg1", {NULL}, 7071, "udp"}, -{"empowerid", {NULL}, 7080, "tcp"}, -{"empowerid", {NULL}, 7080, "udp"}, -{"lazy-ptop", {NULL}, 7099, "tcp"}, -{"lazy-ptop", {NULL}, 7099, "udp"}, -{"font-service", {NULL}, 7100, "tcp"}, -{"font-service", {NULL}, 7100, "udp"}, -{"elcn", {NULL}, 7101, "tcp"}, -{"elcn", {NULL}, 7101, "udp"}, -{"aes-x170", {NULL}, 7107, "udp"}, -{"virprot-lm", {NULL}, 7121, "tcp"}, -{"virprot-lm", {NULL}, 7121, "udp"}, -{"scenidm", {NULL}, 7128, "tcp"}, -{"scenidm", {NULL}, 7128, "udp"}, -{"scenccs", {NULL}, 7129, "tcp"}, -{"scenccs", {NULL}, 7129, "udp"}, -{"cabsm-comm", {NULL}, 7161, "tcp"}, -{"cabsm-comm", {NULL}, 7161, "udp"}, -{"caistoragemgr", {NULL}, 7162, "tcp"}, -{"caistoragemgr", {NULL}, 7162, "udp"}, -{"cacsambroker", {NULL}, 7163, "tcp"}, -{"cacsambroker", {NULL}, 7163, "udp"}, -{"fsr", {NULL}, 7164, "tcp"}, -{"fsr", {NULL}, 7164, "udp"}, -{"doc-server", {NULL}, 7165, "tcp"}, -{"doc-server", {NULL}, 7165, "udp"}, -{"aruba-server", {NULL}, 7166, "tcp"}, -{"aruba-server", {NULL}, 7166, "udp"}, -{"casrmagent", {NULL}, 7167, "tcp"}, -{"cnckadserver", {NULL}, 7168, "tcp"}, -{"ccag-pib", {NULL}, 7169, "tcp"}, -{"ccag-pib", {NULL}, 7169, "udp"}, -{"nsrp", {NULL}, 7170, "tcp"}, -{"nsrp", {NULL}, 7170, "udp"}, -{"drm-production", {NULL}, 7171, "tcp"}, -{"drm-production", {NULL}, 7171, "udp"}, -{"zsecure", {NULL}, 7173, "tcp"}, -{"clutild", {NULL}, 7174, "tcp"}, -{"clutild", {NULL}, 7174, "udp"}, -{"fodms", {NULL}, 7200, "tcp"}, -{"fodms", {NULL}, 7200, "udp"}, -{"dlip", {NULL}, 7201, "tcp"}, -{"dlip", {NULL}, 7201, "udp"}, -{"ramp", {NULL}, 7227, "tcp"}, -{"ramp", {NULL}, 7227, "udp"}, -{"citrixupp", {NULL}, 7228, "tcp"}, -{"citrixuppg", {NULL}, 7229, "tcp"}, -{"pads", {NULL}, 7237, "tcp"}, -{"cnap", {NULL}, 7262, "tcp"}, -{"cnap", {NULL}, 7262, "udp"}, -{"watchme-7272", {NULL}, 7272, "tcp"}, -{"watchme-7272", {NULL}, 7272, "udp"}, -{"oma-rlp", {NULL}, 7273, "tcp"}, -{"oma-rlp", {NULL}, 7273, "udp"}, -{"oma-rlp-s", {NULL}, 7274, "tcp"}, -{"oma-rlp-s", {NULL}, 7274, "udp"}, -{"oma-ulp", {NULL}, 7275, "tcp"}, -{"oma-ulp", {NULL}, 7275, "udp"}, -{"oma-ilp", {NULL}, 7276, "tcp"}, -{"oma-ilp", {NULL}, 7276, "udp"}, -{"oma-ilp-s", {NULL}, 7277, "tcp"}, -{"oma-ilp-s", {NULL}, 7277, "udp"}, -{"oma-dcdocbs", {NULL}, 7278, "tcp"}, -{"oma-dcdocbs", {NULL}, 7278, "udp"}, -{"ctxlic", {NULL}, 7279, "tcp"}, -{"ctxlic", {NULL}, 7279, "udp"}, -{"itactionserver1", {NULL}, 7280, "tcp"}, -{"itactionserver1", {NULL}, 7280, "udp"}, -{"itactionserver2", {NULL}, 7281, "tcp"}, -{"itactionserver2", {NULL}, 7281, "udp"}, -{"mzca-action", {NULL}, 7282, "tcp"}, -{"mzca-alert", {NULL}, 7282, "udp"}, -{"lcm-server", {NULL}, 7365, "tcp"}, -{"lcm-server", {NULL}, 7365, "udp"}, -{"mindfilesys", {NULL}, 7391, "tcp"}, -{"mindfilesys", {NULL}, 7391, "udp"}, -{"mrssrendezvous", {NULL}, 7392, "tcp"}, -{"mrssrendezvous", {NULL}, 7392, "udp"}, -{"nfoldman", {NULL}, 7393, "tcp"}, -{"nfoldman", {NULL}, 7393, "udp"}, -{"fse", {NULL}, 7394, "tcp"}, -{"fse", {NULL}, 7394, "udp"}, -{"winqedit", {NULL}, 7395, "tcp"}, -{"winqedit", {NULL}, 7395, "udp"}, -{"hexarc", {NULL}, 7397, "tcp"}, -{"hexarc", {NULL}, 7397, "udp"}, -{"rtps-discovery", {NULL}, 7400, "tcp"}, -{"rtps-discovery", {NULL}, 7400, "udp"}, -{"rtps-dd-ut", {NULL}, 7401, "tcp"}, -{"rtps-dd-ut", {NULL}, 7401, "udp"}, -{"rtps-dd-mt", {NULL}, 7402, "tcp"}, -{"rtps-dd-mt", {NULL}, 7402, "udp"}, -{"ionixnetmon", {NULL}, 7410, "tcp"}, -{"ionixnetmon", {NULL}, 7410, "udp"}, -{"mtportmon", {NULL}, 7421, "tcp"}, -{"mtportmon", {NULL}, 7421, "udp"}, -{"pmdmgr", {NULL}, 7426, "tcp"}, -{"pmdmgr", {NULL}, 7426, "udp"}, -{"oveadmgr", {NULL}, 7427, "tcp"}, -{"oveadmgr", {NULL}, 7427, "udp"}, -{"ovladmgr", {NULL}, 7428, "tcp"}, -{"ovladmgr", {NULL}, 7428, "udp"}, -{"opi-sock", {NULL}, 7429, "tcp"}, -{"opi-sock", {NULL}, 7429, "udp"}, -{"xmpv7", {NULL}, 7430, "tcp"}, -{"xmpv7", {NULL}, 7430, "udp"}, -{"pmd", {NULL}, 7431, "tcp"}, -{"pmd", {NULL}, 7431, "udp"}, -{"faximum", {NULL}, 7437, "tcp"}, -{"faximum", {NULL}, 7437, "udp"}, -{"oracleas-https", {NULL}, 7443, "tcp"}, -{"oracleas-https", {NULL}, 7443, "udp"}, -{"rise", {NULL}, 7473, "tcp"}, -{"rise", {NULL}, 7473, "udp"}, -{"telops-lmd", {NULL}, 7491, "tcp"}, -{"telops-lmd", {NULL}, 7491, "udp"}, -{"silhouette", {NULL}, 7500, "tcp"}, -{"silhouette", {NULL}, 7500, "udp"}, -{"ovbus", {NULL}, 7501, "tcp"}, -{"ovbus", {NULL}, 7501, "udp"}, -{"acplt", {NULL}, 7509, "tcp"}, -{"ovhpas", {NULL}, 7510, "tcp"}, -{"ovhpas", {NULL}, 7510, "udp"}, -{"pafec-lm", {NULL}, 7511, "tcp"}, -{"pafec-lm", {NULL}, 7511, "udp"}, -{"saratoga", {NULL}, 7542, "tcp"}, -{"saratoga", {NULL}, 7542, "udp"}, -{"atul", {NULL}, 7543, "tcp"}, -{"atul", {NULL}, 7543, "udp"}, -{"nta-ds", {NULL}, 7544, "tcp"}, -{"nta-ds", {NULL}, 7544, "udp"}, -{"nta-us", {NULL}, 7545, "tcp"}, -{"nta-us", {NULL}, 7545, "udp"}, -{"cfs", {NULL}, 7546, "tcp"}, -{"cfs", {NULL}, 7546, "udp"}, -{"cwmp", {NULL}, 7547, "tcp"}, -{"cwmp", {NULL}, 7547, "udp"}, -{"tidp", {NULL}, 7548, "tcp"}, -{"tidp", {NULL}, 7548, "udp"}, -{"nls-tl", {NULL}, 7549, "tcp"}, -{"nls-tl", {NULL}, 7549, "udp"}, -{"sncp", {NULL}, 7560, "tcp"}, -{"sncp", {NULL}, 7560, "udp"}, -{"cfw", {NULL}, 7563, "tcp"}, -{"vsi-omega", {NULL}, 7566, "tcp"}, -{"vsi-omega", {NULL}, 7566, "udp"}, -{"dell-eql-asm", {NULL}, 7569, "tcp"}, -{"aries-kfinder", {NULL}, 7570, "tcp"}, -{"aries-kfinder", {NULL}, 7570, "udp"}, -{"sun-lm", {NULL}, 7588, "tcp"}, -{"sun-lm", {NULL}, 7588, "udp"}, -{"indi", {NULL}, 7624, "tcp"}, -{"indi", {NULL}, 7624, "udp"}, -{"simco", {NULL}, 7626, "tcp"}, -{"simco", {NULL}, 7626, "sctp"}, -{"soap-http", {NULL}, 7627, "tcp"}, -{"soap-http", {NULL}, 7627, "udp"}, -{"zen-pawn", {NULL}, 7628, "tcp"}, -{"zen-pawn", {NULL}, 7628, "udp"}, -{"xdas", {NULL}, 7629, "tcp"}, -{"xdas", {NULL}, 7629, "udp"}, -{"hawk", {NULL}, 7630, "tcp"}, -{"tesla-sys-msg", {NULL}, 7631, "tcp"}, -{"pmdfmgt", {NULL}, 7633, "tcp"}, -{"pmdfmgt", {NULL}, 7633, "udp"}, -{"cuseeme", {NULL}, 7648, "tcp"}, -{"cuseeme", {NULL}, 7648, "udp"}, -{"imqstomp", {NULL}, 7672, "tcp"}, -{"imqstomps", {NULL}, 7673, "tcp"}, -{"imqtunnels", {NULL}, 7674, "tcp"}, -{"imqtunnels", {NULL}, 7674, "udp"}, -{"imqtunnel", {NULL}, 7675, "tcp"}, -{"imqtunnel", {NULL}, 7675, "udp"}, -{"imqbrokerd", {NULL}, 7676, "tcp"}, -{"imqbrokerd", {NULL}, 7676, "udp"}, -{"sun-user-https", {NULL}, 7677, "tcp"}, -{"sun-user-https", {NULL}, 7677, "udp"}, -{"pando-pub", {NULL}, 7680, "tcp"}, -{"pando-pub", {NULL}, 7680, "udp"}, -{"collaber", {NULL}, 7689, "tcp"}, -{"collaber", {NULL}, 7689, "udp"}, -{"klio", {NULL}, 7697, "tcp"}, -{"klio", {NULL}, 7697, "udp"}, -{"em7-secom", {NULL}, 7700, "tcp"}, -{"sync-em7", {NULL}, 7707, "tcp"}, -{"sync-em7", {NULL}, 7707, "udp"}, -{"scinet", {NULL}, 7708, "tcp"}, -{"scinet", {NULL}, 7708, "udp"}, -{"medimageportal", {NULL}, 7720, "tcp"}, -{"medimageportal", {NULL}, 7720, "udp"}, -{"nsdeepfreezectl", {NULL}, 7724, "tcp"}, -{"nsdeepfreezectl", {NULL}, 7724, "udp"}, -{"nitrogen", {NULL}, 7725, "tcp"}, -{"nitrogen", {NULL}, 7725, "udp"}, -{"freezexservice", {NULL}, 7726, "tcp"}, -{"freezexservice", {NULL}, 7726, "udp"}, -{"trident-data", {NULL}, 7727, "tcp"}, -{"trident-data", {NULL}, 7727, "udp"}, -{"smip", {NULL}, 7734, "tcp"}, -{"smip", {NULL}, 7734, "udp"}, -{"aiagent", {NULL}, 7738, "tcp"}, -{"aiagent", {NULL}, 7738, "udp"}, -{"scriptview", {NULL}, 7741, "tcp"}, -{"scriptview", {NULL}, 7741, "udp"}, -{"msss", {NULL}, 7742, "tcp"}, -{"sstp-1", {NULL}, 7743, "tcp"}, -{"sstp-1", {NULL}, 7743, "udp"}, -{"raqmon-pdu", {NULL}, 7744, "tcp"}, -{"raqmon-pdu", {NULL}, 7744, "udp"}, -{"prgp", {NULL}, 7747, "tcp"}, -{"prgp", {NULL}, 7747, "udp"}, -{"cbt", {NULL}, 7777, "tcp"}, -{"cbt", {NULL}, 7777, "udp"}, -{"interwise", {NULL}, 7778, "tcp"}, -{"interwise", {NULL}, 7778, "udp"}, -{"vstat", {NULL}, 7779, "tcp"}, -{"vstat", {NULL}, 7779, "udp"}, -{"accu-lmgr", {NULL}, 7781, "tcp"}, -{"accu-lmgr", {NULL}, 7781, "udp"}, -{"minivend", {NULL}, 7786, "tcp"}, -{"minivend", {NULL}, 7786, "udp"}, -{"popup-reminders", {NULL}, 7787, "tcp"}, -{"popup-reminders", {NULL}, 7787, "udp"}, -{"office-tools", {NULL}, 7789, "tcp"}, -{"office-tools", {NULL}, 7789, "udp"}, -{"q3ade", {NULL}, 7794, "tcp"}, -{"q3ade", {NULL}, 7794, "udp"}, -{"pnet-conn", {NULL}, 7797, "tcp"}, -{"pnet-conn", {NULL}, 7797, "udp"}, -{"pnet-enc", {NULL}, 7798, "tcp"}, -{"pnet-enc", {NULL}, 7798, "udp"}, -{"altbsdp", {NULL}, 7799, "tcp"}, -{"altbsdp", {NULL}, 7799, "udp"}, -{"asr", {NULL}, 7800, "tcp"}, -{"asr", {NULL}, 7800, "udp"}, -{"ssp-client", {NULL}, 7801, "tcp"}, -{"ssp-client", {NULL}, 7801, "udp"}, -{"rbt-wanopt", {NULL}, 7810, "tcp"}, -{"rbt-wanopt", {NULL}, 7810, "udp"}, -{"apc-7845", {NULL}, 7845, "tcp"}, -{"apc-7845", {NULL}, 7845, "udp"}, -{"apc-7846", {NULL}, 7846, "tcp"}, -{"apc-7846", {NULL}, 7846, "udp"}, -{"mobileanalyzer", {NULL}, 7869, "tcp"}, -{"rbt-smc", {NULL}, 7870, "tcp"}, -{"pss", {NULL}, 7880, "tcp"}, -{"pss", {NULL}, 7880, "udp"}, -{"ubroker", {NULL}, 7887, "tcp"}, -{"ubroker", {NULL}, 7887, "udp"}, -{"mevent", {NULL}, 7900, "tcp"}, -{"mevent", {NULL}, 7900, "udp"}, -{"tnos-sp", {NULL}, 7901, "tcp"}, -{"tnos-sp", {NULL}, 7901, "udp"}, -{"tnos-dp", {NULL}, 7902, "tcp"}, -{"tnos-dp", {NULL}, 7902, "udp"}, -{"tnos-dps", {NULL}, 7903, "tcp"}, -{"tnos-dps", {NULL}, 7903, "udp"}, -{"qo-secure", {NULL}, 7913, "tcp"}, -{"qo-secure", {NULL}, 7913, "udp"}, -{"t2-drm", {NULL}, 7932, "tcp"}, -{"t2-drm", {NULL}, 7932, "udp"}, -{"t2-brm", {NULL}, 7933, "tcp"}, -{"t2-brm", {NULL}, 7933, "udp"}, -{"supercell", {NULL}, 7967, "tcp"}, -{"supercell", {NULL}, 7967, "udp"}, -{"micromuse-ncps", {NULL}, 7979, "tcp"}, -{"micromuse-ncps", {NULL}, 7979, "udp"}, -{"quest-vista", {NULL}, 7980, "tcp"}, -{"quest-vista", {NULL}, 7980, "udp"}, -{"sossd-collect", {NULL}, 7981, "tcp"}, -{"sossd-agent", {NULL}, 7982, "tcp"}, -{"sossd-disc", {NULL}, 7982, "udp"}, -{"pushns", {NULL}, 7997, "tcp"}, -{"usicontentpush", {NULL}, 7998, "udp"}, -{"irdmi2", {NULL}, 7999, "tcp"}, -{"irdmi2", {NULL}, 7999, "udp"}, -{"irdmi", {NULL}, 8000, "tcp"}, -{"irdmi", {NULL}, 8000, "udp"}, -{"vcom-tunnel", {NULL}, 8001, "tcp"}, -{"vcom-tunnel", {NULL}, 8001, "udp"}, -{"teradataordbms", {NULL}, 8002, "tcp"}, -{"teradataordbms", {NULL}, 8002, "udp"}, -{"mcreport", {NULL}, 8003, "tcp"}, -{"mcreport", {NULL}, 8003, "udp"}, -{"mxi", {NULL}, 8005, "tcp"}, -{"mxi", {NULL}, 8005, "udp"}, -{"http-alt", {NULL}, 8008, "tcp"}, -{"http-alt", {NULL}, 8008, "udp"}, -{"qbdb", {NULL}, 8019, "tcp"}, -{"qbdb", {NULL}, 8019, "udp"}, -{"intu-ec-svcdisc", {NULL}, 8020, "tcp"}, -{"intu-ec-svcdisc", {NULL}, 8020, "udp"}, -{"intu-ec-client", {NULL}, 8021, "tcp"}, -{"intu-ec-client", {NULL}, 8021, "udp"}, -{"oa-system", {NULL}, 8022, "tcp"}, -{"oa-system", {NULL}, 8022, "udp"}, -{"ca-audit-da", {NULL}, 8025, "tcp"}, -{"ca-audit-da", {NULL}, 8025, "udp"}, -{"ca-audit-ds", {NULL}, 8026, "tcp"}, -{"ca-audit-ds", {NULL}, 8026, "udp"}, -{"pro-ed", {NULL}, 8032, "tcp"}, -{"pro-ed", {NULL}, 8032, "udp"}, -{"mindprint", {NULL}, 8033, "tcp"}, -{"mindprint", {NULL}, 8033, "udp"}, -{"vantronix-mgmt", {NULL}, 8034, "tcp"}, -{"vantronix-mgmt", {NULL}, 8034, "udp"}, -{"ampify", {NULL}, 8040, "tcp"}, -{"ampify", {NULL}, 8040, "udp"}, -{"fs-agent", {NULL}, 8042, "tcp"}, -{"fs-server", {NULL}, 8043, "tcp"}, -{"fs-mgmt", {NULL}, 8044, "tcp"}, -{"senomix01", {NULL}, 8052, "tcp"}, -{"senomix01", {NULL}, 8052, "udp"}, -{"senomix02", {NULL}, 8053, "tcp"}, -{"senomix02", {NULL}, 8053, "udp"}, -{"senomix03", {NULL}, 8054, "tcp"}, -{"senomix03", {NULL}, 8054, "udp"}, -{"senomix04", {NULL}, 8055, "tcp"}, -{"senomix04", {NULL}, 8055, "udp"}, -{"senomix05", {NULL}, 8056, "tcp"}, -{"senomix05", {NULL}, 8056, "udp"}, -{"senomix06", {NULL}, 8057, "tcp"}, -{"senomix06", {NULL}, 8057, "udp"}, -{"senomix07", {NULL}, 8058, "tcp"}, -{"senomix07", {NULL}, 8058, "udp"}, -{"senomix08", {NULL}, 8059, "tcp"}, -{"senomix08", {NULL}, 8059, "udp"}, -{"gadugadu", {NULL}, 8074, "tcp"}, -{"gadugadu", {NULL}, 8074, "udp"}, -{"http-alt", {NULL}, 8080, "tcp"}, -{"http-alt", {NULL}, 8080, "udp"}, -{"sunproxyadmin", {NULL}, 8081, "tcp"}, -{"sunproxyadmin", {NULL}, 8081, "udp"}, -{"us-cli", {NULL}, 8082, "tcp"}, -{"us-cli", {NULL}, 8082, "udp"}, -{"us-srv", {NULL}, 8083, "tcp"}, -{"us-srv", {NULL}, 8083, "udp"}, -{"d-s-n", {NULL}, 8086, "tcp"}, -{"d-s-n", {NULL}, 8086, "udp"}, -{"simplifymedia", {NULL}, 8087, "tcp"}, -{"simplifymedia", {NULL}, 8087, "udp"}, -{"radan-http", {NULL}, 8088, "tcp"}, -{"radan-http", {NULL}, 8088, "udp"}, -{"jamlink", {NULL}, 8091, "tcp"}, -{"sac", {NULL}, 8097, "tcp"}, -{"sac", {NULL}, 8097, "udp"}, -{"xprint-server", {NULL}, 8100, "tcp"}, -{"xprint-server", {NULL}, 8100, "udp"}, -{"ldoms-migr", {NULL}, 8101, "tcp"}, -{"mtl8000-matrix", {NULL}, 8115, "tcp"}, -{"mtl8000-matrix", {NULL}, 8115, "udp"}, -{"cp-cluster", {NULL}, 8116, "tcp"}, -{"cp-cluster", {NULL}, 8116, "udp"}, -{"privoxy", {NULL}, 8118, "tcp"}, -{"privoxy", {NULL}, 8118, "udp"}, -{"apollo-data", {NULL}, 8121, "tcp"}, -{"apollo-data", {NULL}, 8121, "udp"}, -{"apollo-admin", {NULL}, 8122, "tcp"}, -{"apollo-admin", {NULL}, 8122, "udp"}, -{"paycash-online", {NULL}, 8128, "tcp"}, -{"paycash-online", {NULL}, 8128, "udp"}, -{"paycash-wbp", {NULL}, 8129, "tcp"}, -{"paycash-wbp", {NULL}, 8129, "udp"}, -{"indigo-vrmi", {NULL}, 8130, "tcp"}, -{"indigo-vrmi", {NULL}, 8130, "udp"}, -{"indigo-vbcp", {NULL}, 8131, "tcp"}, -{"indigo-vbcp", {NULL}, 8131, "udp"}, -{"dbabble", {NULL}, 8132, "tcp"}, -{"dbabble", {NULL}, 8132, "udp"}, -{"isdd", {NULL}, 8148, "tcp"}, -{"isdd", {NULL}, 8148, "udp"}, -{"patrol", {NULL}, 8160, "tcp"}, -{"patrol", {NULL}, 8160, "udp"}, -{"patrol-snmp", {NULL}, 8161, "tcp"}, -{"patrol-snmp", {NULL}, 8161, "udp"}, -{"vmware-fdm", {NULL}, 8182, "tcp"}, -{"vmware-fdm", {NULL}, 8182, "udp"}, -{"proremote", {NULL}, 8183, "tcp"}, -{"itach", {NULL}, 8184, "tcp"}, -{"itach", {NULL}, 8184, "udp"}, -{"spytechphone", {NULL}, 8192, "tcp"}, -{"spytechphone", {NULL}, 8192, "udp"}, -{"blp1", {NULL}, 8194, "tcp"}, -{"blp1", {NULL}, 8194, "udp"}, -{"blp2", {NULL}, 8195, "tcp"}, -{"blp2", {NULL}, 8195, "udp"}, -{"vvr-data", {NULL}, 8199, "tcp"}, -{"vvr-data", {NULL}, 8199, "udp"}, -{"trivnet1", {NULL}, 8200, "tcp"}, -{"trivnet1", {NULL}, 8200, "udp"}, -{"trivnet2", {NULL}, 8201, "tcp"}, -{"trivnet2", {NULL}, 8201, "udp"}, -{"lm-perfworks", {NULL}, 8204, "tcp"}, -{"lm-perfworks", {NULL}, 8204, "udp"}, -{"lm-instmgr", {NULL}, 8205, "tcp"}, -{"lm-instmgr", {NULL}, 8205, "udp"}, -{"lm-dta", {NULL}, 8206, "tcp"}, -{"lm-dta", {NULL}, 8206, "udp"}, -{"lm-sserver", {NULL}, 8207, "tcp"}, -{"lm-sserver", {NULL}, 8207, "udp"}, -{"lm-webwatcher", {NULL}, 8208, "tcp"}, -{"lm-webwatcher", {NULL}, 8208, "udp"}, -{"rexecj", {NULL}, 8230, "tcp"}, -{"rexecj", {NULL}, 8230, "udp"}, -{"synapse-nhttps", {NULL}, 8243, "tcp"}, -{"synapse-nhttps", {NULL}, 8243, "udp"}, -{"pando-sec", {NULL}, 8276, "tcp"}, -{"pando-sec", {NULL}, 8276, "udp"}, -{"synapse-nhttp", {NULL}, 8280, "tcp"}, -{"synapse-nhttp", {NULL}, 8280, "udp"}, -{"blp3", {NULL}, 8292, "tcp"}, -{"blp3", {NULL}, 8292, "udp"}, -{"hiperscan-id", {NULL}, 8293, "tcp"}, -{"blp4", {NULL}, 8294, "tcp"}, -{"blp4", {NULL}, 8294, "udp"}, -{"tmi", {NULL}, 8300, "tcp"}, -{"tmi", {NULL}, 8300, "udp"}, -{"amberon", {NULL}, 8301, "tcp"}, -{"amberon", {NULL}, 8301, "udp"}, -{"tnp-discover", {NULL}, 8320, "tcp"}, -{"tnp-discover", {NULL}, 8320, "udp"}, -{"tnp", {NULL}, 8321, "tcp"}, -{"tnp", {NULL}, 8321, "udp"}, -{"server-find", {NULL}, 8351, "tcp"}, -{"server-find", {NULL}, 8351, "udp"}, -{"cruise-enum", {NULL}, 8376, "tcp"}, -{"cruise-enum", {NULL}, 8376, "udp"}, -{"cruise-swroute", {NULL}, 8377, "tcp"}, -{"cruise-swroute", {NULL}, 8377, "udp"}, -{"cruise-config", {NULL}, 8378, "tcp"}, -{"cruise-config", {NULL}, 8378, "udp"}, -{"cruise-diags", {NULL}, 8379, "tcp"}, -{"cruise-diags", {NULL}, 8379, "udp"}, -{"cruise-update", {NULL}, 8380, "tcp"}, -{"cruise-update", {NULL}, 8380, "udp"}, -{"m2mservices", {NULL}, 8383, "tcp"}, -{"m2mservices", {NULL}, 8383, "udp"}, -{"cvd", {NULL}, 8400, "tcp"}, -{"cvd", {NULL}, 8400, "udp"}, -{"sabarsd", {NULL}, 8401, "tcp"}, -{"sabarsd", {NULL}, 8401, "udp"}, -{"abarsd", {NULL}, 8402, "tcp"}, -{"abarsd", {NULL}, 8402, "udp"}, -{"admind", {NULL}, 8403, "tcp"}, -{"admind", {NULL}, 8403, "udp"}, -{"svcloud", {NULL}, 8404, "tcp"}, -{"svbackup", {NULL}, 8405, "tcp"}, -{"espeech", {NULL}, 8416, "tcp"}, -{"espeech", {NULL}, 8416, "udp"}, -{"espeech-rtp", {NULL}, 8417, "tcp"}, -{"espeech-rtp", {NULL}, 8417, "udp"}, -{"cybro-a-bus", {NULL}, 8442, "tcp"}, -{"cybro-a-bus", {NULL}, 8442, "udp"}, -{"pcsync-https", {NULL}, 8443, "tcp"}, -{"pcsync-https", {NULL}, 8443, "udp"}, -{"pcsync-http", {NULL}, 8444, "tcp"}, -{"pcsync-http", {NULL}, 8444, "udp"}, -{"npmp", {NULL}, 8450, "tcp"}, -{"npmp", {NULL}, 8450, "udp"}, -{"cisco-avp", {NULL}, 8470, "tcp"}, -{"pim-port", {NULL}, 8471, "tcp"}, -{"pim-port", {NULL}, 8471, "sctp"}, -{"otv", {NULL}, 8472, "tcp"}, -{"otv", {NULL}, 8472, "udp"}, -{"vp2p", {NULL}, 8473, "tcp"}, -{"vp2p", {NULL}, 8473, "udp"}, -{"noteshare", {NULL}, 8474, "tcp"}, -{"noteshare", {NULL}, 8474, "udp"}, -{"fmtp", {NULL}, 8500, "tcp"}, -{"fmtp", {NULL}, 8500, "udp"}, -{"rtsp-alt", {NULL}, 8554, "tcp"}, -{"rtsp-alt", {NULL}, 8554, "udp"}, -{"d-fence", {NULL}, 8555, "tcp"}, -{"d-fence", {NULL}, 8555, "udp"}, -{"oap-admin", {NULL}, 8567, "tcp"}, -{"oap-admin", {NULL}, 8567, "udp"}, -{"asterix", {NULL}, 8600, "tcp"}, -{"asterix", {NULL}, 8600, "udp"}, -{"canon-mfnp", {NULL}, 8610, "tcp"}, -{"canon-mfnp", {NULL}, 8610, "udp"}, -{"canon-bjnp1", {NULL}, 8611, "tcp"}, -{"canon-bjnp1", {NULL}, 8611, "udp"}, -{"canon-bjnp2", {NULL}, 8612, "tcp"}, -{"canon-bjnp2", {NULL}, 8612, "udp"}, -{"canon-bjnp3", {NULL}, 8613, "tcp"}, -{"canon-bjnp3", {NULL}, 8613, "udp"}, -{"canon-bjnp4", {NULL}, 8614, "tcp"}, -{"canon-bjnp4", {NULL}, 8614, "udp"}, -{"sun-as-jmxrmi", {NULL}, 8686, "tcp"}, -{"sun-as-jmxrmi", {NULL}, 8686, "udp"}, -{"vnyx", {NULL}, 8699, "tcp"}, -{"vnyx", {NULL}, 8699, "udp"}, -{"dtp-net", {NULL}, 8732, "udp"}, -{"ibus", {NULL}, 8733, "tcp"}, -{"ibus", {NULL}, 8733, "udp"}, -{"mc-appserver", {NULL}, 8763, "tcp"}, -{"mc-appserver", {NULL}, 8763, "udp"}, -{"openqueue", {NULL}, 8764, "tcp"}, -{"openqueue", {NULL}, 8764, "udp"}, -{"ultraseek-http", {NULL}, 8765, "tcp"}, -{"ultraseek-http", {NULL}, 8765, "udp"}, -{"dpap", {NULL}, 8770, "tcp"}, -{"dpap", {NULL}, 8770, "udp"}, -{"msgclnt", {NULL}, 8786, "tcp"}, -{"msgclnt", {NULL}, 8786, "udp"}, -{"msgsrvr", {NULL}, 8787, "tcp"}, -{"msgsrvr", {NULL}, 8787, "udp"}, -{"sunwebadmin", {NULL}, 8800, "tcp"}, -{"sunwebadmin", {NULL}, 8800, "udp"}, -{"truecm", {NULL}, 8804, "tcp"}, -{"truecm", {NULL}, 8804, "udp"}, -{"dxspider", {NULL}, 8873, "tcp"}, -{"dxspider", {NULL}, 8873, "udp"}, -{"cddbp-alt", {NULL}, 8880, "tcp"}, -{"cddbp-alt", {NULL}, 8880, "udp"}, -{"secure-mqtt", {NULL}, 8883, "tcp"}, -{"secure-mqtt", {NULL}, 8883, "udp"}, -{"ddi-tcp-1", {NULL}, 8888, "tcp"}, -{"ddi-udp-1", {NULL}, 8888, "udp"}, -{"ddi-tcp-2", {NULL}, 8889, "tcp"}, -{"ddi-udp-2", {NULL}, 8889, "udp"}, -{"ddi-tcp-3", {NULL}, 8890, "tcp"}, -{"ddi-udp-3", {NULL}, 8890, "udp"}, -{"ddi-tcp-4", {NULL}, 8891, "tcp"}, -{"ddi-udp-4", {NULL}, 8891, "udp"}, -{"ddi-tcp-5", {NULL}, 8892, "tcp"}, -{"ddi-udp-5", {NULL}, 8892, "udp"}, -{"ddi-tcp-6", {NULL}, 8893, "tcp"}, -{"ddi-udp-6", {NULL}, 8893, "udp"}, -{"ddi-tcp-7", {NULL}, 8894, "tcp"}, -{"ddi-udp-7", {NULL}, 8894, "udp"}, -{"ospf-lite", {NULL}, 8899, "tcp"}, -{"ospf-lite", {NULL}, 8899, "udp"}, -{"jmb-cds1", {NULL}, 8900, "tcp"}, -{"jmb-cds1", {NULL}, 8900, "udp"}, -{"jmb-cds2", {NULL}, 8901, "tcp"}, -{"jmb-cds2", {NULL}, 8901, "udp"}, -{"manyone-http", {NULL}, 8910, "tcp"}, -{"manyone-http", {NULL}, 8910, "udp"}, -{"manyone-xml", {NULL}, 8911, "tcp"}, -{"manyone-xml", {NULL}, 8911, "udp"}, -{"wcbackup", {NULL}, 8912, "tcp"}, -{"wcbackup", {NULL}, 8912, "udp"}, -{"dragonfly", {NULL}, 8913, "tcp"}, -{"dragonfly", {NULL}, 8913, "udp"}, -{"twds", {NULL}, 8937, "tcp"}, -{"cumulus-admin", {NULL}, 8954, "tcp"}, -{"cumulus-admin", {NULL}, 8954, "udp"}, -{"sunwebadmins", {NULL}, 8989, "tcp"}, -{"sunwebadmins", {NULL}, 8989, "udp"}, -{"http-wmap", {NULL}, 8990, "tcp"}, -{"http-wmap", {NULL}, 8990, "udp"}, -{"https-wmap", {NULL}, 8991, "tcp"}, -{"https-wmap", {NULL}, 8991, "udp"}, -{"bctp", {NULL}, 8999, "tcp"}, -{"bctp", {NULL}, 8999, "udp"}, -{"cslistener", {NULL}, 9000, "tcp"}, -{"cslistener", {NULL}, 9000, "udp"}, -{"etlservicemgr", {NULL}, 9001, "tcp"}, -{"etlservicemgr", {NULL}, 9001, "udp"}, -{"dynamid", {NULL}, 9002, "tcp"}, -{"dynamid", {NULL}, 9002, "udp"}, -{"ogs-client", {NULL}, 9007, "udp"}, -{"ogs-server", {NULL}, 9008, "tcp"}, -{"pichat", {NULL}, 9009, "tcp"}, -{"pichat", {NULL}, 9009, "udp"}, -{"sdr", {NULL}, 9010, "tcp"}, -{"tambora", {NULL}, 9020, "tcp"}, -{"tambora", {NULL}, 9020, "udp"}, -{"panagolin-ident", {NULL}, 9021, "tcp"}, -{"panagolin-ident", {NULL}, 9021, "udp"}, -{"paragent", {NULL}, 9022, "tcp"}, -{"paragent", {NULL}, 9022, "udp"}, -{"swa-1", {NULL}, 9023, "tcp"}, -{"swa-1", {NULL}, 9023, "udp"}, -{"swa-2", {NULL}, 9024, "tcp"}, -{"swa-2", {NULL}, 9024, "udp"}, -{"swa-3", {NULL}, 9025, "tcp"}, -{"swa-3", {NULL}, 9025, "udp"}, -{"swa-4", {NULL}, 9026, "tcp"}, -{"swa-4", {NULL}, 9026, "udp"}, -{"versiera", {NULL}, 9050, "tcp"}, -{"fio-cmgmt", {NULL}, 9051, "tcp"}, -{"glrpc", {NULL}, 9080, "tcp"}, -{"glrpc", {NULL}, 9080, "udp"}, -{"lcs-ap", {NULL}, 9082, "sctp"}, -{"emc-pp-mgmtsvc", {NULL}, 9083, "tcp"}, -{"aurora", {NULL}, 9084, "tcp"}, -{"aurora", {NULL}, 9084, "udp"}, -{"aurora", {NULL}, 9084, "sctp"}, -{"ibm-rsyscon", {NULL}, 9085, "tcp"}, -{"ibm-rsyscon", {NULL}, 9085, "udp"}, -{"net2display", {NULL}, 9086, "tcp"}, -{"net2display", {NULL}, 9086, "udp"}, -{"classic", {NULL}, 9087, "tcp"}, -{"classic", {NULL}, 9087, "udp"}, -{"sqlexec", {NULL}, 9088, "tcp"}, -{"sqlexec", {NULL}, 9088, "udp"}, -{"sqlexec-ssl", {NULL}, 9089, "tcp"}, -{"sqlexec-ssl", {NULL}, 9089, "udp"}, -{"websm", {NULL}, 9090, "tcp"}, -{"websm", {NULL}, 9090, "udp"}, -{"xmltec-xmlmail", {NULL}, 9091, "tcp"}, -{"xmltec-xmlmail", {NULL}, 9091, "udp"}, -{"XmlIpcRegSvc", {NULL}, 9092, "tcp"}, -{"XmlIpcRegSvc", {NULL}, 9092, "udp"}, -{"hp-pdl-datastr", {NULL}, 9100, "tcp"}, -{"hp-pdl-datastr", {NULL}, 9100, "udp"}, -{"pdl-datastream", {NULL}, 9100, "tcp"}, -{"pdl-datastream", {NULL}, 9100, "udp"}, -{"bacula-dir", {NULL}, 9101, "tcp"}, -{"bacula-dir", {NULL}, 9101, "udp"}, -{"bacula-fd", {NULL}, 9102, "tcp"}, -{"bacula-fd", {NULL}, 9102, "udp"}, -{"bacula-sd", {NULL}, 9103, "tcp"}, -{"bacula-sd", {NULL}, 9103, "udp"}, -{"peerwire", {NULL}, 9104, "tcp"}, -{"peerwire", {NULL}, 9104, "udp"}, -{"xadmin", {NULL}, 9105, "tcp"}, -{"xadmin", {NULL}, 9105, "udp"}, -{"astergate", {NULL}, 9106, "tcp"}, -{"astergate-disc", {NULL}, 9106, "udp"}, -{"astergatefax", {NULL}, 9107, "tcp"}, -{"mxit", {NULL}, 9119, "tcp"}, -{"mxit", {NULL}, 9119, "udp"}, -{"dddp", {NULL}, 9131, "tcp"}, -{"dddp", {NULL}, 9131, "udp"}, -{"apani1", {NULL}, 9160, "tcp"}, -{"apani1", {NULL}, 9160, "udp"}, -{"apani2", {NULL}, 9161, "tcp"}, -{"apani2", {NULL}, 9161, "udp"}, -{"apani3", {NULL}, 9162, "tcp"}, -{"apani3", {NULL}, 9162, "udp"}, -{"apani4", {NULL}, 9163, "tcp"}, -{"apani4", {NULL}, 9163, "udp"}, -{"apani5", {NULL}, 9164, "tcp"}, -{"apani5", {NULL}, 9164, "udp"}, -{"sun-as-jpda", {NULL}, 9191, "tcp"}, -{"sun-as-jpda", {NULL}, 9191, "udp"}, -{"wap-wsp", {NULL}, 9200, "tcp"}, -{"wap-wsp", {NULL}, 9200, "udp"}, -{"wap-wsp-wtp", {NULL}, 9201, "tcp"}, -{"wap-wsp-wtp", {NULL}, 9201, "udp"}, -{"wap-wsp-s", {NULL}, 9202, "tcp"}, -{"wap-wsp-s", {NULL}, 9202, "udp"}, -{"wap-wsp-wtp-s", {NULL}, 9203, "tcp"}, -{"wap-wsp-wtp-s", {NULL}, 9203, "udp"}, -{"wap-vcard", {NULL}, 9204, "tcp"}, -{"wap-vcard", {NULL}, 9204, "udp"}, -{"wap-vcal", {NULL}, 9205, "tcp"}, -{"wap-vcal", {NULL}, 9205, "udp"}, -{"wap-vcard-s", {NULL}, 9206, "tcp"}, -{"wap-vcard-s", {NULL}, 9206, "udp"}, -{"wap-vcal-s", {NULL}, 9207, "tcp"}, -{"wap-vcal-s", {NULL}, 9207, "udp"}, -{"rjcdb-vcards", {NULL}, 9208, "tcp"}, -{"rjcdb-vcards", {NULL}, 9208, "udp"}, -{"almobile-system", {NULL}, 9209, "tcp"}, -{"almobile-system", {NULL}, 9209, "udp"}, -{"oma-mlp", {NULL}, 9210, "tcp"}, -{"oma-mlp", {NULL}, 9210, "udp"}, -{"oma-mlp-s", {NULL}, 9211, "tcp"}, -{"oma-mlp-s", {NULL}, 9211, "udp"}, -{"serverviewdbms", {NULL}, 9212, "tcp"}, -{"serverviewdbms", {NULL}, 9212, "udp"}, -{"serverstart", {NULL}, 9213, "tcp"}, -{"serverstart", {NULL}, 9213, "udp"}, -{"ipdcesgbs", {NULL}, 9214, "tcp"}, -{"ipdcesgbs", {NULL}, 9214, "udp"}, -{"insis", {NULL}, 9215, "tcp"}, -{"insis", {NULL}, 9215, "udp"}, -{"acme", {NULL}, 9216, "tcp"}, -{"acme", {NULL}, 9216, "udp"}, -{"fsc-port", {NULL}, 9217, "tcp"}, -{"fsc-port", {NULL}, 9217, "udp"}, -{"teamcoherence", {NULL}, 9222, "tcp"}, -{"teamcoherence", {NULL}, 9222, "udp"}, -{"mon", {NULL}, 9255, "tcp"}, -{"mon", {NULL}, 9255, "udp"}, -{"pegasus", {NULL}, 9278, "tcp"}, -{"pegasus", {NULL}, 9278, "udp"}, -{"pegasus-ctl", {NULL}, 9279, "tcp"}, -{"pegasus-ctl", {NULL}, 9279, "udp"}, -{"pgps", {NULL}, 9280, "tcp"}, -{"pgps", {NULL}, 9280, "udp"}, -{"swtp-port1", {NULL}, 9281, "tcp"}, -{"swtp-port1", {NULL}, 9281, "udp"}, -{"swtp-port2", {NULL}, 9282, "tcp"}, -{"swtp-port2", {NULL}, 9282, "udp"}, -{"callwaveiam", {NULL}, 9283, "tcp"}, -{"callwaveiam", {NULL}, 9283, "udp"}, -{"visd", {NULL}, 9284, "tcp"}, -{"visd", {NULL}, 9284, "udp"}, -{"n2h2server", {NULL}, 9285, "tcp"}, -{"n2h2server", {NULL}, 9285, "udp"}, -{"n2receive", {NULL}, 9286, "udp"}, -{"cumulus", {NULL}, 9287, "tcp"}, -{"cumulus", {NULL}, 9287, "udp"}, -{"armtechdaemon", {NULL}, 9292, "tcp"}, -{"armtechdaemon", {NULL}, 9292, "udp"}, -{"storview", {NULL}, 9293, "tcp"}, -{"storview", {NULL}, 9293, "udp"}, -{"armcenterhttp", {NULL}, 9294, "tcp"}, -{"armcenterhttp", {NULL}, 9294, "udp"}, -{"armcenterhttps", {NULL}, 9295, "tcp"}, -{"armcenterhttps", {NULL}, 9295, "udp"}, -{"vrace", {NULL}, 9300, "tcp"}, -{"vrace", {NULL}, 9300, "udp"}, -{"sphinxql", {NULL}, 9306, "tcp"}, -{"sphinxapi", {NULL}, 9312, "tcp"}, -{"secure-ts", {NULL}, 9318, "tcp"}, -{"secure-ts", {NULL}, 9318, "udp"}, -{"guibase", {NULL}, 9321, "tcp"}, -{"guibase", {NULL}, 9321, "udp"}, -{"mpidcmgr", {NULL}, 9343, "tcp"}, -{"mpidcmgr", {NULL}, 9343, "udp"}, -{"mphlpdmc", {NULL}, 9344, "tcp"}, -{"mphlpdmc", {NULL}, 9344, "udp"}, -{"ctechlicensing", {NULL}, 9346, "tcp"}, -{"ctechlicensing", {NULL}, 9346, "udp"}, -{"fjdmimgr", {NULL}, 9374, "tcp"}, -{"fjdmimgr", {NULL}, 9374, "udp"}, -{"boxp", {NULL}, 9380, "tcp"}, -{"boxp", {NULL}, 9380, "udp"}, -{"d2dconfig", {NULL}, 9387, "tcp"}, -{"d2ddatatrans", {NULL}, 9388, "tcp"}, -{"adws", {NULL}, 9389, "tcp"}, -{"otp", {NULL}, 9390, "tcp"}, -{"fjinvmgr", {NULL}, 9396, "tcp"}, -{"fjinvmgr", {NULL}, 9396, "udp"}, -{"mpidcagt", {NULL}, 9397, "tcp"}, -{"mpidcagt", {NULL}, 9397, "udp"}, -{"sec-t4net-srv", {NULL}, 9400, "tcp"}, -{"sec-t4net-srv", {NULL}, 9400, "udp"}, -{"sec-t4net-clt", {NULL}, 9401, "tcp"}, -{"sec-t4net-clt", {NULL}, 9401, "udp"}, -{"sec-pc2fax-srv", {NULL}, 9402, "tcp"}, -{"sec-pc2fax-srv", {NULL}, 9402, "udp"}, -{"git", {NULL}, 9418, "tcp"}, -{"git", {NULL}, 9418, "udp"}, -{"tungsten-https", {NULL}, 9443, "tcp"}, -{"tungsten-https", {NULL}, 9443, "udp"}, -{"wso2esb-console", {NULL}, 9444, "tcp"}, -{"wso2esb-console", {NULL}, 9444, "udp"}, -{"sntlkeyssrvr", {NULL}, 9450, "tcp"}, -{"sntlkeyssrvr", {NULL}, 9450, "udp"}, -{"ismserver", {NULL}, 9500, "tcp"}, -{"ismserver", {NULL}, 9500, "udp"}, -{"sma-spw", {NULL}, 9522, "udp"}, -{"mngsuite", {NULL}, 9535, "tcp"}, -{"mngsuite", {NULL}, 9535, "udp"}, -{"laes-bf", {NULL}, 9536, "tcp"}, -{"laes-bf", {NULL}, 9536, "udp"}, -{"trispen-sra", {NULL}, 9555, "tcp"}, -{"trispen-sra", {NULL}, 9555, "udp"}, -{"ldgateway", {NULL}, 9592, "tcp"}, -{"ldgateway", {NULL}, 9592, "udp"}, -{"cba8", {NULL}, 9593, "tcp"}, -{"cba8", {NULL}, 9593, "udp"}, -{"msgsys", {NULL}, 9594, "tcp"}, -{"msgsys", {NULL}, 9594, "udp"}, -{"pds", {NULL}, 9595, "tcp"}, -{"pds", {NULL}, 9595, "udp"}, -{"mercury-disc", {NULL}, 9596, "tcp"}, -{"mercury-disc", {NULL}, 9596, "udp"}, -{"pd-admin", {NULL}, 9597, "tcp"}, -{"pd-admin", {NULL}, 9597, "udp"}, -{"vscp", {NULL}, 9598, "tcp"}, -{"vscp", {NULL}, 9598, "udp"}, -{"robix", {NULL}, 9599, "tcp"}, -{"robix", {NULL}, 9599, "udp"}, -{"micromuse-ncpw", {NULL}, 9600, "tcp"}, -{"micromuse-ncpw", {NULL}, 9600, "udp"}, -{"streamcomm-ds", {NULL}, 9612, "tcp"}, -{"streamcomm-ds", {NULL}, 9612, "udp"}, -{"iadt-tls", {NULL}, 9614, "tcp"}, -{"erunbook_agent", {NULL}, 9616, "tcp"}, -{"erunbook_server", {NULL}, 9617, "tcp"}, -{"condor", {NULL}, 9618, "tcp"}, -{"condor", {NULL}, 9618, "udp"}, -{"odbcpathway", {NULL}, 9628, "tcp"}, -{"odbcpathway", {NULL}, 9628, "udp"}, -{"uniport", {NULL}, 9629, "tcp"}, -{"uniport", {NULL}, 9629, "udp"}, -{"peoctlr", {NULL}, 9630, "tcp"}, -{"peocoll", {NULL}, 9631, "tcp"}, -{"mc-comm", {NULL}, 9632, "udp"}, -{"pqsflows", {NULL}, 9640, "tcp"}, -{"xmms2", {NULL}, 9667, "tcp"}, -{"xmms2", {NULL}, 9667, "udp"}, -{"tec5-sdctp", {NULL}, 9668, "tcp"}, -{"tec5-sdctp", {NULL}, 9668, "udp"}, -{"client-wakeup", {NULL}, 9694, "tcp"}, -{"client-wakeup", {NULL}, 9694, "udp"}, -{"ccnx", {NULL}, 9695, "tcp"}, -{"ccnx", {NULL}, 9695, "udp"}, -{"board-roar", {NULL}, 9700, "tcp"}, -{"board-roar", {NULL}, 9700, "udp"}, -{"l5nas-parchan", {NULL}, 9747, "tcp"}, -{"l5nas-parchan", {NULL}, 9747, "udp"}, -{"board-voip", {NULL}, 9750, "tcp"}, -{"board-voip", {NULL}, 9750, "udp"}, -{"rasadv", {NULL}, 9753, "tcp"}, -{"rasadv", {NULL}, 9753, "udp"}, -{"tungsten-http", {NULL}, 9762, "tcp"}, -{"tungsten-http", {NULL}, 9762, "udp"}, -{"davsrc", {NULL}, 9800, "tcp"}, -{"davsrc", {NULL}, 9800, "udp"}, -{"sstp-2", {NULL}, 9801, "tcp"}, -{"sstp-2", {NULL}, 9801, "udp"}, -{"davsrcs", {NULL}, 9802, "tcp"}, -{"davsrcs", {NULL}, 9802, "udp"}, -{"sapv1", {NULL}, 9875, "tcp"}, -{"sapv1", {NULL}, 9875, "udp"}, -{"sd", {NULL}, 9876, "tcp"}, -{"sd", {NULL}, 9876, "udp"}, -{"cyborg-systems", {NULL}, 9888, "tcp"}, -{"cyborg-systems", {NULL}, 9888, "udp"}, -{"gt-proxy", {NULL}, 9889, "tcp"}, -{"gt-proxy", {NULL}, 9889, "udp"}, -{"monkeycom", {NULL}, 9898, "tcp"}, -{"monkeycom", {NULL}, 9898, "udp"}, -{"sctp-tunneling", {NULL}, 9899, "tcp"}, -{"sctp-tunneling", {NULL}, 9899, "udp"}, -{"iua", {NULL}, 9900, "tcp"}, -{"iua", {NULL}, 9900, "udp"}, -{"iua", {NULL}, 9900, "sctp"}, -{"enrp", {NULL}, 9901, "udp"}, -{"enrp-sctp", {NULL}, 9901, "sctp"}, -{"enrp-sctp-tls", {NULL}, 9902, "sctp"}, -{"domaintime", {NULL}, 9909, "tcp"}, -{"domaintime", {NULL}, 9909, "udp"}, -{"sype-transport", {NULL}, 9911, "tcp"}, -{"sype-transport", {NULL}, 9911, "udp"}, -{"apc-9950", {NULL}, 9950, "tcp"}, -{"apc-9950", {NULL}, 9950, "udp"}, -{"apc-9951", {NULL}, 9951, "tcp"}, -{"apc-9951", {NULL}, 9951, "udp"}, -{"apc-9952", {NULL}, 9952, "tcp"}, -{"apc-9952", {NULL}, 9952, "udp"}, -{"acis", {NULL}, 9953, "tcp"}, -{"acis", {NULL}, 9953, "udp"}, -{"odnsp", {NULL}, 9966, "tcp"}, -{"odnsp", {NULL}, 9966, "udp"}, -{"dsm-scm-target", {NULL}, 9987, "tcp"}, -{"dsm-scm-target", {NULL}, 9987, "udp"}, -{"nsesrvr", {NULL}, 9988, "tcp"}, -{"osm-appsrvr", {NULL}, 9990, "tcp"}, -{"osm-appsrvr", {NULL}, 9990, "udp"}, -{"osm-oev", {NULL}, 9991, "tcp"}, -{"osm-oev", {NULL}, 9991, "udp"}, -{"palace-1", {NULL}, 9992, "tcp"}, -{"palace-1", {NULL}, 9992, "udp"}, -{"palace-2", {NULL}, 9993, "tcp"}, -{"palace-2", {NULL}, 9993, "udp"}, -{"palace-3", {NULL}, 9994, "tcp"}, -{"palace-3", {NULL}, 9994, "udp"}, -{"palace-4", {NULL}, 9995, "tcp"}, -{"palace-4", {NULL}, 9995, "udp"}, -{"palace-5", {NULL}, 9996, "tcp"}, -{"palace-5", {NULL}, 9996, "udp"}, -{"palace-6", {NULL}, 9997, "tcp"}, -{"palace-6", {NULL}, 9997, "udp"}, -{"distinct32", {NULL}, 9998, "tcp"}, -{"distinct32", {NULL}, 9998, "udp"}, -{"distinct", {NULL}, 9999, "tcp"}, -{"distinct", {NULL}, 9999, "udp"}, -{"ndmp", {NULL}, 10000, "tcp"}, -{"ndmp", {NULL}, 10000, "udp"}, -{"scp-config", {NULL}, 10001, "tcp"}, -{"scp-config", {NULL}, 10001, "udp"}, -{"documentum", {NULL}, 10002, "tcp"}, -{"documentum", {NULL}, 10002, "udp"}, -{"documentum_s", {NULL}, 10003, "tcp"}, -{"documentum_s", {NULL}, 10003, "udp"}, -{"emcrmirccd", {NULL}, 10004, "tcp"}, -{"emcrmird", {NULL}, 10005, "tcp"}, -{"mvs-capacity", {NULL}, 10007, "tcp"}, -{"mvs-capacity", {NULL}, 10007, "udp"}, -{"octopus", {NULL}, 10008, "tcp"}, -{"octopus", {NULL}, 10008, "udp"}, -{"swdtp-sv", {NULL}, 10009, "tcp"}, -{"swdtp-sv", {NULL}, 10009, "udp"}, -{"rxapi", {NULL}, 10010, "tcp"}, -{"zabbix-agent", {NULL}, 10050, "tcp"}, -{"zabbix-agent", {NULL}, 10050, "udp"}, -{"zabbix-trapper", {NULL}, 10051, "tcp"}, -{"zabbix-trapper", {NULL}, 10051, "udp"}, -{"qptlmd", {NULL}, 10055, "tcp"}, -{"amanda", {NULL}, 10080, "tcp"}, -{"amanda", {NULL}, 10080, "udp"}, -{"famdc", {NULL}, 10081, "tcp"}, -{"famdc", {NULL}, 10081, "udp"}, -{"itap-ddtp", {NULL}, 10100, "tcp"}, -{"itap-ddtp", {NULL}, 10100, "udp"}, -{"ezmeeting-2", {NULL}, 10101, "tcp"}, -{"ezmeeting-2", {NULL}, 10101, "udp"}, -{"ezproxy-2", {NULL}, 10102, "tcp"}, -{"ezproxy-2", {NULL}, 10102, "udp"}, -{"ezrelay", {NULL}, 10103, "tcp"}, -{"ezrelay", {NULL}, 10103, "udp"}, -{"swdtp", {NULL}, 10104, "tcp"}, -{"swdtp", {NULL}, 10104, "udp"}, -{"bctp-server", {NULL}, 10107, "tcp"}, -{"bctp-server", {NULL}, 10107, "udp"}, -{"nmea-0183", {NULL}, 10110, "tcp"}, -{"nmea-0183", {NULL}, 10110, "udp"}, -{"netiq-endpoint", {NULL}, 10113, "tcp"}, -{"netiq-endpoint", {NULL}, 10113, "udp"}, -{"netiq-qcheck", {NULL}, 10114, "tcp"}, -{"netiq-qcheck", {NULL}, 10114, "udp"}, -{"netiq-endpt", {NULL}, 10115, "tcp"}, -{"netiq-endpt", {NULL}, 10115, "udp"}, -{"netiq-voipa", {NULL}, 10116, "tcp"}, -{"netiq-voipa", {NULL}, 10116, "udp"}, -{"iqrm", {NULL}, 10117, "tcp"}, -{"iqrm", {NULL}, 10117, "udp"}, -{"bmc-perf-sd", {NULL}, 10128, "tcp"}, -{"bmc-perf-sd", {NULL}, 10128, "udp"}, -{"bmc-gms", {NULL}, 10129, "tcp"}, -{"qb-db-server", {NULL}, 10160, "tcp"}, -{"qb-db-server", {NULL}, 10160, "udp"}, -{"snmptls", {NULL}, 10161, "tcp"}, -{"snmpdtls", {NULL}, 10161, "udp"}, -{"snmptls-trap", {NULL}, 10162, "tcp"}, -{"snmpdtls-trap", {NULL}, 10162, "udp"}, -{"trisoap", {NULL}, 10200, "tcp"}, -{"trisoap", {NULL}, 10200, "udp"}, -{"rsms", {NULL}, 10201, "tcp"}, -{"rscs", {NULL}, 10201, "udp"}, -{"apollo-relay", {NULL}, 10252, "tcp"}, -{"apollo-relay", {NULL}, 10252, "udp"}, -{"axis-wimp-port", {NULL}, 10260, "tcp"}, -{"axis-wimp-port", {NULL}, 10260, "udp"}, -{"blocks", {NULL}, 10288, "tcp"}, -{"blocks", {NULL}, 10288, "udp"}, -{"cosir", {NULL}, 10321, "tcp"}, -{"hip-nat-t", {NULL}, 10500, "udp"}, -{"MOS-lower", {NULL}, 10540, "tcp"}, -{"MOS-lower", {NULL}, 10540, "udp"}, -{"MOS-upper", {NULL}, 10541, "tcp"}, -{"MOS-upper", {NULL}, 10541, "udp"}, -{"MOS-aux", {NULL}, 10542, "tcp"}, -{"MOS-aux", {NULL}, 10542, "udp"}, -{"MOS-soap", {NULL}, 10543, "tcp"}, -{"MOS-soap", {NULL}, 10543, "udp"}, -{"MOS-soap-opt", {NULL}, 10544, "tcp"}, -{"MOS-soap-opt", {NULL}, 10544, "udp"}, -{"gap", {NULL}, 10800, "tcp"}, -{"gap", {NULL}, 10800, "udp"}, -{"lpdg", {NULL}, 10805, "tcp"}, -{"lpdg", {NULL}, 10805, "udp"}, -{"nbd", {NULL}, 10809, "tcp"}, -{"nmc-disc", {NULL}, 10810, "udp"}, -{"helix", {NULL}, 10860, "tcp"}, -{"helix", {NULL}, 10860, "udp"}, -{"rmiaux", {NULL}, 10990, "tcp"}, -{"rmiaux", {NULL}, 10990, "udp"}, -{"irisa", {NULL}, 11000, "tcp"}, -{"irisa", {NULL}, 11000, "udp"}, -{"metasys", {NULL}, 11001, "tcp"}, -{"metasys", {NULL}, 11001, "udp"}, -{"netapp-icmgmt", {NULL}, 11104, "tcp"}, -{"netapp-icdata", {NULL}, 11105, "tcp"}, -{"sgi-lk", {NULL}, 11106, "tcp"}, -{"sgi-lk", {NULL}, 11106, "udp"}, -{"vce", {NULL}, 11111, "tcp"}, -{"vce", {NULL}, 11111, "udp"}, -{"dicom", {NULL}, 11112, "tcp"}, -{"dicom", {NULL}, 11112, "udp"}, -{"suncacao-snmp", {NULL}, 11161, "tcp"}, -{"suncacao-snmp", {NULL}, 11161, "udp"}, -{"suncacao-jmxmp", {NULL}, 11162, "tcp"}, -{"suncacao-jmxmp", {NULL}, 11162, "udp"}, -{"suncacao-rmi", {NULL}, 11163, "tcp"}, -{"suncacao-rmi", {NULL}, 11163, "udp"}, -{"suncacao-csa", {NULL}, 11164, "tcp"}, -{"suncacao-csa", {NULL}, 11164, "udp"}, -{"suncacao-websvc", {NULL}, 11165, "tcp"}, -{"suncacao-websvc", {NULL}, 11165, "udp"}, -{"snss", {NULL}, 11171, "udp"}, -{"oemcacao-jmxmp", {NULL}, 11172, "tcp"}, -{"oemcacao-rmi", {NULL}, 11174, "tcp"}, -{"oemcacao-websvc", {NULL}, 11175, "tcp"}, -{"smsqp", {NULL}, 11201, "tcp"}, -{"smsqp", {NULL}, 11201, "udp"}, -{"wifree", {NULL}, 11208, "tcp"}, -{"wifree", {NULL}, 11208, "udp"}, -{"memcache", {NULL}, 11211, "tcp"}, -{"memcache", {NULL}, 11211, "udp"}, -{"imip", {NULL}, 11319, "tcp"}, -{"imip", {NULL}, 11319, "udp"}, -{"imip-channels", {NULL}, 11320, "tcp"}, -{"imip-channels", {NULL}, 11320, "udp"}, -{"arena-server", {NULL}, 11321, "tcp"}, -{"arena-server", {NULL}, 11321, "udp"}, -{"atm-uhas", {NULL}, 11367, "tcp"}, -{"atm-uhas", {NULL}, 11367, "udp"}, -{"hkp", {NULL}, 11371, "tcp"}, -{"hkp", {NULL}, 11371, "udp"}, -{"asgcypresstcps", {NULL}, 11489, "tcp"}, -{"tempest-port", {NULL}, 11600, "tcp"}, -{"tempest-port", {NULL}, 11600, "udp"}, -{"h323callsigalt", {NULL}, 11720, "tcp"}, -{"h323callsigalt", {NULL}, 11720, "udp"}, -{"intrepid-ssl", {NULL}, 11751, "tcp"}, -{"intrepid-ssl", {NULL}, 11751, "udp"}, -{"xoraya", {NULL}, 11876, "tcp"}, -{"xoraya", {NULL}, 11876, "udp"}, -{"x2e-disc", {NULL}, 11877, "udp"}, -{"sysinfo-sp", {NULL}, 11967, "tcp"}, -{"sysinfo-sp", {NULL}, 11967, "udp"}, -{"wmereceiving", {NULL}, 11997, "sctp"}, -{"wmedistribution", {NULL}, 11998, "sctp"}, -{"wmereporting", {NULL}, 11999, "sctp"}, -{"entextxid", {NULL}, 12000, "tcp"}, -{"entextxid", {NULL}, 12000, "udp"}, -{"entextnetwk", {NULL}, 12001, "tcp"}, -{"entextnetwk", {NULL}, 12001, "udp"}, -{"entexthigh", {NULL}, 12002, "tcp"}, -{"entexthigh", {NULL}, 12002, "udp"}, -{"entextmed", {NULL}, 12003, "tcp"}, -{"entextmed", {NULL}, 12003, "udp"}, -{"entextlow", {NULL}, 12004, "tcp"}, -{"entextlow", {NULL}, 12004, "udp"}, -{"dbisamserver1", {NULL}, 12005, "tcp"}, -{"dbisamserver1", {NULL}, 12005, "udp"}, -{"dbisamserver2", {NULL}, 12006, "tcp"}, -{"dbisamserver2", {NULL}, 12006, "udp"}, -{"accuracer", {NULL}, 12007, "tcp"}, -{"accuracer", {NULL}, 12007, "udp"}, -{"accuracer-dbms", {NULL}, 12008, "tcp"}, -{"accuracer-dbms", {NULL}, 12008, "udp"}, -{"edbsrvr", {NULL}, 12010, "tcp"}, -{"vipera", {NULL}, 12012, "tcp"}, -{"vipera", {NULL}, 12012, "udp"}, -{"vipera-ssl", {NULL}, 12013, "tcp"}, -{"vipera-ssl", {NULL}, 12013, "udp"}, -{"rets-ssl", {NULL}, 12109, "tcp"}, -{"rets-ssl", {NULL}, 12109, "udp"}, -{"nupaper-ss", {NULL}, 12121, "tcp"}, -{"nupaper-ss", {NULL}, 12121, "udp"}, -{"cawas", {NULL}, 12168, "tcp"}, -{"cawas", {NULL}, 12168, "udp"}, -{"hivep", {NULL}, 12172, "tcp"}, -{"hivep", {NULL}, 12172, "udp"}, -{"linogridengine", {NULL}, 12300, "tcp"}, -{"linogridengine", {NULL}, 12300, "udp"}, -{"warehouse-sss", {NULL}, 12321, "tcp"}, -{"warehouse-sss", {NULL}, 12321, "udp"}, -{"warehouse", {NULL}, 12322, "tcp"}, -{"warehouse", {NULL}, 12322, "udp"}, -{"italk", {NULL}, 12345, "tcp"}, -{"italk", {NULL}, 12345, "udp"}, -{"tsaf", {NULL}, 12753, "tcp"}, -{"tsaf", {NULL}, 12753, "udp"}, -{"i-zipqd", {NULL}, 13160, "tcp"}, -{"i-zipqd", {NULL}, 13160, "udp"}, -{"bcslogc", {NULL}, 13216, "tcp"}, -{"bcslogc", {NULL}, 13216, "udp"}, -{"rs-pias", {NULL}, 13217, "tcp"}, -{"rs-pias", {NULL}, 13217, "udp"}, -{"emc-vcas-tcp", {NULL}, 13218, "tcp"}, -{"emc-vcas-udp", {NULL}, 13218, "udp"}, -{"powwow-client", {NULL}, 13223, "tcp"}, -{"powwow-client", {NULL}, 13223, "udp"}, -{"powwow-server", {NULL}, 13224, "tcp"}, -{"powwow-server", {NULL}, 13224, "udp"}, -{"doip-data", {NULL}, 13400, "tcp"}, -{"doip-disc", {NULL}, 13400, "udp"}, -{"bprd", {NULL}, 13720, "tcp"}, -{"bprd", {NULL}, 13720, "udp"}, -{"bpdbm", {NULL}, 13721, "tcp"}, -{"bpdbm", {NULL}, 13721, "udp"}, -{"bpjava-msvc", {NULL}, 13722, "tcp"}, -{"bpjava-msvc", {NULL}, 13722, "udp"}, -{"vnetd", {NULL}, 13724, "tcp"}, -{"vnetd", {NULL}, 13724, "udp"}, -{"bpcd", {NULL}, 13782, "tcp"}, -{"bpcd", {NULL}, 13782, "udp"}, -{"vopied", {NULL}, 13783, "tcp"}, -{"vopied", {NULL}, 13783, "udp"}, -{"nbdb", {NULL}, 13785, "tcp"}, -{"nbdb", {NULL}, 13785, "udp"}, -{"nomdb", {NULL}, 13786, "tcp"}, -{"nomdb", {NULL}, 13786, "udp"}, -{"dsmcc-config", {NULL}, 13818, "tcp"}, -{"dsmcc-config", {NULL}, 13818, "udp"}, -{"dsmcc-session", {NULL}, 13819, "tcp"}, -{"dsmcc-session", {NULL}, 13819, "udp"}, -{"dsmcc-passthru", {NULL}, 13820, "tcp"}, -{"dsmcc-passthru", {NULL}, 13820, "udp"}, -{"dsmcc-download", {NULL}, 13821, "tcp"}, -{"dsmcc-download", {NULL}, 13821, "udp"}, -{"dsmcc-ccp", {NULL}, 13822, "tcp"}, -{"dsmcc-ccp", {NULL}, 13822, "udp"}, -{"bmdss", {NULL}, 13823, "tcp"}, -{"dta-systems", {NULL}, 13929, "tcp"}, -{"dta-systems", {NULL}, 13929, "udp"}, -{"medevolve", {NULL}, 13930, "tcp"}, -{"scotty-ft", {NULL}, 14000, "tcp"}, -{"scotty-ft", {NULL}, 14000, "udp"}, -{"sua", {NULL}, 14001, "tcp"}, -{"sua", {NULL}, 14001, "udp"}, -{"sua", {NULL}, 14001, "sctp"}, -{"sage-best-com1", {NULL}, 14033, "tcp"}, -{"sage-best-com1", {NULL}, 14033, "udp"}, -{"sage-best-com2", {NULL}, 14034, "tcp"}, -{"sage-best-com2", {NULL}, 14034, "udp"}, -{"vcs-app", {NULL}, 14141, "tcp"}, -{"vcs-app", {NULL}, 14141, "udp"}, -{"icpp", {NULL}, 14142, "tcp"}, -{"icpp", {NULL}, 14142, "udp"}, -{"gcm-app", {NULL}, 14145, "tcp"}, -{"gcm-app", {NULL}, 14145, "udp"}, -{"vrts-tdd", {NULL}, 14149, "tcp"}, -{"vrts-tdd", {NULL}, 14149, "udp"}, -{"vcscmd", {NULL}, 14150, "tcp"}, -{"vad", {NULL}, 14154, "tcp"}, -{"vad", {NULL}, 14154, "udp"}, -{"cps", {NULL}, 14250, "tcp"}, -{"cps", {NULL}, 14250, "udp"}, -{"ca-web-update", {NULL}, 14414, "tcp"}, -{"ca-web-update", {NULL}, 14414, "udp"}, -{"hde-lcesrvr-1", {NULL}, 14936, "tcp"}, -{"hde-lcesrvr-1", {NULL}, 14936, "udp"}, -{"hde-lcesrvr-2", {NULL}, 14937, "tcp"}, -{"hde-lcesrvr-2", {NULL}, 14937, "udp"}, -{"hydap", {NULL}, 15000, "tcp"}, -{"hydap", {NULL}, 15000, "udp"}, -{"xpilot", {NULL}, 15345, "tcp"}, -{"xpilot", {NULL}, 15345, "udp"}, -{"3link", {NULL}, 15363, "tcp"}, -{"3link", {NULL}, 15363, "udp"}, -{"cisco-snat", {NULL}, 15555, "tcp"}, -{"cisco-snat", {NULL}, 15555, "udp"}, -{"bex-xr", {NULL}, 15660, "tcp"}, -{"bex-xr", {NULL}, 15660, "udp"}, -{"ptp", {NULL}, 15740, "tcp"}, -{"ptp", {NULL}, 15740, "udp"}, -{"2ping", {NULL}, 15998, "udp"}, -{"programmar", {NULL}, 15999, "tcp"}, -{"fmsas", {NULL}, 16000, "tcp"}, -{"fmsascon", {NULL}, 16001, "tcp"}, -{"gsms", {NULL}, 16002, "tcp"}, -{"alfin", {NULL}, 16003, "udp"}, -{"jwpc", {NULL}, 16020, "tcp"}, -{"jwpc-bin", {NULL}, 16021, "tcp"}, -{"sun-sea-port", {NULL}, 16161, "tcp"}, -{"sun-sea-port", {NULL}, 16161, "udp"}, -{"solaris-audit", {NULL}, 16162, "tcp"}, -{"etb4j", {NULL}, 16309, "tcp"}, -{"etb4j", {NULL}, 16309, "udp"}, -{"pduncs", {NULL}, 16310, "tcp"}, -{"pduncs", {NULL}, 16310, "udp"}, -{"pdefmns", {NULL}, 16311, "tcp"}, -{"pdefmns", {NULL}, 16311, "udp"}, -{"netserialext1", {NULL}, 16360, "tcp"}, -{"netserialext1", {NULL}, 16360, "udp"}, -{"netserialext2", {NULL}, 16361, "tcp"}, -{"netserialext2", {NULL}, 16361, "udp"}, -{"netserialext3", {NULL}, 16367, "tcp"}, -{"netserialext3", {NULL}, 16367, "udp"}, -{"netserialext4", {NULL}, 16368, "tcp"}, -{"netserialext4", {NULL}, 16368, "udp"}, -{"connected", {NULL}, 16384, "tcp"}, -{"connected", {NULL}, 16384, "udp"}, -{"xoms", {NULL}, 16619, "tcp"}, -{"newbay-snc-mc", {NULL}, 16900, "tcp"}, -{"newbay-snc-mc", {NULL}, 16900, "udp"}, -{"sgcip", {NULL}, 16950, "tcp"}, -{"sgcip", {NULL}, 16950, "udp"}, -{"intel-rci-mp", {NULL}, 16991, "tcp"}, -{"intel-rci-mp", {NULL}, 16991, "udp"}, -{"amt-soap-http", {NULL}, 16992, "tcp"}, -{"amt-soap-http", {NULL}, 16992, "udp"}, -{"amt-soap-https", {NULL}, 16993, "tcp"}, -{"amt-soap-https", {NULL}, 16993, "udp"}, -{"amt-redir-tcp", {NULL}, 16994, "tcp"}, -{"amt-redir-tcp", {NULL}, 16994, "udp"}, -{"amt-redir-tls", {NULL}, 16995, "tcp"}, -{"amt-redir-tls", {NULL}, 16995, "udp"}, -{"isode-dua", {NULL}, 17007, "tcp"}, -{"isode-dua", {NULL}, 17007, "udp"}, -{"soundsvirtual", {NULL}, 17185, "tcp"}, -{"soundsvirtual", {NULL}, 17185, "udp"}, -{"chipper", {NULL}, 17219, "tcp"}, -{"chipper", {NULL}, 17219, "udp"}, -{"integrius-stp", {NULL}, 17234, "tcp"}, -{"integrius-stp", {NULL}, 17234, "udp"}, -{"ssh-mgmt", {NULL}, 17235, "tcp"}, -{"ssh-mgmt", {NULL}, 17235, "udp"}, -{"db-lsp", {NULL}, 17500, "tcp"}, -{"db-lsp-disc", {NULL}, 17500, "udp"}, -{"ea", {NULL}, 17729, "tcp"}, -{"ea", {NULL}, 17729, "udp"}, -{"zep", {NULL}, 17754, "tcp"}, -{"zep", {NULL}, 17754, "udp"}, -{"zigbee-ip", {NULL}, 17755, "tcp"}, -{"zigbee-ip", {NULL}, 17755, "udp"}, -{"zigbee-ips", {NULL}, 17756, "tcp"}, -{"zigbee-ips", {NULL}, 17756, "udp"}, -{"sw-orion", {NULL}, 17777, "tcp"}, -{"biimenu", {NULL}, 18000, "tcp"}, -{"biimenu", {NULL}, 18000, "udp"}, -{"radpdf", {NULL}, 18104, "tcp"}, -{"racf", {NULL}, 18136, "tcp"}, -{"opsec-cvp", {NULL}, 18181, "tcp"}, -{"opsec-cvp", {NULL}, 18181, "udp"}, -{"opsec-ufp", {NULL}, 18182, "tcp"}, -{"opsec-ufp", {NULL}, 18182, "udp"}, -{"opsec-sam", {NULL}, 18183, "tcp"}, -{"opsec-sam", {NULL}, 18183, "udp"}, -{"opsec-lea", {NULL}, 18184, "tcp"}, -{"opsec-lea", {NULL}, 18184, "udp"}, -{"opsec-omi", {NULL}, 18185, "tcp"}, -{"opsec-omi", {NULL}, 18185, "udp"}, -{"ohsc", {NULL}, 18186, "tcp"}, -{"ohsc", {NULL}, 18186, "udp"}, -{"opsec-ela", {NULL}, 18187, "tcp"}, -{"opsec-ela", {NULL}, 18187, "udp"}, -{"checkpoint-rtm", {NULL}, 18241, "tcp"}, -{"checkpoint-rtm", {NULL}, 18241, "udp"}, -{"gv-pf", {NULL}, 18262, "tcp"}, -{"gv-pf", {NULL}, 18262, "udp"}, -{"ac-cluster", {NULL}, 18463, "tcp"}, -{"ac-cluster", {NULL}, 18463, "udp"}, -{"rds-ib", {NULL}, 18634, "tcp"}, -{"rds-ib", {NULL}, 18634, "udp"}, -{"rds-ip", {NULL}, 18635, "tcp"}, -{"rds-ip", {NULL}, 18635, "udp"}, -{"ique", {NULL}, 18769, "tcp"}, -{"ique", {NULL}, 18769, "udp"}, -{"infotos", {NULL}, 18881, "tcp"}, -{"infotos", {NULL}, 18881, "udp"}, -{"apc-necmp", {NULL}, 18888, "tcp"}, -{"apc-necmp", {NULL}, 18888, "udp"}, -{"igrid", {NULL}, 19000, "tcp"}, -{"igrid", {NULL}, 19000, "udp"}, -{"j-link", {NULL}, 19020, "tcp"}, -{"opsec-uaa", {NULL}, 19191, "tcp"}, -{"opsec-uaa", {NULL}, 19191, "udp"}, -{"ua-secureagent", {NULL}, 19194, "tcp"}, -{"ua-secureagent", {NULL}, 19194, "udp"}, -{"keysrvr", {NULL}, 19283, "tcp"}, -{"keysrvr", {NULL}, 19283, "udp"}, -{"keyshadow", {NULL}, 19315, "tcp"}, -{"keyshadow", {NULL}, 19315, "udp"}, -{"mtrgtrans", {NULL}, 19398, "tcp"}, -{"mtrgtrans", {NULL}, 19398, "udp"}, -{"hp-sco", {NULL}, 19410, "tcp"}, -{"hp-sco", {NULL}, 19410, "udp"}, -{"hp-sca", {NULL}, 19411, "tcp"}, -{"hp-sca", {NULL}, 19411, "udp"}, -{"hp-sessmon", {NULL}, 19412, "tcp"}, -{"hp-sessmon", {NULL}, 19412, "udp"}, -{"fxuptp", {NULL}, 19539, "tcp"}, -{"fxuptp", {NULL}, 19539, "udp"}, -{"sxuptp", {NULL}, 19540, "tcp"}, -{"sxuptp", {NULL}, 19540, "udp"}, -{"jcp", {NULL}, 19541, "tcp"}, -{"jcp", {NULL}, 19541, "udp"}, -{"iec-104-sec", {NULL}, 19998, "tcp"}, -{"dnp-sec", {NULL}, 19999, "tcp"}, -{"dnp-sec", {NULL}, 19999, "udp"}, -{"dnp", {NULL}, 20000, "tcp"}, -{"dnp", {NULL}, 20000, "udp"}, -{"microsan", {NULL}, 20001, "tcp"}, -{"microsan", {NULL}, 20001, "udp"}, -{"commtact-http", {NULL}, 20002, "tcp"}, -{"commtact-http", {NULL}, 20002, "udp"}, -{"commtact-https", {NULL}, 20003, "tcp"}, -{"commtact-https", {NULL}, 20003, "udp"}, -{"openwebnet", {NULL}, 20005, "tcp"}, -{"openwebnet", {NULL}, 20005, "udp"}, -{"ss-idi-disc", {NULL}, 20012, "udp"}, -{"ss-idi", {NULL}, 20013, "tcp"}, -{"opendeploy", {NULL}, 20014, "tcp"}, -{"opendeploy", {NULL}, 20014, "udp"}, -{"nburn_id", {NULL}, 20034, "tcp"}, -{"nburn_id", {NULL}, 20034, "udp"}, -{"tmophl7mts", {NULL}, 20046, "tcp"}, -{"tmophl7mts", {NULL}, 20046, "udp"}, -{"mountd", {NULL}, 20048, "tcp"}, -{"mountd", {NULL}, 20048, "udp"}, -{"nfsrdma", {NULL}, 20049, "tcp"}, -{"nfsrdma", {NULL}, 20049, "udp"}, -{"nfsrdma", {NULL}, 20049, "sctp"}, -{"tolfab", {NULL}, 20167, "tcp"}, -{"tolfab", {NULL}, 20167, "udp"}, -{"ipdtp-port", {NULL}, 20202, "tcp"}, -{"ipdtp-port", {NULL}, 20202, "udp"}, -{"ipulse-ics", {NULL}, 20222, "tcp"}, -{"ipulse-ics", {NULL}, 20222, "udp"}, -{"emwavemsg", {NULL}, 20480, "tcp"}, -{"emwavemsg", {NULL}, 20480, "udp"}, -{"track", {NULL}, 20670, "tcp"}, -{"track", {NULL}, 20670, "udp"}, -{"athand-mmp", {NULL}, 20999, "tcp"}, -{"athand-mmp", {NULL}, 20999, "udp"}, -{"irtrans", {NULL}, 21000, "tcp"}, -{"irtrans", {NULL}, 21000, "udp"}, -{"dfserver", {NULL}, 21554, "tcp"}, -{"dfserver", {NULL}, 21554, "udp"}, -{"vofr-gateway", {NULL}, 21590, "tcp"}, -{"vofr-gateway", {NULL}, 21590, "udp"}, -{"tvpm", {NULL}, 21800, "tcp"}, -{"tvpm", {NULL}, 21800, "udp"}, -{"webphone", {NULL}, 21845, "tcp"}, -{"webphone", {NULL}, 21845, "udp"}, -{"netspeak-is", {NULL}, 21846, "tcp"}, -{"netspeak-is", {NULL}, 21846, "udp"}, -{"netspeak-cs", {NULL}, 21847, "tcp"}, -{"netspeak-cs", {NULL}, 21847, "udp"}, -{"netspeak-acd", {NULL}, 21848, "tcp"}, -{"netspeak-acd", {NULL}, 21848, "udp"}, -{"netspeak-cps", {NULL}, 21849, "tcp"}, -{"netspeak-cps", {NULL}, 21849, "udp"}, -{"snapenetio", {NULL}, 22000, "tcp"}, -{"snapenetio", {NULL}, 22000, "udp"}, -{"optocontrol", {NULL}, 22001, "tcp"}, -{"optocontrol", {NULL}, 22001, "udp"}, -{"optohost002", {NULL}, 22002, "tcp"}, -{"optohost002", {NULL}, 22002, "udp"}, -{"optohost003", {NULL}, 22003, "tcp"}, -{"optohost003", {NULL}, 22003, "udp"}, -{"optohost004", {NULL}, 22004, "tcp"}, -{"optohost004", {NULL}, 22004, "udp"}, -{"optohost004", {NULL}, 22005, "tcp"}, -{"optohost004", {NULL}, 22005, "udp"}, -{"dcap", {NULL}, 22125, "tcp"}, -{"gsidcap", {NULL}, 22128, "tcp"}, -{"wnn6", {NULL}, 22273, "tcp"}, -{"wnn6", {NULL}, 22273, "udp"}, -{"cis", {NULL}, 22305, "tcp"}, -{"cis", {NULL}, 22305, "udp"}, -{"cis-secure", {NULL}, 22343, "tcp"}, -{"cis-secure", {NULL}, 22343, "udp"}, -{"WibuKey", {NULL}, 22347, "tcp"}, -{"WibuKey", {NULL}, 22347, "udp"}, -{"CodeMeter", {NULL}, 22350, "tcp"}, -{"CodeMeter", {NULL}, 22350, "udp"}, -{"vocaltec-wconf", {NULL}, 22555, "tcp"}, -{"vocaltec-phone", {NULL}, 22555, "udp"}, -{"talikaserver", {NULL}, 22763, "tcp"}, -{"talikaserver", {NULL}, 22763, "udp"}, -{"aws-brf", {NULL}, 22800, "tcp"}, -{"aws-brf", {NULL}, 22800, "udp"}, -{"brf-gw", {NULL}, 22951, "tcp"}, -{"brf-gw", {NULL}, 22951, "udp"}, -{"inovaport1", {NULL}, 23000, "tcp"}, -{"inovaport1", {NULL}, 23000, "udp"}, -{"inovaport2", {NULL}, 23001, "tcp"}, -{"inovaport2", {NULL}, 23001, "udp"}, -{"inovaport3", {NULL}, 23002, "tcp"}, -{"inovaport3", {NULL}, 23002, "udp"}, -{"inovaport4", {NULL}, 23003, "tcp"}, -{"inovaport4", {NULL}, 23003, "udp"}, -{"inovaport5", {NULL}, 23004, "tcp"}, -{"inovaport5", {NULL}, 23004, "udp"}, -{"inovaport6", {NULL}, 23005, "tcp"}, -{"inovaport6", {NULL}, 23005, "udp"}, -{"s102", {NULL}, 23272, "udp"}, -{"elxmgmt", {NULL}, 23333, "tcp"}, -{"elxmgmt", {NULL}, 23333, "udp"}, -{"novar-dbase", {NULL}, 23400, "tcp"}, -{"novar-dbase", {NULL}, 23400, "udp"}, -{"novar-alarm", {NULL}, 23401, "tcp"}, -{"novar-alarm", {NULL}, 23401, "udp"}, -{"novar-global", {NULL}, 23402, "tcp"}, -{"novar-global", {NULL}, 23402, "udp"}, -{"aequus", {NULL}, 23456, "tcp"}, -{"aequus-alt", {NULL}, 23457, "tcp"}, -{"med-ltp", {NULL}, 24000, "tcp"}, -{"med-ltp", {NULL}, 24000, "udp"}, -{"med-fsp-rx", {NULL}, 24001, "tcp"}, -{"med-fsp-rx", {NULL}, 24001, "udp"}, -{"med-fsp-tx", {NULL}, 24002, "tcp"}, -{"med-fsp-tx", {NULL}, 24002, "udp"}, -{"med-supp", {NULL}, 24003, "tcp"}, -{"med-supp", {NULL}, 24003, "udp"}, -{"med-ovw", {NULL}, 24004, "tcp"}, -{"med-ovw", {NULL}, 24004, "udp"}, -{"med-ci", {NULL}, 24005, "tcp"}, -{"med-ci", {NULL}, 24005, "udp"}, -{"med-net-svc", {NULL}, 24006, "tcp"}, -{"med-net-svc", {NULL}, 24006, "udp"}, -{"filesphere", {NULL}, 24242, "tcp"}, -{"filesphere", {NULL}, 24242, "udp"}, -{"vista-4gl", {NULL}, 24249, "tcp"}, -{"vista-4gl", {NULL}, 24249, "udp"}, -{"ild", {NULL}, 24321, "tcp"}, -{"ild", {NULL}, 24321, "udp"}, -{"intel_rci", {NULL}, 24386, "tcp"}, -{"intel_rci", {NULL}, 24386, "udp"}, -{"tonidods", {NULL}, 24465, "tcp"}, -{"tonidods", {NULL}, 24465, "udp"}, -{"binkp", {NULL}, 24554, "tcp"}, -{"binkp", {NULL}, 24554, "udp"}, -{"canditv", {NULL}, 24676, "tcp"}, -{"canditv", {NULL}, 24676, "udp"}, -{"flashfiler", {NULL}, 24677, "tcp"}, -{"flashfiler", {NULL}, 24677, "udp"}, -{"proactivate", {NULL}, 24678, "tcp"}, -{"proactivate", {NULL}, 24678, "udp"}, -{"tcc-http", {NULL}, 24680, "tcp"}, -{"tcc-http", {NULL}, 24680, "udp"}, -{"cslg", {NULL}, 24754, "tcp"}, -{"find", {NULL}, 24922, "tcp"}, -{"find", {NULL}, 24922, "udp"}, -{"icl-twobase1", {NULL}, 25000, "tcp"}, -{"icl-twobase1", {NULL}, 25000, "udp"}, -{"icl-twobase2", {NULL}, 25001, "tcp"}, -{"icl-twobase2", {NULL}, 25001, "udp"}, -{"icl-twobase3", {NULL}, 25002, "tcp"}, -{"icl-twobase3", {NULL}, 25002, "udp"}, -{"icl-twobase4", {NULL}, 25003, "tcp"}, -{"icl-twobase4", {NULL}, 25003, "udp"}, -{"icl-twobase5", {NULL}, 25004, "tcp"}, -{"icl-twobase5", {NULL}, 25004, "udp"}, -{"icl-twobase6", {NULL}, 25005, "tcp"}, -{"icl-twobase6", {NULL}, 25005, "udp"}, -{"icl-twobase7", {NULL}, 25006, "tcp"}, -{"icl-twobase7", {NULL}, 25006, "udp"}, -{"icl-twobase8", {NULL}, 25007, "tcp"}, -{"icl-twobase8", {NULL}, 25007, "udp"}, -{"icl-twobase9", {NULL}, 25008, "tcp"}, -{"icl-twobase9", {NULL}, 25008, "udp"}, -{"icl-twobase10", {NULL}, 25009, "tcp"}, -{"icl-twobase10", {NULL}, 25009, "udp"}, -{"rna", {NULL}, 25471, "sctp"}, -{"sauterdongle", {NULL}, 25576, "tcp"}, -{"vocaltec-hos", {NULL}, 25793, "tcp"}, -{"vocaltec-hos", {NULL}, 25793, "udp"}, -{"tasp-net", {NULL}, 25900, "tcp"}, -{"tasp-net", {NULL}, 25900, "udp"}, -{"niobserver", {NULL}, 25901, "tcp"}, -{"niobserver", {NULL}, 25901, "udp"}, -{"nilinkanalyst", {NULL}, 25902, "tcp"}, -{"nilinkanalyst", {NULL}, 25902, "udp"}, -{"niprobe", {NULL}, 25903, "tcp"}, -{"niprobe", {NULL}, 25903, "udp"}, -{"quake", {NULL}, 26000, "tcp"}, -{"quake", {NULL}, 26000, "udp"}, -{"scscp", {NULL}, 26133, "tcp"}, -{"scscp", {NULL}, 26133, "udp"}, -{"wnn6-ds", {NULL}, 26208, "tcp"}, -{"wnn6-ds", {NULL}, 26208, "udp"}, -{"ezproxy", {NULL}, 26260, "tcp"}, -{"ezproxy", {NULL}, 26260, "udp"}, -{"ezmeeting", {NULL}, 26261, "tcp"}, -{"ezmeeting", {NULL}, 26261, "udp"}, -{"k3software-svr", {NULL}, 26262, "tcp"}, -{"k3software-svr", {NULL}, 26262, "udp"}, -{"k3software-cli", {NULL}, 26263, "tcp"}, -{"k3software-cli", {NULL}, 26263, "udp"}, -{"exoline-tcp", {NULL}, 26486, "tcp"}, -{"exoline-udp", {NULL}, 26486, "udp"}, -{"exoconfig", {NULL}, 26487, "tcp"}, -{"exoconfig", {NULL}, 26487, "udp"}, -{"exonet", {NULL}, 26489, "tcp"}, -{"exonet", {NULL}, 26489, "udp"}, -{"imagepump", {NULL}, 27345, "tcp"}, -{"imagepump", {NULL}, 27345, "udp"}, -{"jesmsjc", {NULL}, 27442, "tcp"}, -{"jesmsjc", {NULL}, 27442, "udp"}, -{"kopek-httphead", {NULL}, 27504, "tcp"}, -{"kopek-httphead", {NULL}, 27504, "udp"}, -{"ars-vista", {NULL}, 27782, "tcp"}, -{"ars-vista", {NULL}, 27782, "udp"}, -{"tw-auth-key", {NULL}, 27999, "tcp"}, -{"tw-auth-key", {NULL}, 27999, "udp"}, -{"nxlmd", {NULL}, 28000, "tcp"}, -{"nxlmd", {NULL}, 28000, "udp"}, -{"pqsp", {NULL}, 28001, "tcp"}, -{"siemensgsm", {NULL}, 28240, "tcp"}, -{"siemensgsm", {NULL}, 28240, "udp"}, -{"sgsap", {NULL}, 29118, "sctp"}, -{"otmp", {NULL}, 29167, "tcp"}, -{"otmp", {NULL}, 29167, "udp"}, -{"sbcap", {NULL}, 29168, "sctp"}, -{"iuhsctpassoc", {NULL}, 29169, "sctp"}, -{"pago-services1", {NULL}, 30001, "tcp"}, -{"pago-services1", {NULL}, 30001, "udp"}, -{"pago-services2", {NULL}, 30002, "tcp"}, -{"pago-services2", {NULL}, 30002, "udp"}, -{"kingdomsonline", {NULL}, 30260, "tcp"}, -{"kingdomsonline", {NULL}, 30260, "udp"}, -{"ovobs", {NULL}, 30999, "tcp"}, -{"ovobs", {NULL}, 30999, "udp"}, -{"autotrac-acp", {NULL}, 31020, "tcp"}, -{"yawn", {NULL}, 31029, "udp"}, -{"xqosd", {NULL}, 31416, "tcp"}, -{"xqosd", {NULL}, 31416, "udp"}, -{"tetrinet", {NULL}, 31457, "tcp"}, -{"tetrinet", {NULL}, 31457, "udp"}, -{"lm-mon", {NULL}, 31620, "tcp"}, -{"lm-mon", {NULL}, 31620, "udp"}, -{"dsx_monitor", {NULL}, 31685, "tcp"}, -{"gamesmith-port", {NULL}, 31765, "tcp"}, -{"gamesmith-port", {NULL}, 31765, "udp"}, -{"iceedcp_tx", {NULL}, 31948, "tcp"}, -{"iceedcp_tx", {NULL}, 31948, "udp"}, -{"iceedcp_rx", {NULL}, 31949, "tcp"}, -{"iceedcp_rx", {NULL}, 31949, "udp"}, -{"iracinghelper", {NULL}, 32034, "tcp"}, -{"iracinghelper", {NULL}, 32034, "udp"}, -{"t1distproc60", {NULL}, 32249, "tcp"}, -{"t1distproc60", {NULL}, 32249, "udp"}, -{"apm-link", {NULL}, 32483, "tcp"}, -{"apm-link", {NULL}, 32483, "udp"}, -{"sec-ntb-clnt", {NULL}, 32635, "tcp"}, -{"sec-ntb-clnt", {NULL}, 32635, "udp"}, -{"DMExpress", {NULL}, 32636, "tcp"}, -{"DMExpress", {NULL}, 32636, "udp"}, -{"filenet-powsrm", {NULL}, 32767, "tcp"}, -{"filenet-powsrm", {NULL}, 32767, "udp"}, -{"filenet-tms", {NULL}, 32768, "tcp"}, -{"filenet-tms", {NULL}, 32768, "udp"}, -{"filenet-rpc", {NULL}, 32769, "tcp"}, -{"filenet-rpc", {NULL}, 32769, "udp"}, -{"filenet-nch", {NULL}, 32770, "tcp"}, -{"filenet-nch", {NULL}, 32770, "udp"}, -{"filenet-rmi", {NULL}, 32771, "tcp"}, -{"filenet-rmi", {NULL}, 32771, "udp"}, -{"filenet-pa", {NULL}, 32772, "tcp"}, -{"filenet-pa", {NULL}, 32772, "udp"}, -{"filenet-cm", {NULL}, 32773, "tcp"}, -{"filenet-cm", {NULL}, 32773, "udp"}, -{"filenet-re", {NULL}, 32774, "tcp"}, -{"filenet-re", {NULL}, 32774, "udp"}, -{"filenet-pch", {NULL}, 32775, "tcp"}, -{"filenet-pch", {NULL}, 32775, "udp"}, -{"filenet-peior", {NULL}, 32776, "tcp"}, -{"filenet-peior", {NULL}, 32776, "udp"}, -{"filenet-obrok", {NULL}, 32777, "tcp"}, -{"filenet-obrok", {NULL}, 32777, "udp"}, -{"mlsn", {NULL}, 32801, "tcp"}, -{"mlsn", {NULL}, 32801, "udp"}, -{"retp", {NULL}, 32811, "tcp"}, -{"idmgratm", {NULL}, 32896, "tcp"}, -{"idmgratm", {NULL}, 32896, "udp"}, -{"aurora-balaena", {NULL}, 33123, "tcp"}, -{"aurora-balaena", {NULL}, 33123, "udp"}, -{"diamondport", {NULL}, 33331, "tcp"}, -{"diamondport", {NULL}, 33331, "udp"}, -{"dgi-serv", {NULL}, 33333, "tcp"}, -{"traceroute", {NULL}, 33434, "tcp"}, -{"traceroute", {NULL}, 33434, "udp"}, -{"snip-slave", {NULL}, 33656, "tcp"}, -{"snip-slave", {NULL}, 33656, "udp"}, -{"turbonote-2", {NULL}, 34249, "tcp"}, -{"turbonote-2", {NULL}, 34249, "udp"}, -{"p-net-local", {NULL}, 34378, "tcp"}, -{"p-net-local", {NULL}, 34378, "udp"}, -{"p-net-remote", {NULL}, 34379, "tcp"}, -{"p-net-remote", {NULL}, 34379, "udp"}, -{"dhanalakshmi", {NULL}, 34567, "tcp"}, -{"profinet-rt", {NULL}, 34962, "tcp"}, -{"profinet-rt", {NULL}, 34962, "udp"}, -{"profinet-rtm", {NULL}, 34963, "tcp"}, -{"profinet-rtm", {NULL}, 34963, "udp"}, -{"profinet-cm", {NULL}, 34964, "tcp"}, -{"profinet-cm", {NULL}, 34964, "udp"}, -{"ethercat", {NULL}, 34980, "tcp"}, -{"ethercat", {NULL}, 34980, "udp"}, -{"allpeers", {NULL}, 36001, "tcp"}, -{"allpeers", {NULL}, 36001, "udp"}, -{"s1-control", {NULL}, 36412, "sctp"}, -{"x2-control", {NULL}, 36422, "sctp"}, -{"m2ap", {NULL}, 36443, "sctp"}, -{"m3ap", {NULL}, 36444, "sctp"}, -{"kastenxpipe", {NULL}, 36865, "tcp"}, -{"kastenxpipe", {NULL}, 36865, "udp"}, -{"neckar", {NULL}, 37475, "tcp"}, -{"neckar", {NULL}, 37475, "udp"}, -{"unisys-eportal", {NULL}, 37654, "tcp"}, -{"unisys-eportal", {NULL}, 37654, "udp"}, -{"galaxy7-data", {NULL}, 38201, "tcp"}, -{"galaxy7-data", {NULL}, 38201, "udp"}, -{"fairview", {NULL}, 38202, "tcp"}, -{"fairview", {NULL}, 38202, "udp"}, -{"agpolicy", {NULL}, 38203, "tcp"}, -{"agpolicy", {NULL}, 38203, "udp"}, -{"turbonote-1", {NULL}, 39681, "tcp"}, -{"turbonote-1", {NULL}, 39681, "udp"}, -{"safetynetp", {NULL}, 40000, "tcp"}, -{"safetynetp", {NULL}, 40000, "udp"}, -{"cscp", {NULL}, 40841, "tcp"}, -{"cscp", {NULL}, 40841, "udp"}, -{"csccredir", {NULL}, 40842, "tcp"}, -{"csccredir", {NULL}, 40842, "udp"}, -{"csccfirewall", {NULL}, 40843, "tcp"}, -{"csccfirewall", {NULL}, 40843, "udp"}, -{"ortec-disc", {NULL}, 40853, "udp"}, -{"fs-qos", {NULL}, 41111, "tcp"}, -{"fs-qos", {NULL}, 41111, "udp"}, -{"tentacle", {NULL}, 41121, "tcp"}, -{"crestron-cip", {NULL}, 41794, "tcp"}, -{"crestron-cip", {NULL}, 41794, "udp"}, -{"crestron-ctp", {NULL}, 41795, "tcp"}, -{"crestron-ctp", {NULL}, 41795, "udp"}, -{"candp", {NULL}, 42508, "tcp"}, -{"candp", {NULL}, 42508, "udp"}, -{"candrp", {NULL}, 42509, "tcp"}, -{"candrp", {NULL}, 42509, "udp"}, -{"caerpc", {NULL}, 42510, "tcp"}, -{"caerpc", {NULL}, 42510, "udp"}, -{"reachout", {NULL}, 43188, "tcp"}, -{"reachout", {NULL}, 43188, "udp"}, -{"ndm-agent-port", {NULL}, 43189, "tcp"}, -{"ndm-agent-port", {NULL}, 43189, "udp"}, -{"ip-provision", {NULL}, 43190, "tcp"}, -{"ip-provision", {NULL}, 43190, "udp"}, -{"noit-transport", {NULL}, 43191, "tcp"}, -{"ew-mgmt", {NULL}, 43440, "tcp"}, -{"ew-disc-cmd", {NULL}, 43440, "udp"}, -{"ciscocsdb", {NULL}, 43441, "tcp"}, -{"ciscocsdb", {NULL}, 43441, "udp"}, -{"pmcd", {NULL}, 44321, "tcp"}, -{"pmcd", {NULL}, 44321, "udp"}, -{"pmcdproxy", {NULL}, 44322, "tcp"}, -{"pmcdproxy", {NULL}, 44322, "udp"}, -{"pcp", {NULL}, 44323, "udp"}, -{"rbr-debug", {NULL}, 44553, "tcp"}, -{"rbr-debug", {NULL}, 44553, "udp"}, -{"EtherNet/IP-2", {NULL}, 44818, "tcp"}, -{"EtherNet/IP-2", {NULL}, 44818, "udp"}, -{"invision-ag", {NULL}, 45054, "tcp"}, -{"invision-ag", {NULL}, 45054, "udp"}, -{"eba", {NULL}, 45678, "tcp"}, -{"eba", {NULL}, 45678, "udp"}, -{"qdb2service", {NULL}, 45825, "tcp"}, -{"qdb2service", {NULL}, 45825, "udp"}, -{"ssr-servermgr", {NULL}, 45966, "tcp"}, -{"ssr-servermgr", {NULL}, 45966, "udp"}, -{"mediabox", {NULL}, 46999, "tcp"}, -{"mediabox", {NULL}, 46999, "udp"}, -{"mbus", {NULL}, 47000, "tcp"}, -{"mbus", {NULL}, 47000, "udp"}, -{"winrm", {NULL}, 47001, "tcp"}, -{"dbbrowse", {NULL}, 47557, "tcp"}, -{"dbbrowse", {NULL}, 47557, "udp"}, -{"directplaysrvr", {NULL}, 47624, "tcp"}, -{"directplaysrvr", {NULL}, 47624, "udp"}, -{"ap", {NULL}, 47806, "tcp"}, -{"ap", {NULL}, 47806, "udp"}, -{"bacnet", {NULL}, 47808, "tcp"}, -{"bacnet", {NULL}, 47808, "udp"}, -{"nimcontroller", {NULL}, 48000, "tcp"}, -{"nimcontroller", {NULL}, 48000, "udp"}, -{"nimspooler", {NULL}, 48001, "tcp"}, -{"nimspooler", {NULL}, 48001, "udp"}, -{"nimhub", {NULL}, 48002, "tcp"}, -{"nimhub", {NULL}, 48002, "udp"}, -{"nimgtw", {NULL}, 48003, "tcp"}, -{"nimgtw", {NULL}, 48003, "udp"}, -{"nimbusdb", {NULL}, 48004, "tcp"}, -{"nimbusdbctrl", {NULL}, 48005, "tcp"}, -{"3gpp-cbsp", {NULL}, 48049, "tcp"}, -{"isnetserv", {NULL}, 48128, "tcp"}, -{"isnetserv", {NULL}, 48128, "udp"}, -{"blp5", {NULL}, 48129, "tcp"}, -{"blp5", {NULL}, 48129, "udp"}, -{"com-bardac-dw", {NULL}, 48556, "tcp"}, -{"com-bardac-dw", {NULL}, 48556, "udp"}, -{"iqobject", {NULL}, 48619, "tcp"}, -{"iqobject", {NULL}, 48619, "udp"}, -#endif /* USE_IANA_REGISTERED_PORTS */ -{ NULL, {NULL}, 0, NULL } -}; - -struct servent *getservbyport(int port, const char *proto) -{ - unsigned short u_port; - const char *protocol = NULL; - int i, error = 0; - - u_port = ntohs((unsigned short)port); - - if (proto) - { - switch (strlen(proto)) { - case 3: - if (!strncasecmp(proto, "tcp", 3)) - protocol = "tcp"; - else if (!strncasecmp(proto, "udp", 3)) - protocol = "udp"; - else - error = WSAEFAULT; - break; - case 4: - if (!strncasecmp(proto, "sctp", 4)) - protocol = "sctp"; - else if (!strncasecmp(proto, "dccp", 4)) - protocol = "dccp"; - else - error = WSAEFAULT; - break; - default: - error = WSAEFAULT; - } - } - - if (!error) - { - for (i = 0; i < (sizeof(IANAports) / sizeof(IANAports[0])) - 1; i++) - { - if (u_port == IANAports[i].s_port) - { - if (!protocol || !strcasecmp(protocol, IANAports[i].s_proto)) - return (struct servent *)&IANAports[i]; - } - } - error = WSANO_DATA; - } - - SET_SOCKERRNO(error); - return NULL; -} - -#endif /* _WIN32_WCE */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_platform.h b/lib/c-ares-1.19.1/src/lib/ares_platform.h deleted file mode 100644 index e6885ae5461..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_platform.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef HEADER_CARES_PLATFORM_H -#define HEADER_CARES_PLATFORM_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004 - 2011 by Daniel Stenberg et al - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#if defined(WIN32) && !defined(MSDOS) - -typedef enum { - WIN_UNKNOWN, - WIN_3X, - WIN_9X, - WIN_NT, - WIN_CE -} win_platform; - -win_platform ares__getplatform(void); - -#endif - -#if defined(_WIN32_WCE) - -struct servent *getservbyport(int port, const char *proto); - -#endif - -#endif /* HEADER_CARES_PLATFORM_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_private.h b/lib/c-ares-1.19.1/src/lib/ares_private.h deleted file mode 100644 index b6eab8a7d9b..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_private.h +++ /dev/null @@ -1,437 +0,0 @@ -#ifndef __ARES_PRIVATE_H -#define __ARES_PRIVATE_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2010 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -/* - * Define WIN32 when build target is Win32 API - */ - -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -#define WIN32 -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef WATT32 -#include -#include -#define writev(s,v,c) writev_s(s,v,c) -#define HAVE_WRITEV 1 -#endif - -#define DEFAULT_TIMEOUT 5000 /* milliseconds */ -#define DEFAULT_TRIES 4 -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -#ifdef CARES_EXPOSE_STATICS -/* Make some internal functions visible for testing */ -#define STATIC_TESTABLE -#else -#define STATIC_TESTABLE static -#endif - -/* By using a double cast, we can get rid of the bogus warning of - * warning: cast from 'const struct sockaddr *' to 'const struct sockaddr_in6 *' increases required alignment from 1 to 4 [-Wcast-align] - */ -#define CARES_INADDR_CAST(type, var) ((type)((void *)var)) - -#if defined(WIN32) && !defined(WATT32) - -#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" -#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" -#define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient" -#define WIN_NT_DNSCLIENT "Software\\Policies\\Microsoft\\Windows NT\\DNSClient" -#define NAMESERVER "NameServer" -#define DHCPNAMESERVER "DhcpNameServer" -#define DATABASEPATH "DatabasePath" -#define WIN_PATH_HOSTS "\\hosts" -#define SEARCHLIST_KEY "SearchList" -#define PRIMARYDNSSUFFIX_KEY "PrimaryDNSSuffix" -#define INTERFACES_KEY "Interfaces" -#define DOMAIN_KEY "Domain" -#define DHCPDOMAIN_KEY "DhcpDomain" - -#elif defined(WATT32) - -#define PATH_RESOLV_CONF "/dev/ENV/etc/resolv.conf" -W32_FUNC const char *_w32_GetHostsFile (void); - -#elif defined(NETWARE) - -#define PATH_RESOLV_CONF "sys:/etc/resolv.cfg" -#define PATH_HOSTS "sys:/etc/hosts" - -#elif defined(__riscos__) - -#define PATH_HOSTS "InetDBase:Hosts" - -#elif defined(__HAIKU__) - -#define PATH_RESOLV_CONF "/system/settings/network/resolv.conf" -#define PATH_HOSTS "/system/settings/network/hosts" - -#else - -#define PATH_RESOLV_CONF "/etc/resolv.conf" -#ifdef ETC_INET -#define PATH_HOSTS "/etc/inet/hosts" -#else -#define PATH_HOSTS "/etc/hosts" -#endif - -#endif - -#include "ares_ipv6.h" -#include "ares_llist.h" - -#ifndef HAVE_GETENV -# include "ares_getenv.h" -# define getenv(ptr) ares_getenv(ptr) -#endif - -#include "ares_strdup.h" -#include "ares_strsplit.h" - -#ifndef HAVE_STRCASECMP -# include "ares_strcasecmp.h" -# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2) -#endif - -#ifndef HAVE_STRNCASECMP -# include "ares_strcasecmp.h" -# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n) -#endif - -#ifndef HAVE_WRITEV -# include "ares_writev.h" -# define writev(s,ptr,cnt) ares_writev(s,ptr,cnt) -#endif - -/********* EDNS defines section ******/ -#define EDNSPACKETSZ 1280 /* Reasonable UDP payload size, as suggested - in RFC2671 */ -#define MAXENDSSZ 4096 /* Maximum (local) limit for edns packet size */ -#define EDNSFIXEDSZ 11 /* Size of EDNS header */ -/********* EDNS defines section ******/ - -struct ares_addr { - int family; - union { - struct in_addr addr4; - struct ares_in6_addr addr6; - } addr; - int udp_port; /* stored in network order */ - int tcp_port; /* stored in network order */ -}; -#define addrV4 addr.addr4 -#define addrV6 addr.addr6 - -struct query; - -struct send_request { - /* Remaining data to send */ - const unsigned char *data; - size_t len; - - /* The query for which we're sending this data */ - struct query* owner_query; - /* The buffer we're using, if we have our own copy of the packet */ - unsigned char *data_storage; - - /* Next request in queue */ - struct send_request *next; -}; - -struct server_state { - struct ares_addr addr; - ares_socket_t udp_socket; - ares_socket_t tcp_socket; - - /* Mini-buffer for reading the length word */ - unsigned char tcp_lenbuf[2]; - int tcp_lenbuf_pos; - int tcp_length; - - /* Buffer for reading actual TCP data */ - unsigned char *tcp_buffer; - int tcp_buffer_pos; - - /* TCP output queue */ - struct send_request *qhead; - struct send_request *qtail; - - /* Which incarnation of this connection is this? We don't want to - * retransmit requests into the very same socket, but if the server - * closes on us and we re-open the connection, then we do want to - * re-send. */ - int tcp_connection_generation; - - /* Circular, doubly-linked list of outstanding queries to this server */ - struct list_node queries_to_server; - - /* Link back to owning channel */ - ares_channel channel; - - /* Is this server broken? We mark connections as broken when a - * request that is queued for sending times out. - */ - int is_broken; -}; - -/* State to represent a DNS query */ -struct query { - /* Query ID from qbuf, for faster lookup, and current timeout */ - unsigned short qid; - struct timeval timeout; - - /* - * Links for the doubly-linked lists in which we insert a query. - * These circular, doubly-linked lists that are hash-bucketed based - * the attributes we care about, help making most important - * operations O(1). - */ - struct list_node queries_by_qid; /* hopefully in same cache line as qid */ - struct list_node queries_by_timeout; - struct list_node queries_to_server; - struct list_node all_queries; - - /* Query buf with length at beginning, for TCP transmission */ - unsigned char *tcpbuf; - int tcplen; - - /* Arguments passed to ares_send() (qbuf points into tcpbuf) */ - const unsigned char *qbuf; - int qlen; - ares_callback callback; - void *arg; - - /* Query status */ - int try_count; /* Number of times we tried this query already. */ - int server; /* Server this query has last been sent to. */ - struct query_server_info *server_info; /* per-server state */ - int using_tcp; - int error_status; - int timeouts; /* number of timeouts we saw for this request */ -}; - -/* Per-server state for a query */ -struct query_server_info { - int skip_server; /* should we skip server, due to errors, etc? */ - int tcp_connection_generation; /* into which TCP connection did we send? */ -}; - -/* An IP address pattern; matches an IP address X if X & mask == addr */ -#define PATTERN_MASK 0x1 -#define PATTERN_CIDR 0x2 - -struct apattern { - union - { - struct in_addr addr4; - struct ares_in6_addr addr6; - } addr; - union - { - struct in_addr addr4; - struct ares_in6_addr addr6; - unsigned short bits; - } mask; - int family; - unsigned short type; -}; - -struct ares_rand_state; -typedef struct ares_rand_state ares_rand_state; - -struct ares_channeldata { - /* Configuration data */ - int flags; - int timeout; /* in milliseconds */ - int tries; - int ndots; - int rotate; /* if true, all servers specified are used */ - int udp_port; /* stored in network order */ - int tcp_port; /* stored in network order */ - int socket_send_buffer_size; - int socket_receive_buffer_size; - char **domains; - int ndomains; - struct apattern *sortlist; - int nsort; - char *lookups; - int ednspsz; - - /* For binding to local devices and/or IP addresses. Leave - * them null/zero for no binding. - */ - char local_dev_name[32]; - unsigned int local_ip4; - unsigned char local_ip6[16]; - - int optmask; /* the option bitfield passed in at init time */ - - /* Server addresses and communications state */ - struct server_state *servers; - int nservers; - - /* ID to use for next query */ - unsigned short next_id; - /* random state to use when generating new ids */ - ares_rand_state *rand_state; - - /* Generation number to use for the next TCP socket open/close */ - int tcp_connection_generation; - - /* The time at which we last called process_timeouts(). Uses integer seconds - just to draw the line somewhere. */ - time_t last_timeout_processed; - - /* Last server we sent a query to. */ - int last_server; - - /* Circular, doubly-linked list of queries, bucketed various ways.... */ - /* All active queries in a single list: */ - struct list_node all_queries; - /* Queries bucketed by qid, for quickly dispatching DNS responses: */ -#define ARES_QID_TABLE_SIZE 2048 - struct list_node queries_by_qid[ARES_QID_TABLE_SIZE]; - /* Queries bucketed by timeout, for quickly handling timeouts: */ -#define ARES_TIMEOUT_TABLE_SIZE 1024 - struct list_node queries_by_timeout[ARES_TIMEOUT_TABLE_SIZE]; - - ares_sock_state_cb sock_state_cb; - void *sock_state_cb_data; - - ares_sock_create_callback sock_create_cb; - void *sock_create_cb_data; - - ares_sock_config_callback sock_config_cb; - void *sock_config_cb_data; - - const struct ares_socket_functions * sock_funcs; - void *sock_func_cb_data; - - /* Path for resolv.conf file, configurable via ares_options */ - char *resolvconf_path; - - /* Path for hosts file, configurable via ares_options */ - char *hosts_path; -}; - -/* Does the domain end in ".onion" or ".onion."? Case-insensitive. */ -int ares__is_onion_domain(const char *name); - -/* Memory management functions */ -extern void *(*ares_malloc)(size_t size); -extern void *(*ares_realloc)(void *ptr, size_t size); -extern void (*ares_free)(void *ptr); - -/* return true if now is exactly check time or later */ -int ares__timedout(struct timeval *now, - struct timeval *check); - -void ares__send_query(ares_channel channel, struct query *query, - struct timeval *now); -void ares__close_sockets(ares_channel channel, struct server_state *server); -int ares__get_hostent(FILE *fp, int family, struct hostent **host); -int ares__read_line(FILE *fp, char **buf, size_t *bufsize); -void ares__free_query(struct query *query); - -ares_rand_state *ares__init_rand_state(void); -void ares__destroy_rand_state(ares_rand_state *state); -unsigned short ares__generate_new_id(ares_rand_state *state); -struct timeval ares__tvnow(void); -int ares__expand_name_validated(const unsigned char *encoded, - const unsigned char *abuf, - int alen, char **s, long *enclen, - int is_hostname); -int ares__expand_name_for_response(const unsigned char *encoded, - const unsigned char *abuf, int alen, - char **s, long *enclen, int is_hostname); -void ares__init_servers_state(ares_channel channel); -void ares__destroy_servers_state(ares_channel channel); -int ares__parse_qtype_reply(const unsigned char* abuf, int alen, int* qtype); -int ares__single_domain(ares_channel channel, const char *name, char **s); -int ares__cat_domain(const char *name, const char *domain, char **s); -int ares__sortaddrinfo(ares_channel channel, struct ares_addrinfo_node *ai_node); -int ares__readaddrinfo(FILE *fp, const char *name, unsigned short port, - const struct ares_addrinfo_hints *hints, - struct ares_addrinfo *ai); - -struct ares_addrinfo *ares__malloc_addrinfo(void); - -struct ares_addrinfo_node *ares__malloc_addrinfo_node(void); -void ares__freeaddrinfo_nodes(struct ares_addrinfo_node *ai_node); - -struct ares_addrinfo_node *ares__append_addrinfo_node(struct ares_addrinfo_node **ai_node); -void ares__addrinfo_cat_nodes(struct ares_addrinfo_node **head, - struct ares_addrinfo_node *tail); - -struct ares_addrinfo_cname *ares__malloc_addrinfo_cname(void); -void ares__freeaddrinfo_cnames(struct ares_addrinfo_cname *ai_cname); - -struct ares_addrinfo_cname *ares__append_addrinfo_cname(struct ares_addrinfo_cname **ai_cname); - -int ares_append_ai_node(int aftype, unsigned short port, int ttl, - const void *adata, - struct ares_addrinfo_node **nodes); - -void ares__addrinfo_cat_cnames(struct ares_addrinfo_cname **head, - struct ares_addrinfo_cname *tail); - -int ares__parse_into_addrinfo(const unsigned char *abuf, - int alen, int cname_only_is_enodata, - unsigned short port, - struct ares_addrinfo *ai); - -int ares__addrinfo2hostent(const struct ares_addrinfo *ai, int family, - struct hostent **host); -int ares__addrinfo2addrttl(const struct ares_addrinfo *ai, int family, - int req_naddrttls, struct ares_addrttl *addrttls, - struct ares_addr6ttl *addr6ttls, int *naddrttls); -int ares__addrinfo_localhost(const char *name, unsigned short port, - const struct ares_addrinfo_hints *hints, - struct ares_addrinfo *ai); - -#if 0 /* Not used */ -long ares__tvdiff(struct timeval t1, struct timeval t2); -#endif - -ares_socket_t ares__open_socket(ares_channel channel, - int af, int type, int protocol); -void ares__close_socket(ares_channel, ares_socket_t); -int ares__connect_socket(ares_channel channel, - ares_socket_t sockfd, - const struct sockaddr *addr, - ares_socklen_t addrlen); - -#define ARES_SWAP_BYTE(a,b) \ - { unsigned char swapByte = *(a); *(a) = *(b); *(b) = swapByte; } - -#define SOCK_STATE_CALLBACK(c, s, r, w) \ - do { \ - if ((c)->sock_state_cb) \ - (c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w)); \ - } WHILE_FALSE - -#endif /* __ARES_PRIVATE_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_process.c b/lib/c-ares-1.19.1/src/lib/ares_process.c deleted file mode 100644 index 6cac0a99fdf..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_process.c +++ /dev/null @@ -1,1587 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2017 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_SYS_UIO_H -# include -#endif -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETINET_TCP_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_SYS_IOCTL_H -# include -#endif -#ifdef NETWARE -# include -#endif - -#include -#include -#include - -#include "ares.h" -#include "ares_dns.h" -#include "ares_nowarn.h" -#include "ares_private.h" - - -static int try_again(int errnum); -static void write_tcp_data(ares_channel channel, fd_set *write_fds, - ares_socket_t write_fd, struct timeval *now); -static void read_tcp_data(ares_channel channel, fd_set *read_fds, - ares_socket_t read_fd, struct timeval *now); -static void read_udp_packets(ares_channel channel, fd_set *read_fds, - ares_socket_t read_fd, struct timeval *now); -static void advance_tcp_send_queue(ares_channel channel, int whichserver, - ares_ssize_t num_bytes); -static void process_timeouts(ares_channel channel, struct timeval *now); -static void process_broken_connections(ares_channel channel, - struct timeval *now); -static void process_answer(ares_channel channel, unsigned char *abuf, - int alen, int whichserver, int tcp, - struct timeval *now); -static void handle_error(ares_channel channel, int whichserver, - struct timeval *now); -static void skip_server(ares_channel channel, struct query *query, - int whichserver); -static void next_server(ares_channel channel, struct query *query, - struct timeval *now); -static int open_tcp_socket(ares_channel channel, struct server_state *server); -static int open_udp_socket(ares_channel channel, struct server_state *server); -static int same_questions(const unsigned char *qbuf, int qlen, - const unsigned char *abuf, int alen); -static int same_address(struct sockaddr *sa, struct ares_addr *aa); -static int has_opt_rr(const unsigned char *abuf, int alen); -static void end_query(ares_channel channel, struct query *query, int status, - unsigned char *abuf, int alen); - -/* return true if now is exactly check time or later */ -int ares__timedout(struct timeval *now, - struct timeval *check) -{ - long secs = (now->tv_sec - check->tv_sec); - - if(secs > 0) - return 1; /* yes, timed out */ - if(secs < 0) - return 0; /* nope, not timed out */ - - /* if the full seconds were identical, check the sub second parts */ - return (now->tv_usec - check->tv_usec >= 0); -} - -/* add the specific number of milliseconds to the time in the first argument */ -static void timeadd(struct timeval *now, int millisecs) -{ - now->tv_sec += millisecs/1000; - now->tv_usec += (millisecs%1000)*1000; - - if(now->tv_usec >= 1000000) { - ++(now->tv_sec); - now->tv_usec -= 1000000; - } -} - -/* - * generic process function - */ -static void processfds(ares_channel channel, - fd_set *read_fds, ares_socket_t read_fd, - fd_set *write_fds, ares_socket_t write_fd) -{ - struct timeval now = ares__tvnow(); - - write_tcp_data(channel, write_fds, write_fd, &now); - read_tcp_data(channel, read_fds, read_fd, &now); - read_udp_packets(channel, read_fds, read_fd, &now); - process_timeouts(channel, &now); - process_broken_connections(channel, &now); -} - -/* Something interesting happened on the wire, or there was a timeout. - * See what's up and respond accordingly. - */ -void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds) -{ - processfds(channel, read_fds, ARES_SOCKET_BAD, write_fds, ARES_SOCKET_BAD); -} - -/* Something interesting happened on the wire, or there was a timeout. - * See what's up and respond accordingly. - */ -void ares_process_fd(ares_channel channel, - ares_socket_t read_fd, /* use ARES_SOCKET_BAD or valid - file descriptors */ - ares_socket_t write_fd) -{ - processfds(channel, NULL, read_fd, NULL, write_fd); -} - - -/* Return 1 if the specified error number describes a readiness error, or 0 - * otherwise. This is mostly for HP-UX, which could return EAGAIN or - * EWOULDBLOCK. See this man page - * - * http://devrsrc1.external.hp.com/STKS/cgi-bin/man2html? - * manpage=/usr/share/man/man2.Z/send.2 - */ -static int try_again(int errnum) -{ -#if !defined EWOULDBLOCK && !defined EAGAIN -#error "Neither EWOULDBLOCK nor EAGAIN defined" -#endif - switch (errnum) - { -#ifdef EWOULDBLOCK - case EWOULDBLOCK: - return 1; -#endif -#if defined EAGAIN && EAGAIN != EWOULDBLOCK - case EAGAIN: - return 1; -#endif - } - return 0; -} - -static ares_ssize_t socket_writev(ares_channel channel, ares_socket_t s, const struct iovec * vec, int len) -{ - if (channel->sock_funcs) - return channel->sock_funcs->asendv(s, vec, len, channel->sock_func_cb_data); - - return writev(s, vec, len); -} - -static ares_ssize_t socket_write(ares_channel channel, ares_socket_t s, const void * data, size_t len) -{ - if (channel->sock_funcs) - { - struct iovec vec; - vec.iov_base = (void*)data; - vec.iov_len = len; - return channel->sock_funcs->asendv(s, &vec, 1, channel->sock_func_cb_data); - } - return swrite(s, data, len); -} - -/* If any TCP sockets select true for writing, write out queued data - * we have for them. - */ -static void write_tcp_data(ares_channel channel, - fd_set *write_fds, - ares_socket_t write_fd, - struct timeval *now) -{ - struct server_state *server; - struct send_request *sendreq; - struct iovec *vec; - int i; - ares_ssize_t scount; - ares_ssize_t wcount; - size_t n; - /* From writev manpage: An implementation can advertise its limit by defining - IOV_MAX in or at run time via the return value from - sysconf(_SC_IOV_MAX). On modern Linux systems, the limit is 1024. Back in - Linux 2.0 days, this limit was 16. */ -#if defined(IOV_MAX) - const size_t maxn = IOV_MAX; /* FreeBSD */ -#elif defined(_SC_IOV_MAX) - const size_t maxn = sysconf(_SC_IOV_MAX); /* Linux */ -#else - const size_t maxn = 16; /* Safe default */ -#endif - - if(!write_fds && (write_fd == ARES_SOCKET_BAD)) - /* no possible action */ - return; - - for (i = 0; i < channel->nservers; i++) - { - /* Make sure server has data to send and is selected in write_fds or - write_fd. */ - server = &channel->servers[i]; - if (!server->qhead || server->tcp_socket == ARES_SOCKET_BAD || - server->is_broken) - continue; - - if(write_fds) { - if(!FD_ISSET(server->tcp_socket, write_fds)) - continue; - } - else { - if(server->tcp_socket != write_fd) - continue; - } - - if(write_fds) - /* If there's an error and we close this socket, then open - * another with the same fd to talk to another server, then we - * don't want to think that it was the new socket that was - * ready. This is not disastrous, but is likely to result in - * extra system calls and confusion. */ - FD_CLR(server->tcp_socket, write_fds); - - /* Count the number of send queue items. */ - n = 0; - for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) - n++; - - /* Allocate iovecs so we can send all our data at once. */ - vec = ares_malloc(n * sizeof(struct iovec)); - if (vec) - { - /* Fill in the iovecs and send. */ - n = 0; - for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) - { - vec[n].iov_base = (char *) sendreq->data; - vec[n].iov_len = sendreq->len; - n++; - if(n >= maxn) - break; - } - wcount = socket_writev(channel, server->tcp_socket, vec, (int)n); - ares_free(vec); - if (wcount < 0) - { - if (!try_again(SOCKERRNO)) - handle_error(channel, i, now); - continue; - } - - /* Advance the send queue by as many bytes as we sent. */ - advance_tcp_send_queue(channel, i, wcount); - } - else - { - /* Can't allocate iovecs; just send the first request. */ - sendreq = server->qhead; - - scount = socket_write(channel, server->tcp_socket, sendreq->data, sendreq->len); - if (scount < 0) - { - if (!try_again(SOCKERRNO)) - handle_error(channel, i, now); - continue; - } - - /* Advance the send queue by as many bytes as we sent. */ - advance_tcp_send_queue(channel, i, scount); - } - } -} - -/* Consume the given number of bytes from the head of the TCP send queue. */ -static void advance_tcp_send_queue(ares_channel channel, int whichserver, - ares_ssize_t num_bytes) -{ - struct send_request *sendreq; - struct server_state *server = &channel->servers[whichserver]; - while (num_bytes > 0) { - sendreq = server->qhead; - if ((size_t)num_bytes >= sendreq->len) { - num_bytes -= sendreq->len; - server->qhead = sendreq->next; - if (sendreq->data_storage) - ares_free(sendreq->data_storage); - ares_free(sendreq); - if (server->qhead == NULL) { - SOCK_STATE_CALLBACK(channel, server->tcp_socket, 1, 0); - server->qtail = NULL; - - /* qhead is NULL so we cannot continue this loop */ - break; - } - } - else { - sendreq->data += num_bytes; - sendreq->len -= num_bytes; - num_bytes = 0; - } - } -} - -static ares_ssize_t socket_recvfrom(ares_channel channel, - ares_socket_t s, - void * data, - size_t data_len, - int flags, - struct sockaddr *from, - ares_socklen_t *from_len) -{ - if (channel->sock_funcs) - return channel->sock_funcs->arecvfrom(s, data, data_len, - flags, from, from_len, - channel->sock_func_cb_data); - -#ifdef HAVE_RECVFROM - return recvfrom(s, data, data_len, flags, from, from_len); -#else - return sread(s, data, data_len); -#endif -} - -static ares_ssize_t socket_recv(ares_channel channel, - ares_socket_t s, - void * data, - size_t data_len) -{ - if (channel->sock_funcs) - return channel->sock_funcs->arecvfrom(s, data, data_len, 0, 0, 0, - channel->sock_func_cb_data); - - return sread(s, data, data_len); -} - -/* If any TCP socket selects true for reading, read some data, - * allocate a buffer if we finish reading the length word, and process - * a packet if we finish reading one. - */ -static void read_tcp_data(ares_channel channel, fd_set *read_fds, - ares_socket_t read_fd, struct timeval *now) -{ - struct server_state *server; - int i; - ares_ssize_t count; - - if(!read_fds && (read_fd == ARES_SOCKET_BAD)) - /* no possible action */ - return; - - for (i = 0; i < channel->nservers; i++) - { - /* Make sure the server has a socket and is selected in read_fds. */ - server = &channel->servers[i]; - if (server->tcp_socket == ARES_SOCKET_BAD || server->is_broken) - continue; - - if(read_fds) { - if(!FD_ISSET(server->tcp_socket, read_fds)) - continue; - } - else { - if(server->tcp_socket != read_fd) - continue; - } - - if(read_fds) - /* If there's an error and we close this socket, then open another - * with the same fd to talk to another server, then we don't want to - * think that it was the new socket that was ready. This is not - * disastrous, but is likely to result in extra system calls and - * confusion. */ - FD_CLR(server->tcp_socket, read_fds); - - if (server->tcp_lenbuf_pos != 2) - { - /* We haven't yet read a length word, so read that (or - * what's left to read of it). - */ - count = socket_recv(channel, server->tcp_socket, - server->tcp_lenbuf + server->tcp_lenbuf_pos, - 2 - server->tcp_lenbuf_pos); - if (count <= 0) - { - if (!(count == -1 && try_again(SOCKERRNO))) - handle_error(channel, i, now); - continue; - } - - server->tcp_lenbuf_pos += (int)count; - if (server->tcp_lenbuf_pos == 2) - { - /* We finished reading the length word. Decode the - * length and allocate a buffer for the data. - */ - server->tcp_length = server->tcp_lenbuf[0] << 8 - | server->tcp_lenbuf[1]; - server->tcp_buffer = ares_malloc(server->tcp_length); - if (!server->tcp_buffer) { - handle_error(channel, i, now); - return; /* bail out on malloc failure. TODO: make this - function return error codes */ - } - server->tcp_buffer_pos = 0; - } - } - else - { - /* Read data into the allocated buffer. */ - count = socket_recv(channel, server->tcp_socket, - server->tcp_buffer + server->tcp_buffer_pos, - server->tcp_length - server->tcp_buffer_pos); - if (count <= 0) - { - if (!(count == -1 && try_again(SOCKERRNO))) - handle_error(channel, i, now); - continue; - } - - server->tcp_buffer_pos += (int)count; - if (server->tcp_buffer_pos == server->tcp_length) - { - /* We finished reading this answer; process it and - * prepare to read another length word. - */ - process_answer(channel, server->tcp_buffer, server->tcp_length, - i, 1, now); - ares_free(server->tcp_buffer); - server->tcp_buffer = NULL; - server->tcp_lenbuf_pos = 0; - server->tcp_buffer_pos = 0; - } - } - } -} - -/* If any UDP sockets select true for reading, process them. */ -static void read_udp_packets(ares_channel channel, fd_set *read_fds, - ares_socket_t read_fd, struct timeval *now) -{ - struct server_state *server; - int i; - ares_ssize_t read_len; - unsigned char buf[MAXENDSSZ + 1]; -#ifdef HAVE_RECVFROM - ares_socklen_t fromlen; - union { - struct sockaddr sa; - struct sockaddr_in sa4; - struct sockaddr_in6 sa6; - } from; -#endif - - if(!read_fds && (read_fd == ARES_SOCKET_BAD)) - /* no possible action */ - return; - - for (i = 0; i < channel->nservers; i++) - { - /* Make sure the server has a socket and is selected in read_fds. */ - server = &channel->servers[i]; - - if (server->udp_socket == ARES_SOCKET_BAD || server->is_broken) - continue; - - if(read_fds) { - if(!FD_ISSET(server->udp_socket, read_fds)) - continue; - } - else { - if(server->udp_socket != read_fd) - continue; - } - - if(read_fds) - /* If there's an error and we close this socket, then open - * another with the same fd to talk to another server, then we - * don't want to think that it was the new socket that was - * ready. This is not disastrous, but is likely to result in - * extra system calls and confusion. */ - FD_CLR(server->udp_socket, read_fds); - - /* To reduce event loop overhead, read and process as many - * packets as we can. */ - do { - if (server->udp_socket == ARES_SOCKET_BAD) { - read_len = -1; - } else { - if (server->addr.family == AF_INET) { - fromlen = sizeof(from.sa4); - } else { - fromlen = sizeof(from.sa6); - } - read_len = socket_recvfrom(channel, server->udp_socket, (void *)buf, - sizeof(buf), 0, &from.sa, &fromlen); - } - - if (read_len == 0) { - /* UDP is connectionless, so result code of 0 is a 0-length UDP - * packet, and not an indication the connection is closed like on - * tcp */ - continue; - } else if (read_len < 0) { - if (try_again(SOCKERRNO)) - continue; - - handle_error(channel, i, now); - -#ifdef HAVE_RECVFROM - } else if (!same_address(&from.sa, &server->addr)) { - /* The address the response comes from does not match the address we - * sent the request to. Someone may be attempting to perform a cache - * poisoning attack. */ - continue; -#endif - - } else { - process_answer(channel, buf, (int)read_len, i, 0, now); - } - } while (read_len >= 0); - } -} - -/* If any queries have timed out, note the timeout and move them on. */ -static void process_timeouts(ares_channel channel, struct timeval *now) -{ - time_t t; /* the time of the timeouts we're processing */ - struct query *query; - struct list_node* list_head; - struct list_node* list_node; - - /* Process all the timeouts that have fired since the last time we processed - * timeouts. If things are going well, then we'll have hundreds/thousands of - * queries that fall into future buckets, and only a handful of requests - * that fall into the "now" bucket, so this should be quite quick. - */ - for (t = channel->last_timeout_processed; t <= now->tv_sec; t++) - { - list_head = &(channel->queries_by_timeout[t % ARES_TIMEOUT_TABLE_SIZE]); - for (list_node = list_head->next; list_node != list_head; ) - { - query = list_node->data; - list_node = list_node->next; /* in case the query gets deleted */ - if (query->timeout.tv_sec && ares__timedout(now, &query->timeout)) - { - query->error_status = ARES_ETIMEOUT; - ++query->timeouts; - next_server(channel, query, now); - } - } - } - channel->last_timeout_processed = now->tv_sec; -} - -/* Handle an answer from a server. */ -static void process_answer(ares_channel channel, unsigned char *abuf, - int alen, int whichserver, int tcp, - struct timeval *now) -{ - int tc, rcode, packetsz; - unsigned short id; - struct query *query; - struct list_node* list_head; - struct list_node* list_node; - - /* If there's no room in the answer for a header, we can't do much - * with it. */ - if (alen < HFIXEDSZ) - return; - - /* Grab the query ID, truncate bit, and response code from the packet. */ - id = DNS_HEADER_QID(abuf); - tc = DNS_HEADER_TC(abuf); - rcode = DNS_HEADER_RCODE(abuf); - - /* Find the query corresponding to this packet. The queries are - * hashed/bucketed by query id, so this lookup should be quick. Note that - * both the query id and the questions must be the same; when the query id - * wraps around we can have multiple outstanding queries with the same query - * id, so we need to check both the id and question. - */ - query = NULL; - list_head = &(channel->queries_by_qid[id % ARES_QID_TABLE_SIZE]); - for (list_node = list_head->next; list_node != list_head; - list_node = list_node->next) - { - struct query *q = list_node->data; - if ((q->qid == id) && same_questions(q->qbuf, q->qlen, abuf, alen)) - { - query = q; - break; - } - } - if (!query) - return; - - packetsz = PACKETSZ; - /* If we use EDNS and server answers with FORMERR without an OPT RR, the protocol - * extension is not understood by the responder. We must retry the query - * without EDNS enabled. */ - if (channel->flags & ARES_FLAG_EDNS) - { - packetsz = channel->ednspsz; - if (rcode == FORMERR && has_opt_rr(abuf, alen) != 1) - { - int qlen = (query->tcplen - 2) - EDNSFIXEDSZ; - channel->flags ^= ARES_FLAG_EDNS; - query->tcplen -= EDNSFIXEDSZ; - query->qlen -= EDNSFIXEDSZ; - query->tcpbuf[0] = (unsigned char)((qlen >> 8) & 0xff); - query->tcpbuf[1] = (unsigned char)(qlen & 0xff); - DNS_HEADER_SET_ARCOUNT(query->tcpbuf + 2, 0); - query->tcpbuf = ares_realloc(query->tcpbuf, query->tcplen); - query->qbuf = query->tcpbuf + 2; - ares__send_query(channel, query, now); - return; - } - } - - /* If we got a truncated UDP packet and are not ignoring truncation, - * don't accept the packet, and switch the query to TCP if we hadn't - * done so already. - */ - if ((tc || alen > packetsz) && !tcp && !(channel->flags & ARES_FLAG_IGNTC)) - { - if (!query->using_tcp) - { - query->using_tcp = 1; - ares__send_query(channel, query, now); - } - return; - } - - /* Limit alen to PACKETSZ if we aren't using TCP (only relevant if we - * are ignoring truncation. - */ - if (alen > packetsz && !tcp) - alen = packetsz; - - /* If we aren't passing through all error packets, discard packets - * with SERVFAIL, NOTIMP, or REFUSED response codes. - */ - if (!(channel->flags & ARES_FLAG_NOCHECKRESP)) - { - if (rcode == SERVFAIL || rcode == NOTIMP || rcode == REFUSED) - { - skip_server(channel, query, whichserver); - if (query->server == whichserver) - next_server(channel, query, now); - return; - } - } - - end_query(channel, query, ARES_SUCCESS, abuf, alen); -} - -/* Close all the connections that are no longer usable. */ -static void process_broken_connections(ares_channel channel, - struct timeval *now) -{ - int i; - for (i = 0; i < channel->nservers; i++) - { - struct server_state *server = &channel->servers[i]; - if (server->is_broken) - { - handle_error(channel, i, now); - } - } -} - -/* Swap the contents of two lists */ -static void swap_lists(struct list_node* head_a, - struct list_node* head_b) -{ - int is_a_empty = ares__is_list_empty(head_a); - int is_b_empty = ares__is_list_empty(head_b); - struct list_node old_a = *head_a; - struct list_node old_b = *head_b; - - if (is_a_empty) { - ares__init_list_head(head_b); - } else { - *head_b = old_a; - old_a.next->prev = head_b; - old_a.prev->next = head_b; - } - if (is_b_empty) { - ares__init_list_head(head_a); - } else { - *head_a = old_b; - old_b.next->prev = head_a; - old_b.prev->next = head_a; - } -} - -static void handle_error(ares_channel channel, int whichserver, - struct timeval *now) -{ - struct server_state *server; - struct query *query; - struct list_node list_head; - struct list_node* list_node; - - server = &channel->servers[whichserver]; - - /* Reset communications with this server. */ - ares__close_sockets(channel, server); - - /* Tell all queries talking to this server to move on and not try this - * server again. We steal the current list of queries that were in-flight to - * this server, since when we call next_server this can cause the queries to - * be re-sent to this server, which will re-insert these queries in that - * same server->queries_to_server list. - */ - ares__init_list_head(&list_head); - swap_lists(&list_head, &(server->queries_to_server)); - for (list_node = list_head.next; list_node != &list_head; ) - { - query = list_node->data; - list_node = list_node->next; /* in case the query gets deleted */ - assert(query->server == whichserver); - skip_server(channel, query, whichserver); - next_server(channel, query, now); - } - /* Each query should have removed itself from our temporary list as - * it re-sent itself or finished up... - */ - assert(ares__is_list_empty(&list_head)); -} - -static void skip_server(ares_channel channel, struct query *query, - int whichserver) -{ - /* The given server gave us problems with this query, so if we have the - * luxury of using other servers, then let's skip the potentially broken - * server and just use the others. If we only have one server and we need to - * retry then we should just go ahead and re-use that server, since it's our - * only hope; perhaps we just got unlucky, and retrying will work (eg, the - * server timed out our TCP connection just as we were sending another - * request). - */ - if (channel->nservers > 1) - { - query->server_info[whichserver].skip_server = 1; - } -} - -static void next_server(ares_channel channel, struct query *query, - struct timeval *now) -{ - /* We need to try each server channel->tries times. We have channel->nservers - * servers to try. In total, we need to do channel->nservers * channel->tries - * attempts. Use query->try to remember how many times we already attempted - * this query. Use modular arithmetic to find the next server to try. */ - while (++(query->try_count) < (channel->nservers * channel->tries)) - { - struct server_state *server; - - /* Move on to the next server. */ - query->server = (query->server + 1) % channel->nservers; - server = &channel->servers[query->server]; - - /* We don't want to use this server if (1) we decided this connection is - * broken, and thus about to be closed, (2) we've decided to skip this - * server because of earlier errors we encountered, or (3) we already - * sent this query over this exact connection. - */ - if (!server->is_broken && - !query->server_info[query->server].skip_server && - !(query->using_tcp && - (query->server_info[query->server].tcp_connection_generation == - server->tcp_connection_generation))) - { - ares__send_query(channel, query, now); - return; - } - - /* You might think that with TCP we only need one try. However, even - * when using TCP, servers can time-out our connection just as we're - * sending a request, or close our connection because they die, or never - * send us a reply because they get wedged or tickle a bug that drops - * our request. - */ - } - - /* If we are here, all attempts to perform query failed. */ - end_query(channel, query, query->error_status, NULL, 0); -} - -void ares__send_query(ares_channel channel, struct query *query, - struct timeval *now) -{ - struct send_request *sendreq; - struct server_state *server; - int timeplus; - - server = &channel->servers[query->server]; - if (query->using_tcp) - { - /* Make sure the TCP socket for this server is set up and queue - * a send request. - */ - if (server->tcp_socket == ARES_SOCKET_BAD) - { - if (open_tcp_socket(channel, server) == -1) - { - skip_server(channel, query, query->server); - next_server(channel, query, now); - return; - } - } - sendreq = ares_malloc(sizeof(struct send_request)); - if (!sendreq) - { - end_query(channel, query, ARES_ENOMEM, NULL, 0); - return; - } - memset(sendreq, 0, sizeof(struct send_request)); - /* To make the common case fast, we avoid copies by using the query's - * tcpbuf for as long as the query is alive. In the rare case where the - * query ends while it's queued for transmission, then we give the - * sendreq its own copy of the request packet and put it in - * sendreq->data_storage. - */ - sendreq->data_storage = NULL; - sendreq->data = query->tcpbuf; - sendreq->len = query->tcplen; - sendreq->owner_query = query; - sendreq->next = NULL; - if (server->qtail) - server->qtail->next = sendreq; - else - { - SOCK_STATE_CALLBACK(channel, server->tcp_socket, 1, 1); - server->qhead = sendreq; - } - server->qtail = sendreq; - query->server_info[query->server].tcp_connection_generation = - server->tcp_connection_generation; - } - else - { - if (server->udp_socket == ARES_SOCKET_BAD) - { - if (open_udp_socket(channel, server) == -1) - { - skip_server(channel, query, query->server); - next_server(channel, query, now); - return; - } - } - if (socket_write(channel, server->udp_socket, query->qbuf, query->qlen) == -1) - { - /* FIXME: Handle EAGAIN here since it likely can happen. */ - skip_server(channel, query, query->server); - next_server(channel, query, now); - return; - } - } - - /* For each trip through the entire server list, double the channel's - * assigned timeout, avoiding overflow. If channel->timeout is negative, - * leave it as-is, even though that should be impossible here. - */ - timeplus = channel->timeout; - { - /* How many times do we want to double it? Presume sane values here. */ - const int shift = query->try_count / channel->nservers; - - /* Is there enough room to shift timeplus left that many times? - * - * To find out, confirm that all of the bits we'll shift away are zero. - * Stop considering a shift if we get to the point where we could shift - * a 1 into the sign bit (i.e. when shift is within two of the bit - * count). - * - * This has the side benefit of leaving negative numbers unchanged. - */ - if(shift <= (int)(sizeof(int) * CHAR_BIT - 1) - && (timeplus >> (sizeof(int) * CHAR_BIT - 1 - shift)) == 0) - { - timeplus <<= shift; - } - } - - query->timeout = *now; - timeadd(&query->timeout, timeplus); - /* Keep track of queries bucketed by timeout, so we can process - * timeout events quickly. - */ - ares__remove_from_list(&(query->queries_by_timeout)); - ares__insert_in_list( - &(query->queries_by_timeout), - &(channel->queries_by_timeout[query->timeout.tv_sec % - ARES_TIMEOUT_TABLE_SIZE])); - - /* Keep track of queries bucketed by server, so we can process server - * errors quickly. - */ - ares__remove_from_list(&(query->queries_to_server)); - ares__insert_in_list(&(query->queries_to_server), - &(server->queries_to_server)); -} - -/* - * setsocknonblock sets the given socket to either blocking or non-blocking - * mode based on the 'nonblock' boolean argument. This function is highly - * portable. - */ -static int setsocknonblock(ares_socket_t sockfd, /* operate on this */ - int nonblock /* TRUE or FALSE */) -{ -#if defined(USE_BLOCKING_SOCKETS) - - return 0; /* returns success */ - -#elif defined(HAVE_FCNTL_O_NONBLOCK) - - /* most recent unix versions */ - int flags; - flags = fcntl(sockfd, F_GETFL, 0); - if (FALSE != nonblock) - return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); - else - return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); /* LCOV_EXCL_LINE */ - -#elif defined(HAVE_IOCTL_FIONBIO) - - /* older unix versions */ - int flags = nonblock ? 1 : 0; - return ioctl(sockfd, FIONBIO, &flags); - -#elif defined(HAVE_IOCTLSOCKET_FIONBIO) - -#ifdef WATT32 - char flags = nonblock ? 1 : 0; -#else - /* Windows */ - unsigned long flags = nonblock ? 1UL : 0UL; -#endif - return ioctlsocket(sockfd, FIONBIO, &flags); - -#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO) - - /* Amiga */ - long flags = nonblock ? 1L : 0L; - return IoctlSocket(sockfd, FIONBIO, flags); - -#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK) - - /* BeOS */ - long b = nonblock ? 1L : 0L; - return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); - -#else -# error "no non-blocking method was found/used/set" -#endif -} - -#if defined(IPV6_V6ONLY) && defined(WIN32) -/* It makes support for IPv4-mapped IPv6 addresses. - * Linux kernel, NetBSD, FreeBSD and Darwin: default is off; - * Windows Vista and later: default is on; - * DragonFly BSD: acts like off, and dummy setting; - * OpenBSD and earlier Windows: unsupported. - * Linux: controlled by /proc/sys/net/ipv6/bindv6only. - */ -static void set_ipv6_v6only(ares_socket_t sockfd, int on) -{ - (void)setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on)); -} -#else -#define set_ipv6_v6only(s,v) -#endif - -static int configure_socket(ares_socket_t s, int family, ares_channel channel) -{ - union { - struct sockaddr sa; - struct sockaddr_in sa4; - struct sockaddr_in6 sa6; - } local; - - /* do not set options for user-managed sockets */ - if (channel->sock_funcs) - return 0; - - (void)setsocknonblock(s, TRUE); - -#if defined(FD_CLOEXEC) && !defined(MSDOS) - /* Configure the socket fd as close-on-exec. */ - if (fcntl(s, F_SETFD, FD_CLOEXEC) == -1) - return -1; /* LCOV_EXCL_LINE */ -#endif - - /* Set the socket's send and receive buffer sizes. */ - if ((channel->socket_send_buffer_size > 0) && - setsockopt(s, SOL_SOCKET, SO_SNDBUF, - (void *)&channel->socket_send_buffer_size, - sizeof(channel->socket_send_buffer_size)) == -1) - return -1; - - if ((channel->socket_receive_buffer_size > 0) && - setsockopt(s, SOL_SOCKET, SO_RCVBUF, - (void *)&channel->socket_receive_buffer_size, - sizeof(channel->socket_receive_buffer_size)) == -1) - return -1; - -#ifdef SO_BINDTODEVICE - if (channel->local_dev_name[0]) { - if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, - channel->local_dev_name, sizeof(channel->local_dev_name))) { - /* Only root can do this, and usually not fatal if it doesn't work, so */ - /* just continue on. */ - } - } -#endif - - if (family == AF_INET) { - if (channel->local_ip4) { - memset(&local.sa4, 0, sizeof(local.sa4)); - local.sa4.sin_family = AF_INET; - local.sa4.sin_addr.s_addr = htonl(channel->local_ip4); - if (bind(s, &local.sa, sizeof(local.sa4)) < 0) - return -1; - } - } - else if (family == AF_INET6) { - if (memcmp(channel->local_ip6, &ares_in6addr_any, - sizeof(channel->local_ip6)) != 0) { - memset(&local.sa6, 0, sizeof(local.sa6)); - local.sa6.sin6_family = AF_INET6; - memcpy(&local.sa6.sin6_addr, channel->local_ip6, - sizeof(channel->local_ip6)); - if (bind(s, &local.sa, sizeof(local.sa6)) < 0) - return -1; - } - set_ipv6_v6only(s, 0); - } - - return 0; -} - -static int open_tcp_socket(ares_channel channel, struct server_state *server) -{ - ares_socket_t s; - int opt; - ares_socklen_t salen; - union { - struct sockaddr_in sa4; - struct sockaddr_in6 sa6; - } saddr; - struct sockaddr *sa; - - switch (server->addr.family) - { - case AF_INET: - sa = (void *)&saddr.sa4; - salen = sizeof(saddr.sa4); - memset(sa, 0, salen); - saddr.sa4.sin_family = AF_INET; - if (server->addr.tcp_port) { - saddr.sa4.sin_port = aresx_sitous(server->addr.tcp_port); - } else { - saddr.sa4.sin_port = aresx_sitous(channel->tcp_port); - } - memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4, - sizeof(server->addr.addrV4)); - break; - case AF_INET6: - sa = (void *)&saddr.sa6; - salen = sizeof(saddr.sa6); - memset(sa, 0, salen); - saddr.sa6.sin6_family = AF_INET6; - if (server->addr.tcp_port) { - saddr.sa6.sin6_port = aresx_sitous(server->addr.tcp_port); - } else { - saddr.sa6.sin6_port = aresx_sitous(channel->tcp_port); - } - memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6, - sizeof(server->addr.addrV6)); - break; - default: - return -1; /* LCOV_EXCL_LINE */ - } - - /* Acquire a socket. */ - s = ares__open_socket(channel, server->addr.family, SOCK_STREAM, 0); - if (s == ARES_SOCKET_BAD) - return -1; - - /* Configure it. */ - if (configure_socket(s, server->addr.family, channel) < 0) - { - ares__close_socket(channel, s); - return -1; - } - -#ifdef TCP_NODELAY - /* - * Disable the Nagle algorithm (only relevant for TCP sockets, and thus not - * in configure_socket). In general, in DNS lookups we're pretty much - * interested in firing off a single request and then waiting for a reply, - * so batching isn't very interesting. - */ - opt = 1; - if (channel->sock_funcs == 0 - && - setsockopt(s, IPPROTO_TCP, TCP_NODELAY, - (void *)&opt, sizeof(opt)) == -1) - { - ares__close_socket(channel, s); - return -1; - } -#endif - - if (channel->sock_config_cb) - { - int err = channel->sock_config_cb(s, SOCK_STREAM, - channel->sock_config_cb_data); - if (err < 0) - { - ares__close_socket(channel, s); - return err; - } - } - - /* Connect to the server. */ - if (ares__connect_socket(channel, s, sa, salen) == -1) - { - int err = SOCKERRNO; - - if (err != EINPROGRESS && err != EWOULDBLOCK) - { - ares__close_socket(channel, s); - return -1; - } - } - - if (channel->sock_create_cb) - { - int err = channel->sock_create_cb(s, SOCK_STREAM, - channel->sock_create_cb_data); - if (err < 0) - { - ares__close_socket(channel, s); - return err; - } - } - - SOCK_STATE_CALLBACK(channel, s, 1, 0); - server->tcp_buffer_pos = 0; - server->tcp_socket = s; - server->tcp_connection_generation = ++channel->tcp_connection_generation; - return 0; -} - -static int open_udp_socket(ares_channel channel, struct server_state *server) -{ - ares_socket_t s; - ares_socklen_t salen; - union { - struct sockaddr_in sa4; - struct sockaddr_in6 sa6; - } saddr; - struct sockaddr *sa; - - switch (server->addr.family) - { - case AF_INET: - sa = (void *)&saddr.sa4; - salen = sizeof(saddr.sa4); - memset(sa, 0, salen); - saddr.sa4.sin_family = AF_INET; - if (server->addr.udp_port) { - saddr.sa4.sin_port = aresx_sitous(server->addr.udp_port); - } else { - saddr.sa4.sin_port = aresx_sitous(channel->udp_port); - } - memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4, - sizeof(server->addr.addrV4)); - break; - case AF_INET6: - sa = (void *)&saddr.sa6; - salen = sizeof(saddr.sa6); - memset(sa, 0, salen); - saddr.sa6.sin6_family = AF_INET6; - if (server->addr.udp_port) { - saddr.sa6.sin6_port = aresx_sitous(server->addr.udp_port); - } else { - saddr.sa6.sin6_port = aresx_sitous(channel->udp_port); - } - memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6, - sizeof(server->addr.addrV6)); - break; - default: - return -1; /* LCOV_EXCL_LINE */ - } - - /* Acquire a socket. */ - s = ares__open_socket(channel, server->addr.family, SOCK_DGRAM, 0); - if (s == ARES_SOCKET_BAD) - return -1; - - /* Set the socket non-blocking. */ - if (configure_socket(s, server->addr.family, channel) < 0) - { - ares__close_socket(channel, s); - return -1; - } - - if (channel->sock_config_cb) - { - int err = channel->sock_config_cb(s, SOCK_DGRAM, - channel->sock_config_cb_data); - if (err < 0) - { - ares__close_socket(channel, s); - return err; - } - } - - /* Connect to the server. */ - if (ares__connect_socket(channel, s, sa, salen) == -1) - { - int err = SOCKERRNO; - - if (err != EINPROGRESS && err != EWOULDBLOCK) - { - ares__close_socket(channel, s); - return -1; - } - } - - if (channel->sock_create_cb) - { - int err = channel->sock_create_cb(s, SOCK_DGRAM, - channel->sock_create_cb_data); - if (err < 0) - { - ares__close_socket(channel, s); - return err; - } - } - - SOCK_STATE_CALLBACK(channel, s, 1, 0); - - server->udp_socket = s; - return 0; -} - -static int same_questions(const unsigned char *qbuf, int qlen, - const unsigned char *abuf, int alen) -{ - struct { - const unsigned char *p; - int qdcount; - char *name; - long namelen; - int type; - int dnsclass; - } q, a; - int i, j; - - if (qlen < HFIXEDSZ || alen < HFIXEDSZ) - return 0; - - /* Extract qdcount from the request and reply buffers and compare them. */ - q.qdcount = DNS_HEADER_QDCOUNT(qbuf); - a.qdcount = DNS_HEADER_QDCOUNT(abuf); - if (q.qdcount != a.qdcount) - return 0; - - /* For each question in qbuf, find it in abuf. */ - q.p = qbuf + HFIXEDSZ; - for (i = 0; i < q.qdcount; i++) - { - /* Decode the question in the query. */ - if (ares_expand_name(q.p, qbuf, qlen, &q.name, &q.namelen) - != ARES_SUCCESS) - return 0; - q.p += q.namelen; - if (q.p + QFIXEDSZ > qbuf + qlen) - { - ares_free(q.name); - return 0; - } - q.type = DNS_QUESTION_TYPE(q.p); - q.dnsclass = DNS_QUESTION_CLASS(q.p); - q.p += QFIXEDSZ; - - /* Search for this question in the answer. */ - a.p = abuf + HFIXEDSZ; - for (j = 0; j < a.qdcount; j++) - { - /* Decode the question in the answer. */ - if (ares_expand_name(a.p, abuf, alen, &a.name, &a.namelen) - != ARES_SUCCESS) - { - ares_free(q.name); - return 0; - } - a.p += a.namelen; - if (a.p + QFIXEDSZ > abuf + alen) - { - ares_free(q.name); - ares_free(a.name); - return 0; - } - a.type = DNS_QUESTION_TYPE(a.p); - a.dnsclass = DNS_QUESTION_CLASS(a.p); - a.p += QFIXEDSZ; - - /* Compare the decoded questions. */ - if (strcasecmp(q.name, a.name) == 0 && q.type == a.type - && q.dnsclass == a.dnsclass) - { - ares_free(a.name); - break; - } - ares_free(a.name); - } - - ares_free(q.name); - if (j == a.qdcount) - return 0; - } - return 1; -} - -static int same_address(struct sockaddr *sa, struct ares_addr *aa) -{ - void *addr1; - void *addr2; - - if (sa->sa_family == aa->family) - { - switch (aa->family) - { - case AF_INET: - addr1 = &aa->addrV4; - addr2 = &(CARES_INADDR_CAST(struct sockaddr_in *, sa))->sin_addr; - if (memcmp(addr1, addr2, sizeof(aa->addrV4)) == 0) - return 1; /* match */ - break; - case AF_INET6: - addr1 = &aa->addrV6; - addr2 = &(CARES_INADDR_CAST(struct sockaddr_in6 *, sa))->sin6_addr; - if (memcmp(addr1, addr2, sizeof(aa->addrV6)) == 0) - return 1; /* match */ - break; - default: - break; /* LCOV_EXCL_LINE */ - } - } - return 0; /* different */ -} - -/* search for an OPT RR in the response */ -static int has_opt_rr(const unsigned char *abuf, int alen) -{ - unsigned int qdcount, ancount, nscount, arcount, i; - const unsigned char *aptr; - int status; - - if (alen < HFIXEDSZ) - return -1; - - /* Parse the answer header. */ - qdcount = DNS_HEADER_QDCOUNT(abuf); - ancount = DNS_HEADER_ANCOUNT(abuf); - nscount = DNS_HEADER_NSCOUNT(abuf); - arcount = DNS_HEADER_ARCOUNT(abuf); - - aptr = abuf + HFIXEDSZ; - - /* skip the questions */ - for (i = 0; i < qdcount; i++) - { - char* name; - long len; - status = ares_expand_name(aptr, abuf, alen, &name, &len); - if (status != ARES_SUCCESS) - return -1; - ares_free_string(name); - if (aptr + len + QFIXEDSZ > abuf + alen) - return -1; - aptr += len + QFIXEDSZ; - } - - /* skip the ancount and nscount */ - for (i = 0; i < ancount + nscount; i++) - { - char* name; - long len; - int dlen; - status = ares_expand_name(aptr, abuf, alen, &name, &len); - if (status != ARES_SUCCESS) - return -1; - ares_free_string(name); - if (aptr + len + RRFIXEDSZ > abuf + alen) - return -1; - aptr += len; - dlen = DNS_RR_LEN(aptr); - aptr += RRFIXEDSZ; - if (aptr + dlen > abuf + alen) - return -1; - aptr += dlen; - } - - /* search for rr type (41) - opt */ - for (i = 0; i < arcount; i++) - { - char* name; - long len; - int dlen; - status = ares_expand_name(aptr, abuf, alen, &name, &len); - if (status != ARES_SUCCESS) - return -1; - ares_free_string(name); - if (aptr + len + RRFIXEDSZ > abuf + alen) - return -1; - aptr += len; - - if (DNS_RR_TYPE(aptr) == T_OPT) - return 1; - - dlen = DNS_RR_LEN(aptr); - aptr += RRFIXEDSZ; - if (aptr + dlen > abuf + alen) - return -1; - aptr += dlen; - } - - return 0; -} - -static void end_query (ares_channel channel, struct query *query, int status, - unsigned char *abuf, int alen) -{ - int i; - - /* First we check to see if this query ended while one of our send - * queues still has pointers to it. - */ - for (i = 0; i < channel->nservers; i++) - { - struct server_state *server = &channel->servers[i]; - struct send_request *sendreq; - for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) - if (sendreq->owner_query == query) - { - sendreq->owner_query = NULL; - assert(sendreq->data_storage == NULL); - if (status == ARES_SUCCESS) - { - /* We got a reply for this query, but this queued sendreq - * points into this soon-to-be-gone query's tcpbuf. Probably - * this means we timed out and queued the query for - * retransmission, then received a response before actually - * retransmitting. This is perfectly fine, so we want to keep - * the connection running smoothly if we can. But in the worst - * case we may have sent only some prefix of the query, with - * some suffix of the query left to send. Also, the buffer may - * be queued on multiple queues. To prevent dangling pointers - * to the query's tcpbuf and handle these cases, we just give - * such sendreqs their own copy of the query packet. - */ - sendreq->data_storage = ares_malloc(sendreq->len); - if (sendreq->data_storage != NULL) - { - memcpy(sendreq->data_storage, sendreq->data, sendreq->len); - sendreq->data = sendreq->data_storage; - } - } - if ((status != ARES_SUCCESS) || (sendreq->data_storage == NULL)) - { - /* We encountered an error (probably a timeout, suggesting the - * DNS server we're talking to is probably unreachable, - * wedged, or severely overloaded) or we couldn't copy the - * request, so mark the connection as broken. When we get to - * process_broken_connections() we'll close the connection and - * try to re-send requests to another server. - */ - server->is_broken = 1; - /* Just to be paranoid, zero out this sendreq... */ - sendreq->data = NULL; - sendreq->len = 0; - } - } - } - - /* Invoke the callback */ - query->callback(query->arg, status, query->timeouts, abuf, alen); - ares__free_query(query); - - /* Simple cleanup policy: if no queries are remaining, close all network - * sockets unless STAYOPEN is set. - */ - if (!(channel->flags & ARES_FLAG_STAYOPEN) && - ares__is_list_empty(&(channel->all_queries))) - { - for (i = 0; i < channel->nservers; i++) - ares__close_sockets(channel, &channel->servers[i]); - } -} - -void ares__free_query(struct query *query) -{ - /* Remove the query from all the lists in which it is linked */ - ares__remove_from_list(&(query->queries_by_qid)); - ares__remove_from_list(&(query->queries_by_timeout)); - ares__remove_from_list(&(query->queries_to_server)); - ares__remove_from_list(&(query->all_queries)); - /* Zero out some important stuff, to help catch bugs */ - query->callback = NULL; - query->arg = NULL; - /* Deallocate the memory associated with the query */ - ares_free(query->tcpbuf); - ares_free(query->server_info); - ares_free(query); -} - -ares_socket_t ares__open_socket(ares_channel channel, - int af, int type, int protocol) -{ - if (channel->sock_funcs) - return channel->sock_funcs->asocket(af, - type, - protocol, - channel->sock_func_cb_data); - else - return socket(af, type, protocol); -} - -int ares__connect_socket(ares_channel channel, - ares_socket_t sockfd, - const struct sockaddr *addr, - ares_socklen_t addrlen) -{ - if (channel->sock_funcs) - return channel->sock_funcs->aconnect(sockfd, - addr, - addrlen, - channel->sock_func_cb_data); - else - return connect(sockfd, addr, addrlen); -} - -void ares__close_socket(ares_channel channel, ares_socket_t s) -{ - if (channel->sock_funcs) - channel->sock_funcs->aclose(s, channel->sock_func_cb_data); - else - sclose(s); -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_query.c b/lib/c-ares-1.19.1/src/lib/ares_query.c deleted file mode 100644 index 42323bec553..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_query.c +++ /dev/null @@ -1,146 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_dns.h" -#include "ares_private.h" - -struct qquery { - ares_callback callback; - void *arg; -}; - -static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen); - -static struct query* find_query_by_id(ares_channel channel, unsigned short id) -{ - unsigned short qid; - struct list_node* list_head; - struct list_node* list_node; - DNS_HEADER_SET_QID(((unsigned char*)&qid), id); - - /* Find the query corresponding to this packet. */ - list_head = &(channel->queries_by_qid[qid % ARES_QID_TABLE_SIZE]); - for (list_node = list_head->next; list_node != list_head; - list_node = list_node->next) - { - struct query *q = list_node->data; - if (q->qid == qid) - return q; - } - return NULL; -} - -/* a unique query id is generated using an rc4 key. Since the id may already - be used by a running query (as infrequent as it may be), a lookup is - performed per id generation. In practice this search should happen only - once per newly generated id -*/ -static unsigned short generate_unique_id(ares_channel channel) -{ - unsigned short id; - - do { - id = ares__generate_new_id(channel->rand_state); - } while (find_query_by_id(channel, id)); - - return (unsigned short)id; -} - -void ares_query(ares_channel channel, const char *name, int dnsclass, - int type, ares_callback callback, void *arg) -{ - struct qquery *qquery; - unsigned char *qbuf; - int qlen, rd, status; - - /* Compose the query. */ - rd = !(channel->flags & ARES_FLAG_NORECURSE); - status = ares_create_query(name, dnsclass, type, channel->next_id, rd, &qbuf, - &qlen, (channel->flags & ARES_FLAG_EDNS) ? channel->ednspsz : 0); - if (status != ARES_SUCCESS) - { - if (qbuf != NULL) ares_free(qbuf); - callback(arg, status, 0, NULL, 0); - return; - } - - channel->next_id = generate_unique_id(channel); - - /* Allocate and fill in the query structure. */ - qquery = ares_malloc(sizeof(struct qquery)); - if (!qquery) - { - ares_free_string(qbuf); - callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; - } - qquery->callback = callback; - qquery->arg = arg; - - /* Send it off. qcallback will be called when we get an answer. */ - ares_send(channel, qbuf, qlen, qcallback, qquery); - ares_free_string(qbuf); -} - -static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen) -{ - struct qquery *qquery = (struct qquery *) arg; - unsigned int ancount; - int rcode; - - if (status != ARES_SUCCESS) - qquery->callback(qquery->arg, status, timeouts, abuf, alen); - else - { - /* Pull the response code and answer count from the packet. */ - rcode = DNS_HEADER_RCODE(abuf); - ancount = DNS_HEADER_ANCOUNT(abuf); - - /* Convert errors. */ - switch (rcode) - { - case NOERROR: - status = (ancount > 0) ? ARES_SUCCESS : ARES_ENODATA; - break; - case FORMERR: - status = ARES_EFORMERR; - break; - case SERVFAIL: - status = ARES_ESERVFAIL; - break; - case NXDOMAIN: - status = ARES_ENOTFOUND; - break; - case NOTIMP: - status = ARES_ENOTIMP; - break; - case REFUSED: - status = ARES_EREFUSED; - break; - } - qquery->callback(qquery->arg, status, timeouts, abuf, alen); - } - ares_free(qquery); -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_rand.c b/lib/c-ares-1.19.1/src/lib/ares_rand.c deleted file mode 100644 index 766c1e6ea9b..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_rand.c +++ /dev/null @@ -1,279 +0,0 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2007-2013 by Daniel Stenberg - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include "ares.h" -#include "ares_private.h" -#include "ares_nowarn.h" -#include - -typedef enum { - ARES_RAND_OS = 1, /* OS-provided such as RtlGenRandom or arc4random */ - ARES_RAND_FILE = 2, /* OS file-backed random number generator */ - ARES_RAND_RC4 = 3 /* Internal RC4 based PRNG */ -} ares_rand_backend; - -typedef struct ares_rand_rc4 -{ - unsigned char S[256]; - size_t i; - size_t j; -} ares_rand_rc4; - -struct ares_rand_state -{ - ares_rand_backend type; - union { - FILE *rand_file; - ares_rand_rc4 rc4; - } state; -}; - - -/* Define RtlGenRandom = SystemFunction036. This is in advapi32.dll. There is - * no need to dynamically load this, other software used widely does not. - * http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx - * https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom - */ -#ifdef _WIN32 -BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength); -# ifndef RtlGenRandom -# define RtlGenRandom(a,b) SystemFunction036(a,b) -# endif -#endif - - -#define ARES_RC4_KEY_LEN 32 /* 256 bits */ - -#ifdef _MSC_VER -typedef unsigned __int64 cares_u64; -#else -typedef unsigned long long cares_u64; -#endif - -static unsigned int ares_u32_from_ptr(void *addr) -{ - if (sizeof(void *) == 8) { - return (unsigned int)((((cares_u64)addr >> 32) & 0xFFFFFFFF) | ((cares_u64)addr & 0xFFFFFFFF)); - } - return (unsigned int)((size_t)addr & 0xFFFFFFFF); -} - - -/* initialize an rc4 key as the last possible fallback. */ -static void ares_rc4_generate_key(ares_rand_rc4 *rc4_state, unsigned char *key, size_t key_len) -{ - size_t i; - size_t len = 0; - unsigned int data; - struct timeval tv; - - if (key_len != ARES_RC4_KEY_LEN) - return; - - /* Randomness is hard to come by. Maybe the system randomizes heap and stack addresses. - * Maybe the current timestamp give us some randomness. - * Use rc4_state (heap), &i (stack), and ares__tvnow() - */ - data = ares_u32_from_ptr(rc4_state); - memcpy(key + len, &data, sizeof(data)); - len += sizeof(data); - - data = ares_u32_from_ptr(&i); - memcpy(key + len, &data, sizeof(data)); - len += sizeof(data); - - tv = ares__tvnow(); - data = (unsigned int)((tv.tv_sec | tv.tv_usec) & 0xFFFFFFFF); - memcpy(key + len, &data, sizeof(data)); - len += sizeof(data); - - srand(ares_u32_from_ptr(rc4_state) | ares_u32_from_ptr(&i) | (unsigned int)((tv.tv_sec | tv.tv_usec) & 0xFFFFFFFF)); - - for (i=len; iS); i++) { - rc4_state->S[i] = i & 0xFF; - } - - for(i = 0, j = 0; i < 256; i++) { - j = (j + rc4_state->S[i] + key[i % sizeof(key)]) % 256; - ARES_SWAP_BYTE(&rc4_state->S[i], &rc4_state->S[j]); - } - - rc4_state->i = 0; - rc4_state->j = 0; -} - -/* Just outputs the key schedule, no need to XOR with any data since we have none */ -static void ares_rc4_prng(ares_rand_rc4 *rc4_state, unsigned char *buf, size_t len) -{ - unsigned char *S = rc4_state->S; - size_t i = rc4_state->i; - size_t j = rc4_state->j; - size_t cnt; - - for (cnt=0; cnti = i; - rc4_state->j = j; -} - - -static int ares__init_rand_engine(ares_rand_state *state) -{ - memset(state, 0, sizeof(*state)); - -#if defined(HAVE_ARC4RANDOM_BUF) || defined(_WIN32) - state->type = ARES_RAND_OS; - return 1; -#elif defined(CARES_RANDOM_FILE) - state->type = ARES_RAND_FILE; - state->state.rand_file = fopen(CARES_RANDOM_FILE, "rb"); - if (state->state.rand_file) { - setvbuf(state->state.rand_file, NULL, _IONBF, 0); - return 1; - } - /* Fall-Thru on failure to RC4 */ -#endif - - state->type = ARES_RAND_RC4; - ares_rc4_init(&state->state.rc4); - - /* Currently cannot fail */ - return 1; -} - - -ares_rand_state *ares__init_rand_state() -{ - ares_rand_state *state = NULL; - - state = ares_malloc(sizeof(*state)); - if (!state) - return NULL; - - if (!ares__init_rand_engine(state)) { - ares_free(state); - return NULL; - } - - return state; -} - - -static void ares__clear_rand_state(ares_rand_state *state) -{ - if (!state) - return; - - switch (state->type) { - case ARES_RAND_OS: - break; - case ARES_RAND_FILE: - fclose(state->state.rand_file); - break; - case ARES_RAND_RC4: - break; - } -} - - -static void ares__reinit_rand(ares_rand_state *state) -{ - ares__clear_rand_state(state); - ares__init_rand_engine(state); -} - - -void ares__destroy_rand_state(ares_rand_state *state) -{ - if (!state) - return; - - ares__clear_rand_state(state); - ares_free(state); -} - - -static void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len) -{ - - while (1) { - size_t bytes_read = 0; - - switch (state->type) { - case ARES_RAND_OS: -#ifdef _WIN32 - RtlGenRandom(buf, len); - return; -#elif defined(HAVE_ARC4RANDOM_BUF) - arc4random_buf(buf, len); - return; -#else - /* Shouldn't be possible to be here */ - break; -#endif - - case ARES_RAND_FILE: - while (1) { - size_t rv = fread(buf + bytes_read, 1, len - bytes_read, state->state.rand_file); - if (rv == 0) - break; /* critical error, will reinit rand state */ - - bytes_read += rv; - if (bytes_read == len) - return; - } - break; - - case ARES_RAND_RC4: - ares_rc4_prng(&state->state.rc4, buf, len); - return; - } - - /* If we didn't return before we got here, that means we had a critical rand - * failure and need to reinitialized */ - ares__reinit_rand(state); - } -} - -unsigned short ares__generate_new_id(ares_rand_state *state) -{ - unsigned short r=0; - - ares__rand_bytes(state, (unsigned char *)&r, sizeof(r)); - return r; -} - diff --git a/lib/c-ares-1.19.1/src/lib/ares_search.c b/lib/c-ares-1.19.1/src/lib/ares_search.c deleted file mode 100644 index c4b0424f5ba..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_search.c +++ /dev/null @@ -1,321 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#include "ares.h" -#include "ares_private.h" - -struct search_query { - /* Arguments passed to ares_search */ - ares_channel channel; - char *name; /* copied into an allocated buffer */ - int dnsclass; - int type; - ares_callback callback; - void *arg; - - int status_as_is; /* error status from trying as-is */ - int next_domain; /* next search domain to try */ - int trying_as_is; /* current query is for name as-is */ - int timeouts; /* number of timeouts we saw for this request */ - int ever_got_nodata; /* did we ever get ARES_ENODATA along the way? */ -}; - -static void search_callback(void *arg, int status, int timeouts, - unsigned char *abuf, int alen); -static void end_squery(struct search_query *squery, int status, - unsigned char *abuf, int alen); - -void ares_search(ares_channel channel, const char *name, int dnsclass, - int type, ares_callback callback, void *arg) -{ - struct search_query *squery; - char *s; - const char *p; - int status, ndots; - - /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */ - if (ares__is_onion_domain(name)) - { - callback(arg, ARES_ENOTFOUND, 0, NULL, 0); - return; - } - - /* If name only yields one domain to search, then we don't have - * to keep extra state, so just do an ares_query(). - */ - status = ares__single_domain(channel, name, &s); - if (status != ARES_SUCCESS) - { - callback(arg, status, 0, NULL, 0); - return; - } - if (s) - { - ares_query(channel, s, dnsclass, type, callback, arg); - ares_free(s); - return; - } - - /* Allocate a search_query structure to hold the state necessary for - * doing multiple lookups. - */ - squery = ares_malloc(sizeof(struct search_query)); - if (!squery) - { - callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; - } - squery->channel = channel; - squery->name = ares_strdup(name); - if (!squery->name) - { - ares_free(squery); - callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; - } - squery->dnsclass = dnsclass; - squery->type = type; - squery->status_as_is = -1; - squery->callback = callback; - squery->arg = arg; - squery->timeouts = 0; - squery->ever_got_nodata = 0; - - /* Count the number of dots in name. */ - ndots = 0; - for (p = name; *p; p++) - { - if (*p == '.') - ndots++; - } - - /* If ndots is at least the channel ndots threshold (usually 1), - * then we try the name as-is first. Otherwise, we try the name - * as-is last. - */ - if (ndots >= channel->ndots) - { - /* Try the name as-is first. */ - squery->next_domain = 0; - squery->trying_as_is = 1; - ares_query(channel, name, dnsclass, type, search_callback, squery); - } - else - { - /* Try the name as-is last; start with the first search domain. */ - squery->next_domain = 1; - squery->trying_as_is = 0; - status = ares__cat_domain(name, channel->domains[0], &s); - if (status == ARES_SUCCESS) - { - ares_query(channel, s, dnsclass, type, search_callback, squery); - ares_free(s); - } - else - { - /* failed, free the malloc()ed memory */ - ares_free(squery->name); - ares_free(squery); - callback(arg, status, 0, NULL, 0); - } - } -} - -static void search_callback(void *arg, int status, int timeouts, - unsigned char *abuf, int alen) -{ - struct search_query *squery = (struct search_query *) arg; - ares_channel channel = squery->channel; - char *s; - - squery->timeouts += timeouts; - - /* Stop searching unless we got a non-fatal error. */ - if (status != ARES_ENODATA && status != ARES_ESERVFAIL - && status != ARES_ENOTFOUND) - end_squery(squery, status, abuf, alen); - else - { - /* Save the status if we were trying as-is. */ - if (squery->trying_as_is) - squery->status_as_is = status; - - /* - * If we ever get ARES_ENODATA along the way, record that; if the search - * should run to the very end and we got at least one ARES_ENODATA, - * then callers like ares_gethostbyname() may want to try a T_A search - * even if the last domain we queried for T_AAAA resource records - * returned ARES_ENOTFOUND. - */ - if (status == ARES_ENODATA) - squery->ever_got_nodata = 1; - - if (squery->next_domain < channel->ndomains) - { - /* Try the next domain. */ - status = ares__cat_domain(squery->name, - channel->domains[squery->next_domain], &s); - if (status != ARES_SUCCESS) - end_squery(squery, status, NULL, 0); - else - { - squery->trying_as_is = 0; - squery->next_domain++; - ares_query(channel, s, squery->dnsclass, squery->type, - search_callback, squery); - ares_free(s); - } - } - else if (squery->status_as_is == -1) - { - /* Try the name as-is at the end. */ - squery->trying_as_is = 1; - ares_query(channel, squery->name, squery->dnsclass, squery->type, - search_callback, squery); - } - else { - if (squery->status_as_is == ARES_ENOTFOUND && squery->ever_got_nodata) { - end_squery(squery, ARES_ENODATA, NULL, 0); - } - else - end_squery(squery, squery->status_as_is, NULL, 0); - } - } -} - -static void end_squery(struct search_query *squery, int status, - unsigned char *abuf, int alen) -{ - squery->callback(squery->arg, status, squery->timeouts, abuf, alen); - ares_free(squery->name); - ares_free(squery); -} - -/* Concatenate two domains. */ -int ares__cat_domain(const char *name, const char *domain, char **s) -{ - size_t nlen = strlen(name); - size_t dlen = strlen(domain); - - *s = ares_malloc(nlen + 1 + dlen + 1); - if (!*s) - return ARES_ENOMEM; - memcpy(*s, name, nlen); - (*s)[nlen] = '.'; - memcpy(*s + nlen + 1, domain, dlen); - (*s)[nlen + 1 + dlen] = 0; - return ARES_SUCCESS; -} - -/* Determine if this name only yields one query. If it does, set *s to - * the string we should query, in an allocated buffer. If not, set *s - * to NULL. - */ -int ares__single_domain(ares_channel channel, const char *name, char **s) -{ - size_t len = strlen(name); - const char *hostaliases; - FILE *fp; - char *line = NULL; - int status; - size_t linesize; - const char *p, *q; - int error; - - /* If the name contains a trailing dot, then the single query is the name - * sans the trailing dot. - */ - if ((len > 0) && (name[len - 1] == '.')) - { - *s = ares_strdup(name); - return (*s) ? ARES_SUCCESS : ARES_ENOMEM; - } - - if (!(channel->flags & ARES_FLAG_NOALIASES) && !strchr(name, '.')) - { - /* The name might be a host alias. */ - hostaliases = getenv("HOSTALIASES"); - if (hostaliases) - { - fp = fopen(hostaliases, "r"); - if (fp) - { - while ((status = ares__read_line(fp, &line, &linesize)) - == ARES_SUCCESS) - { - if (strncasecmp(line, name, len) != 0 || - !ISSPACE(line[len])) - continue; - p = line + len; - while (ISSPACE(*p)) - p++; - if (*p) - { - q = p + 1; - while (*q && !ISSPACE(*q)) - q++; - *s = ares_malloc(q - p + 1); - if (*s) - { - memcpy(*s, p, q - p); - (*s)[q - p] = 0; - } - ares_free(line); - fclose(fp); - return (*s) ? ARES_SUCCESS : ARES_ENOMEM; - } - } - ares_free(line); - fclose(fp); - if (status != ARES_SUCCESS && status != ARES_EOF) - return status; - } - else - { - error = ERRNO; - switch(error) - { - case ENOENT: - case ESRCH: - break; - default: - DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", - error, strerror(error))); - DEBUGF(fprintf(stderr, "Error opening file: %s\n", - hostaliases)); - *s = NULL; - return ARES_EFILE; - } - } - } - } - - if (channel->flags & ARES_FLAG_NOSEARCH || channel->ndomains == 0) - { - /* No domain search to do; just try the name as-is. */ - *s = ares_strdup(name); - return (*s) ? ARES_SUCCESS : ARES_ENOMEM; - } - - *s = NULL; - return ARES_SUCCESS; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_send.c b/lib/c-ares-1.19.1/src/lib/ares_send.c deleted file mode 100644 index 542cf45f11a..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_send.c +++ /dev/null @@ -1,129 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif - -#include "ares_nameser.h" - -#include "ares.h" -#include "ares_dns.h" -#include "ares_private.h" - -void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, - ares_callback callback, void *arg) -{ - struct query *query; - int i, packetsz; - struct timeval now; - - /* Verify that the query is at least long enough to hold the header. */ - if (qlen < HFIXEDSZ || qlen >= (1 << 16)) - { - callback(arg, ARES_EBADQUERY, 0, NULL, 0); - return; - } - if (channel->nservers < 1) - { - callback(arg, ARES_ESERVFAIL, 0, NULL, 0); - return; - } - /* Allocate space for query and allocated fields. */ - query = ares_malloc(sizeof(struct query)); - if (!query) - { - callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; - } - query->tcpbuf = ares_malloc(qlen + 2); - if (!query->tcpbuf) - { - ares_free(query); - callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; - } - query->server_info = ares_malloc(channel->nservers * - sizeof(query->server_info[0])); - if (!query->server_info) - { - ares_free(query->tcpbuf); - ares_free(query); - callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; - } - - /* Compute the query ID. Start with no timeout. */ - query->qid = DNS_HEADER_QID(qbuf); - query->timeout.tv_sec = 0; - query->timeout.tv_usec = 0; - - /* Form the TCP query buffer by prepending qlen (as two - * network-order bytes) to qbuf. - */ - query->tcpbuf[0] = (unsigned char)((qlen >> 8) & 0xff); - query->tcpbuf[1] = (unsigned char)(qlen & 0xff); - memcpy(query->tcpbuf + 2, qbuf, qlen); - query->tcplen = qlen + 2; - - /* Fill in query arguments. */ - query->qbuf = query->tcpbuf + 2; - query->qlen = qlen; - query->callback = callback; - query->arg = arg; - - /* Initialize query status. */ - query->try_count = 0; - - /* Choose the server to send the query to. If rotation is enabled, keep track - * of the next server we want to use. */ - query->server = channel->last_server; - if (channel->rotate == 1) - channel->last_server = (channel->last_server + 1) % channel->nservers; - - for (i = 0; i < channel->nservers; i++) - { - query->server_info[i].skip_server = 0; - query->server_info[i].tcp_connection_generation = 0; - } - - packetsz = (channel->flags & ARES_FLAG_EDNS) ? channel->ednspsz : PACKETSZ; - query->using_tcp = (channel->flags & ARES_FLAG_USEVC) || qlen > packetsz; - - query->error_status = ARES_ECONNREFUSED; - query->timeouts = 0; - - /* Initialize our list nodes. */ - ares__init_list_node(&(query->queries_by_qid), query); - ares__init_list_node(&(query->queries_by_timeout), query); - ares__init_list_node(&(query->queries_to_server), query); - ares__init_list_node(&(query->all_queries), query); - - /* Chain the query into the list of all queries. */ - ares__insert_in_list(&(query->all_queries), &(channel->all_queries)); - /* Keep track of queries bucketed by qid, so we can process DNS - * responses quickly. - */ - ares__insert_in_list( - &(query->queries_by_qid), - &(channel->queries_by_qid[query->qid % ARES_QID_TABLE_SIZE])); - - /* Perform the first query action. */ - now = ares__tvnow(); - ares__send_query(channel, query, &now); -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_strcasecmp.c b/lib/c-ares-1.19.1/src/lib/ares_strcasecmp.c deleted file mode 100644 index f9c85e20966..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_strcasecmp.c +++ /dev/null @@ -1,66 +0,0 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include "ares_strcasecmp.h" - -#ifndef HAVE_STRCASECMP -int ares_strcasecmp(const char *a, const char *b) -{ -#if defined(HAVE_STRCMPI) - return strcmpi(a, b); -#elif defined(HAVE_STRICMP) - return stricmp(a, b); -#else - size_t i; - - for (i = 0; i < (size_t)-1; i++) { - int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i]; - int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i]; - if (c1 != c2) - return c1-c2; - if (!c1) - break; - } - return 0; -#endif -} -#endif - -#ifndef HAVE_STRNCASECMP -int ares_strncasecmp(const char *a, const char *b, size_t n) -{ -#if defined(HAVE_STRNCMPI) - return strncmpi(a, b, n); -#elif defined(HAVE_STRNICMP) - return strnicmp(a, b, n); -#else - size_t i; - - for (i = 0; i < n; i++) { - int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i]; - int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i]; - if (c1 != c2) - return c1-c2; - if (!c1) - break; - } - return 0; -#endif -} -#endif - diff --git a/lib/c-ares-1.19.1/src/lib/ares_strcasecmp.h b/lib/c-ares-1.19.1/src/lib/ares_strcasecmp.h deleted file mode 100644 index 57d86f96342..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_strcasecmp.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef HEADER_CARES_STRCASECMP_H -#define HEADER_CARES_STRCASECMP_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifndef HAVE_STRCASECMP -extern int ares_strcasecmp(const char *a, const char *b); -#endif - -#ifndef HAVE_STRNCASECMP -extern int ares_strncasecmp(const char *a, const char *b, size_t n); -#endif - -#endif /* HEADER_CARES_STRCASECMP_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_strdup.c b/lib/c-ares-1.19.1/src/lib/ares_strdup.c deleted file mode 100644 index 39fc8692e75..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_strdup.c +++ /dev/null @@ -1,42 +0,0 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include "ares_strdup.h" -#include "ares.h" -#include "ares_private.h" - -char *ares_strdup(const char *s1) -{ - size_t sz; - char * s2; - - if(s1) { - sz = strlen(s1); - if(sz < (size_t)-1) { - sz++; - if(sz < ((size_t)-1)) { - s2 = ares_malloc(sz); - if(s2) { - memcpy(s2, s1, sz); - return s2; - } - } - } - } - return (char *)NULL; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_strdup.h b/lib/c-ares-1.19.1/src/lib/ares_strdup.h deleted file mode 100644 index 67f2a74f5f1..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_strdup.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef HEADER_CARES_STRDUP_H -#define HEADER_CARES_STRDUP_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -extern char *ares_strdup(const char *s1); - -#endif /* HEADER_CARES_STRDUP_H */ diff --git a/lib/c-ares-1.19.1/src/lib/ares_strerror.c b/lib/c-ares-1.19.1/src/lib/ares_strerror.c deleted file mode 100644 index c3ecbd7b43c..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_strerror.c +++ /dev/null @@ -1,56 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include -#include "ares.h" - -const char *ares_strerror(int code) -{ - /* Return a string literal from a table. */ - const char *errtext[] = { - "Successful completion", - "DNS server returned answer with no data", - "DNS server claims query was misformatted", - "DNS server returned general failure", - "Domain name not found", - "DNS server does not implement requested operation", - "DNS server refused query", - "Misformatted DNS query", - "Misformatted domain name", - "Unsupported address family", - "Misformatted DNS reply", - "Could not contact DNS servers", - "Timeout while contacting DNS servers", - "End of file", - "Error reading file", - "Out of memory", - "Channel is being destroyed", - "Misformatted string", - "Illegal flags specified", - "Given hostname is not numeric", - "Illegal hints flags specified", - "c-ares library initialization not yet performed", - "Error loading iphlpapi.dll", - "Could not find GetNetworkParams function", - "DNS query cancelled" - }; - - if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))) - return errtext[code]; - else - return "unknown"; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_strsplit.c b/lib/c-ares-1.19.1/src/lib/ares_strsplit.c deleted file mode 100644 index d3e90c4a8f6..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_strsplit.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (C) 2018 by John Schember - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#if defined(__MVS__) -#include -#endif - -#include "ares_setup.h" -#include "ares.h" -#include "ares_private.h" - -void ares__strsplit_free(char **elms, size_t num_elm) -{ - size_t i; - - if (elms == NULL) - return; - - for (i=0; i - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -/* Split a string on delms skipping empty or duplicate elements. - * - * param in String to split. - * param delms String of characters to treat as a delimitor. - * Each character in the string is a delimitor so - * there can be multiple delimitors to split on. - * E.g. ", " will split on all comma's and spaces. - * Duplicate entries are removed. - * param num_elm Return parameter of the number of elements - * in the result array. - * - * returns an allocated array of allocated string elements. - * - */ -char **ares__strsplit(const char *in, const char *delms, size_t *num_elm); - -/* Frees the result returned from ares__strsplit(). */ -void ares__strsplit_free(char **elms, size_t num_elm); - - -#endif /* HEADER_CARES_STRSPLIT_H */ - diff --git a/lib/c-ares-1.19.1/src/lib/ares_timeout.c b/lib/c-ares-1.19.1/src/lib/ares_timeout.c deleted file mode 100644 index 293e4af0216..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_timeout.c +++ /dev/null @@ -1,88 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_LIMITS_H -#include -#endif - -#include "ares.h" -#include "ares_private.h" - -/* return time offset between now and (future) check, in milliseconds */ -static long timeoffset(struct timeval *now, struct timeval *check) -{ - return (check->tv_sec - now->tv_sec)*1000 + - (check->tv_usec - now->tv_usec)/1000; -} - -/* WARNING: Beware that this is linear in the number of outstanding - * requests! You are probably far better off just calling ares_process() - * once per second, rather than calling ares_timeout() to figure out - * when to next call ares_process(). - */ -struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv, - struct timeval *tvbuf) -{ - struct query *query; - struct list_node* list_head; - struct list_node* list_node; - struct timeval now; - struct timeval nextstop; - long offset, min_offset; - - /* No queries, no timeout (and no fetch of the current time). */ - if (ares__is_list_empty(&(channel->all_queries))) - return maxtv; - - /* Find the minimum timeout for the current set of queries. */ - now = ares__tvnow(); - min_offset = -1; - - list_head = &(channel->all_queries); - for (list_node = list_head->next; list_node != list_head; - list_node = list_node->next) - { - query = list_node->data; - if (query->timeout.tv_sec == 0) - continue; - offset = timeoffset(&now, &query->timeout); - if (offset < 0) - offset = 0; - if (min_offset == -1 || offset < min_offset) - min_offset = offset; - } - - /* If we found a minimum timeout and it's sooner than the one specified in - * maxtv (if any), return it. Otherwise go with maxtv. - */ - if (min_offset != -1) - { - int ioffset = (min_offset > (long)INT_MAX) ? INT_MAX : (int)min_offset; - - nextstop.tv_sec = ioffset/1000; - nextstop.tv_usec = (ioffset%1000)*1000; - - if (!maxtv || ares__timedout(maxtv, &nextstop)) - { - *tvbuf = nextstop; - return tvbuf; - } - } - - return maxtv; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_version.c b/lib/c-ares-1.19.1/src/lib/ares_version.c deleted file mode 100644 index 4f8c42f2c9a..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_version.c +++ /dev/null @@ -1,11 +0,0 @@ - -#include "ares_setup.h" -#include "ares.h" - -const char *ares_version(int *version) -{ - if(version) - *version = ARES_VERSION; - - return ARES_VERSION_STR; -} diff --git a/lib/c-ares-1.19.1/src/lib/ares_writev.c b/lib/c-ares-1.19.1/src/lib/ares_writev.c deleted file mode 100644 index e812c09e1c5..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_writev.c +++ /dev/null @@ -1,79 +0,0 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_LIMITS_H -# include -#endif - -#include "ares.h" -#include "ares_private.h" - -#ifndef HAVE_WRITEV -ares_ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt) -{ - char *buffer, *bp; - int i; - size_t bytes = 0; - ares_ssize_t result; - - /* Validate iovcnt */ - if (iovcnt <= 0) - { - SET_ERRNO(EINVAL); - return (-1); - } - - /* Validate and find the sum of the iov_len values in the iov array */ - for (i = 0; i < iovcnt; i++) - { - if (iov[i].iov_len > INT_MAX - bytes) - { - SET_ERRNO(EINVAL); - return (-1); - } - bytes += iov[i].iov_len; - } - - if (bytes == 0) - return (0); - - /* Allocate a temporary buffer to hold the data */ - buffer = ares_malloc(bytes); - if (!buffer) - { - SET_ERRNO(ENOMEM); - return (-1); - } - - /* Copy the data into buffer */ - for (bp = buffer, i = 0; i < iovcnt; ++i) - { - memcpy (bp, iov[i].iov_base, iov[i].iov_len); - bp += iov[i].iov_len; - } - - /* Send buffer contents */ - result = swrite(s, buffer, bytes); - - ares_free(buffer); - - return (result); -} -#endif - diff --git a/lib/c-ares-1.19.1/src/lib/ares_writev.h b/lib/c-ares-1.19.1/src/lib/ares_writev.h deleted file mode 100644 index 65cea8708fc..00000000000 --- a/lib/c-ares-1.19.1/src/lib/ares_writev.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef HEADER_CARES_WRITEV_H -#define HEADER_CARES_WRITEV_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include "ares.h" - -#ifndef HAVE_WRITEV - -/* Structure for scatter/gather I/O. */ -struct iovec -{ - void *iov_base; /* Pointer to data. */ - size_t iov_len; /* Length of data. */ -}; - -extern ares_ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt); - -#endif - -#endif /* HEADER_CARES_WRITEV_H */ diff --git a/lib/c-ares-1.19.1/src/lib/bitncmp.c b/lib/c-ares-1.19.1/src/lib/bitncmp.c deleted file mode 100644 index 1468d4923a5..00000000000 --- a/lib/c-ares-1.19.1/src/lib/bitncmp.c +++ /dev/null @@ -1,59 +0,0 @@ - -/* - * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") - * Copyright (c) 1996,1999 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HAVE_BITNCMP - -#include "ares_setup.h" -#include "bitncmp.h" - -/* - * int - * bitncmp(l, r, n) - * compare bit masks l and r, for n bits. - * return: - * <0, >0, or 0 in the libc tradition. - * note: - * network byte order assumed. this means 192.5.5.240/28 has - * 0x11110000 in its fourth octet. - * author: - * Paul Vixie (ISC), June 1996 - */ -int ares__bitncmp(const void *l, const void *r, int n) -{ - unsigned int lb, rb; - int x, b; - - b = n / 8; - x = memcmp(l, r, b); - if (x || (n % 8) == 0) - return (x); - - lb = ((const unsigned char *)l)[b]; - rb = ((const unsigned char *)r)[b]; - for (b = n % 8; b > 0; b--) { - if ((lb & 0x80) != (rb & 0x80)) { - if (lb & 0x80) - return (1); - return (-1); - } - lb <<= 1; - rb <<= 1; - } - return (0); -} -#endif diff --git a/lib/c-ares-1.19.1/src/lib/bitncmp.h b/lib/c-ares-1.19.1/src/lib/bitncmp.h deleted file mode 100644 index 7b8d66c1662..00000000000 --- a/lib/c-ares-1.19.1/src/lib/bitncmp.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __ARES_BITNCMP_H -#define __ARES_BITNCMP_H - - -/* Copyright (C) 2005, 2013 by Dominick Meglio - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#ifndef HAVE_BITNCMP -int ares__bitncmp(const void *l, const void *r, int n); -#else -#define ares__bitncmp(x,y,z) bitncmp(x,y,z) -#endif - -#endif /* __ARES_BITNCMP_H */ diff --git a/lib/c-ares-1.19.1/src/lib/config-dos.h b/lib/c-ares-1.19.1/src/lib/config-dos.h deleted file mode 100644 index b241d69a5c6..00000000000 --- a/lib/c-ares-1.19.1/src/lib/config-dos.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef HEADER_CONFIG_DOS_H -#define HEADER_CONFIG_DOS_H - - -/* ================================================================ */ -/* ares/config-dos.h - Hand crafted config file for DOS */ -/* ================================================================ */ - -#define PACKAGE "c-ares" - -#define HAVE_ERRNO_H 1 -#define HAVE_GETENV 1 -#define HAVE_GETTIMEOFDAY 1 -#define HAVE_IOCTLSOCKET 1 -#define HAVE_IOCTLSOCKET_FIONBIO 1 -#define HAVE_LIMITS_H 1 -#define HAVE_NET_IF_H 1 -#define HAVE_RECV 1 -#define HAVE_RECVFROM 1 -#define HAVE_SEND 1 -#define HAVE_STRDUP 1 -#define HAVE_STRICMP 1 -#define HAVE_STRUCT_IN6_ADDR 1 -#define HAVE_STRUCT_TIMEVAL 1 -#define HAVE_SYS_IOCTL_H 1 -#define HAVE_SYS_SOCKET_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_TIME_H 1 -#define HAVE_UNISTD_H 1 -#define HAVE_WRITEV 1 - -#define NEED_MALLOC_H 1 - -#define RETSIGTYPE void -#define TIME_WITH_SYS_TIME 1 - -/* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */ - -#define SEND_TYPE_ARG1 int -#define SEND_QUAL_ARG2 const -#define SEND_TYPE_ARG2 void * -#define SEND_TYPE_ARG3 int -#define SEND_TYPE_ARG4 int -#define SEND_TYPE_RETV int - -#define RECV_TYPE_ARG1 int -#define RECV_TYPE_ARG2 void * -#define RECV_TYPE_ARG3 int -#define RECV_TYPE_ARG4 int -#define RECV_TYPE_RETV int - -#define RECVFROM_TYPE_ARG1 int -#define RECVFROM_TYPE_ARG2 void -#define RECVFROM_TYPE_ARG3 int -#define RECVFROM_TYPE_ARG4 int -#define RECVFROM_TYPE_ARG5 struct sockaddr -#define RECVFROM_TYPE_ARG6 int -#define RECVFROM_TYPE_RETV int -#define RECVFROM_TYPE_ARG2_IS_VOID 1 - -#define BSD - -/* Target HAVE_x section */ - -#if defined(DJGPP) - #undef _SSIZE_T - #include /* For 'ssize_t' */ - - #define HAVE_STRCASECMP 1 - #define HAVE_STRNCASECMP 1 - #define HAVE_SYS_TIME_H 1 - #define HAVE_VARIADIC_MACROS_GCC 1 - - /* Because djgpp <= 2.03 doesn't have snprintf() etc. */ - #if (DJGPP_MINOR < 4) - #define _MPRINTF_REPLACE - #endif - -#elif defined(__WATCOMC__) - #define HAVE_STRCASECMP 1 - -#elif defined(__HIGHC__) - #define HAVE_SYS_TIME_H 1 - #define strerror(e) strerror_s_((e)) -#endif - -#ifdef WATT32 - #define HAVE_AF_INET6 1 - #define HAVE_ARPA_INET_H 1 - #define HAVE_ARPA_NAMESER_H 1 - #define HAVE_CLOSE_S 1 - #define HAVE_GETHOSTNAME 1 - #define HAVE_NETDB_H 1 - #define HAVE_NETINET_IN_H 1 - #define HAVE_NETINET_TCP_H 1 - #define HAVE_PF_INET6 1 - #define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 - #define HAVE_STRUCT_ADDRINFO 1 - #define HAVE_STRUCT_IN6_ADDR 1 - #define HAVE_STRUCT_SOCKADDR_IN6 1 - #define HAVE_SYS_SOCKET_H 1 - #define HAVE_SYS_UIO_H 1 - #define NS_INADDRSZ 4 - #define HAVE_STRUCT_SOCKADDR_IN6 1 - - #define HAVE_GETSERVBYPORT_R 1 - #define GETSERVBYPORT_R_ARGS 5 -#endif - -#undef word -#undef byte - -#endif /* HEADER_CONFIG_DOS_H */ - diff --git a/lib/c-ares-1.19.1/src/lib/setup_once.h b/lib/c-ares-1.19.1/src/lib/setup_once.h deleted file mode 100644 index a8cfe6beccd..00000000000 --- a/lib/c-ares-1.19.1/src/lib/setup_once.h +++ /dev/null @@ -1,554 +0,0 @@ -#ifndef __SETUP_ONCE_H -#define __SETUP_ONCE_H - - -/* Copyright (C) 2004 - 2013 by Daniel Stenberg et al - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - - -/******************************************************************** - * NOTICE * - * ======== * - * * - * Content of header files lib/setup_once.h and ares/setup_once.h * - * must be kept in sync. Modify the other one if you change this. * - * * - ********************************************************************/ - - -/* - * Inclusion of common header files. - */ - -#include -#include -#include -#include -#include - -#ifdef HAVE_ERRNO_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#ifdef NEED_MALLOC_H -#include -#endif - -#ifdef NEED_MEMORY_H -#include -#endif - -#ifdef HAVE_SYS_STAT_H -#include -#endif - -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif - -#ifdef WIN32 -#include -#include -#endif - -#if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T) -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef __hpux -# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL) -# ifdef _APP32_64BIT_OFF_T -# define OLD_APP32_64BIT_OFF_T _APP32_64BIT_OFF_T -# undef _APP32_64BIT_OFF_T -# else -# undef OLD_APP32_64BIT_OFF_T -# endif -# endif -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef __hpux -# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL) -# ifdef OLD_APP32_64BIT_OFF_T -# define _APP32_64BIT_OFF_T OLD_APP32_64BIT_OFF_T -# undef OLD_APP32_64BIT_OFF_T -# endif -# endif -#endif - - -/* - * Definition of timeval struct for platforms that don't have it. - */ - -#ifndef HAVE_STRUCT_TIMEVAL -struct timeval { - long tv_sec; - long tv_usec; -}; -#endif - - -/* - * If we have the MSG_NOSIGNAL define, make sure we use - * it as the fourth argument of function send() - */ - -#ifdef HAVE_MSG_NOSIGNAL -#define SEND_4TH_ARG MSG_NOSIGNAL -#else -#define SEND_4TH_ARG 0 -#endif - - -#if defined(__minix) -/* Minix doesn't support recv on TCP sockets */ -#define sread(x,y,z) (ares_ssize_t)read((RECV_TYPE_ARG1)(x), \ - (RECV_TYPE_ARG2)(y), \ - (RECV_TYPE_ARG3)(z)) - -#elif defined(HAVE_RECV) -/* - * The definitions for the return type and arguments types - * of functions recv() and send() belong and come from the - * configuration file. Do not define them in any other place. - * - * HAVE_RECV is defined if you have a function named recv() - * which is used to read incoming data from sockets. If your - * function has another name then don't define HAVE_RECV. - * - * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2, - * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also - * be defined. - * - * HAVE_SEND is defined if you have a function named send() - * which is used to write outgoing data on a connected socket. - * If yours has another name then don't define HAVE_SEND. - * - * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2, - * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and - * SEND_TYPE_RETV must also be defined. - */ - -#if !defined(RECV_TYPE_ARG1) || \ - !defined(RECV_TYPE_ARG2) || \ - !defined(RECV_TYPE_ARG3) || \ - !defined(RECV_TYPE_ARG4) || \ - !defined(RECV_TYPE_RETV) - /* */ - Error Missing_definition_of_return_and_arguments_types_of_recv - /* */ -#else -#define sread(x,y,z) (ares_ssize_t)recv((RECV_TYPE_ARG1)(x), \ - (RECV_TYPE_ARG2)(y), \ - (RECV_TYPE_ARG3)(z), \ - (RECV_TYPE_ARG4)(0)) -#endif -#else /* HAVE_RECV */ -#ifndef sread - /* */ - Error Missing_definition_of_macro_sread - /* */ -#endif -#endif /* HAVE_RECV */ - - -#if defined(__minix) -/* Minix doesn't support send on TCP sockets */ -#define swrite(x,y,z) (ares_ssize_t)write((SEND_TYPE_ARG1)(x), \ - (SEND_TYPE_ARG2)(y), \ - (SEND_TYPE_ARG3)(z)) - -#elif defined(HAVE_SEND) -#if !defined(SEND_TYPE_ARG1) || \ - !defined(SEND_QUAL_ARG2) || \ - !defined(SEND_TYPE_ARG2) || \ - !defined(SEND_TYPE_ARG3) || \ - !defined(SEND_TYPE_ARG4) || \ - !defined(SEND_TYPE_RETV) - /* */ - Error Missing_definition_of_return_and_arguments_types_of_send - /* */ -#else -#define swrite(x,y,z) (ares_ssize_t)send((SEND_TYPE_ARG1)(x), \ - (SEND_TYPE_ARG2)(y), \ - (SEND_TYPE_ARG3)(z), \ - (SEND_TYPE_ARG4)(SEND_4TH_ARG)) -#endif -#else /* HAVE_SEND */ -#ifndef swrite - /* */ - Error Missing_definition_of_macro_swrite - /* */ -#endif -#endif /* HAVE_SEND */ - - -#if 0 -#if defined(HAVE_RECVFROM) -/* - * Currently recvfrom is only used on udp sockets. - */ -#if !defined(RECVFROM_TYPE_ARG1) || \ - !defined(RECVFROM_TYPE_ARG2) || \ - !defined(RECVFROM_TYPE_ARG3) || \ - !defined(RECVFROM_TYPE_ARG4) || \ - !defined(RECVFROM_TYPE_ARG5) || \ - !defined(RECVFROM_TYPE_ARG6) || \ - !defined(RECVFROM_TYPE_RETV) - /* */ - Error Missing_definition_of_return_and_arguments_types_of_recvfrom - /* */ -#else -#define sreadfrom(s,b,bl,f,fl) (ares_ssize_t)recvfrom((RECVFROM_TYPE_ARG1) (s), \ - (RECVFROM_TYPE_ARG2 *)(b), \ - (RECVFROM_TYPE_ARG3) (bl), \ - (RECVFROM_TYPE_ARG4) (0), \ - (RECVFROM_TYPE_ARG5 *)(f), \ - (RECVFROM_TYPE_ARG6 *)(fl)) -#endif -#else /* HAVE_RECVFROM */ -#ifndef sreadfrom - /* */ - Error Missing_definition_of_macro_sreadfrom - /* */ -#endif -#endif /* HAVE_RECVFROM */ - - -#ifdef RECVFROM_TYPE_ARG6_IS_VOID -# define RECVFROM_ARG6_T int -#else -# define RECVFROM_ARG6_T RECVFROM_TYPE_ARG6 -#endif -#endif /* if 0 */ - - -/* - * Function-like macro definition used to close a socket. - */ - -#if defined(HAVE_CLOSESOCKET) -# define sclose(x) closesocket((x)) -#elif defined(HAVE_CLOSESOCKET_CAMEL) -# define sclose(x) CloseSocket((x)) -#elif defined(HAVE_CLOSE_S) -# define sclose(x) close_s((x)) -#else -# define sclose(x) close((x)) -#endif - - -/* - * Uppercase macro versions of ANSI/ISO is*() functions/macros which - * avoid negative number inputs with argument byte codes > 127. - */ - -#define ISSPACE(x) (isspace((int) ((unsigned char)x))) -#define ISDIGIT(x) (isdigit((int) ((unsigned char)x))) -#define ISALNUM(x) (isalnum((int) ((unsigned char)x))) -#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x))) -#define ISGRAPH(x) (isgraph((int) ((unsigned char)x))) -#define ISALPHA(x) (isalpha((int) ((unsigned char)x))) -#define ISPRINT(x) (isprint((int) ((unsigned char)x))) -#define ISUPPER(x) (isupper((int) ((unsigned char)x))) -#define ISLOWER(x) (islower((int) ((unsigned char)x))) -#define ISASCII(x) (isascii((int) ((unsigned char)x))) - -#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \ - (((unsigned char)x) == '\t')) - -#define TOLOWER(x) (tolower((int) ((unsigned char)x))) - - -/* - * 'bool' stuff compatible with HP-UX headers. - */ - -#if defined(__hpux) && !defined(HAVE_BOOL_T) - typedef int bool; -# define false 0 -# define true 1 -# define HAVE_BOOL_T -#endif - - -/* - * 'bool' exists on platforms with , i.e. C99 platforms. - * On non-C99 platforms there's no bool, so define an enum for that. - * On C99 platforms 'false' and 'true' also exist. Enum uses a - * global namespace though, so use bool_false and bool_true. - */ - -#ifndef HAVE_BOOL_T - typedef enum { - bool_false = 0, - bool_true = 1 - } bool; - -/* - * Use a define to let 'true' and 'false' use those enums. There - * are currently no use of true and false in libcurl proper, but - * there are some in the examples. This will cater for any later - * code happening to use true and false. - */ -# define false bool_false -# define true bool_true -# define HAVE_BOOL_T -#endif - - -/* - * Redefine TRUE and FALSE too, to catch current use. With this - * change, 'bool found = 1' will give a warning on MIPSPro, but - * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro, - * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too. - */ - -#ifndef TRUE -#define TRUE true -#endif -#ifndef FALSE -#define FALSE false -#endif - - -/* - * Macro WHILE_FALSE may be used to build single-iteration do-while loops, - * avoiding compiler warnings. Mostly intended for other macro definitions. - */ - -#define WHILE_FALSE while(0) - -#if defined(_MSC_VER) && !defined(__POCC__) -# undef WHILE_FALSE -# if (_MSC_VER < 1500) -# define WHILE_FALSE while(1, 0) -# else -# define WHILE_FALSE \ -__pragma(warning(push)) \ -__pragma(warning(disable:4127)) \ -while(0) \ -__pragma(warning(pop)) -# endif -#endif - - -/* - * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type. - */ - -#ifndef HAVE_SIG_ATOMIC_T -typedef int sig_atomic_t; -#define HAVE_SIG_ATOMIC_T -#endif - - -/* - * Convenience SIG_ATOMIC_T definition - */ - -#ifdef HAVE_SIG_ATOMIC_T_VOLATILE -#define SIG_ATOMIC_T static sig_atomic_t -#else -#define SIG_ATOMIC_T static volatile sig_atomic_t -#endif - - -/* - * Default return type for signal handlers. - */ - -#ifndef RETSIGTYPE -#define RETSIGTYPE void -#endif - - -/* - * Macro used to include code only in debug builds. - */ - -#ifdef DEBUGBUILD -#define DEBUGF(x) x -#else -#define DEBUGF(x) do { } WHILE_FALSE -#endif - - -/* - * Macro used to include assertion code only in debug builds. - */ - -#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H) -#define DEBUGASSERT(x) assert(x) -#else -#define DEBUGASSERT(x) do { } WHILE_FALSE -#endif - - -/* - * Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno - * (or equivalent) on this platform to hide platform details to code using it. - */ - -#ifdef USE_WINSOCK -#define SOCKERRNO ((int)WSAGetLastError()) -#define SET_SOCKERRNO(x) (WSASetLastError((int)(x))) -#else -#define SOCKERRNO (errno) -#define SET_SOCKERRNO(x) (errno = (x)) -#endif - - -/* - * Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno - * (or equivalent) on this platform to hide platform details to code using it. - */ - -#if defined(WIN32) && !defined(WATT32) -#define ERRNO ((int)GetLastError()) -#define SET_ERRNO(x) (SetLastError((DWORD)(x))) -#else -#define ERRNO (errno) -#define SET_ERRNO(x) (errno = (x)) -#endif - - -/* - * Portable error number symbolic names defined to Winsock error codes. - */ - -#ifdef USE_WINSOCK -#undef EBADF /* override definition in errno.h */ -#define EBADF WSAEBADF -#undef EINTR /* override definition in errno.h */ -#define EINTR WSAEINTR -#undef EINVAL /* override definition in errno.h */ -#define EINVAL WSAEINVAL -#undef EWOULDBLOCK /* override definition in errno.h */ -#define EWOULDBLOCK WSAEWOULDBLOCK -#undef EINPROGRESS /* override definition in errno.h */ -#define EINPROGRESS WSAEINPROGRESS -#undef EALREADY /* override definition in errno.h */ -#define EALREADY WSAEALREADY -#undef ENOTSOCK /* override definition in errno.h */ -#define ENOTSOCK WSAENOTSOCK -#undef EDESTADDRREQ /* override definition in errno.h */ -#define EDESTADDRREQ WSAEDESTADDRREQ -#undef EMSGSIZE /* override definition in errno.h */ -#define EMSGSIZE WSAEMSGSIZE -#undef EPROTOTYPE /* override definition in errno.h */ -#define EPROTOTYPE WSAEPROTOTYPE -#undef ENOPROTOOPT /* override definition in errno.h */ -#define ENOPROTOOPT WSAENOPROTOOPT -#undef EPROTONOSUPPORT /* override definition in errno.h */ -#define EPROTONOSUPPORT WSAEPROTONOSUPPORT -#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT -#undef EOPNOTSUPP /* override definition in errno.h */ -#define EOPNOTSUPP WSAEOPNOTSUPP -#define EPFNOSUPPORT WSAEPFNOSUPPORT -#undef EAFNOSUPPORT /* override definition in errno.h */ -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#undef EADDRINUSE /* override definition in errno.h */ -#define EADDRINUSE WSAEADDRINUSE -#undef EADDRNOTAVAIL /* override definition in errno.h */ -#define EADDRNOTAVAIL WSAEADDRNOTAVAIL -#undef ENETDOWN /* override definition in errno.h */ -#define ENETDOWN WSAENETDOWN -#undef ENETUNREACH /* override definition in errno.h */ -#define ENETUNREACH WSAENETUNREACH -#undef ENETRESET /* override definition in errno.h */ -#define ENETRESET WSAENETRESET -#undef ECONNABORTED /* override definition in errno.h */ -#define ECONNABORTED WSAECONNABORTED -#undef ECONNRESET /* override definition in errno.h */ -#define ECONNRESET WSAECONNRESET -#undef ENOBUFS /* override definition in errno.h */ -#define ENOBUFS WSAENOBUFS -#undef EISCONN /* override definition in errno.h */ -#define EISCONN WSAEISCONN -#undef ENOTCONN /* override definition in errno.h */ -#define ENOTCONN WSAENOTCONN -#define ESHUTDOWN WSAESHUTDOWN -#define ETOOMANYREFS WSAETOOMANYREFS -#undef ETIMEDOUT /* override definition in errno.h */ -#define ETIMEDOUT WSAETIMEDOUT -#undef ECONNREFUSED /* override definition in errno.h */ -#define ECONNREFUSED WSAECONNREFUSED -#undef ELOOP /* override definition in errno.h */ -#define ELOOP WSAELOOP -#ifndef ENAMETOOLONG /* possible previous definition in errno.h */ -#define ENAMETOOLONG WSAENAMETOOLONG -#endif -#define EHOSTDOWN WSAEHOSTDOWN -#undef EHOSTUNREACH /* override definition in errno.h */ -#define EHOSTUNREACH WSAEHOSTUNREACH -#ifndef ENOTEMPTY /* possible previous definition in errno.h */ -#define ENOTEMPTY WSAENOTEMPTY -#endif -#define EPROCLIM WSAEPROCLIM -#define EUSERS WSAEUSERS -#define EDQUOT WSAEDQUOT -#define ESTALE WSAESTALE -#define EREMOTE WSAEREMOTE -#endif - - -/* - * Actually use __32_getpwuid() on 64-bit VMS builds for getpwuid() - */ - -#if defined(__VMS) && \ - defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) -#define getpwuid __32_getpwuid -#endif - - -/* - * Macro argv_item_t hides platform details to code using it. - */ - -#ifdef __VMS -#define argv_item_t __char_ptr32 -#else -#define argv_item_t char * -#endif - - -/* - * We use this ZERO_NULL to avoid picky compiler warnings, - * when assigning a NULL pointer to a function pointer var. - */ - -#define ZERO_NULL 0 - - -#endif /* __SETUP_ONCE_H */ diff --git a/lib/c-ares-1.19.1/src/lib/windows_port.c b/lib/c-ares-1.19.1/src/lib/windows_port.c deleted file mode 100644 index 03acd1c1e2b..00000000000 --- a/lib/c-ares-1.19.1/src/lib/windows_port.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "ares_setup.h" - - -/* only do the following on windows - */ -#if (defined(WIN32) || defined(WATT32)) && !defined(MSDOS) - -#ifdef __WATCOMC__ -/* - * Watcom needs a DllMain() in order to initialise the clib startup code. - */ -BOOL -WINAPI DllMain (HINSTANCE hnd, DWORD reason, LPVOID reserved) -{ - (void) hnd; - (void) reason; - (void) reserved; - return (TRUE); -} -#endif - -#endif /* WIN32 builds only */ diff --git a/lib/c-ares-1.19.1/src/tools/acountry.c b/lib/c-ares-1.19.1/src/tools/acountry.c deleted file mode 100644 index 00a6e67e138..00000000000 --- a/lib/c-ares-1.19.1/src/tools/acountry.c +++ /dev/null @@ -1,655 +0,0 @@ -/* - * - * IP-address/hostname to country converter. - * - * Problem; you want to know where IP a.b.c.d is located. - * - * Use ares_gethostbyname ("d.c.b.a.zz.countries.nerd.dk") - * and get the CNAME (host->h_name). Result will be: - * CNAME = zz.countries.nerd.dk with address 127.0.x.y (ver 1) or - * CNAME = .zz.countries.nerd.dk with address 127.0.x.y (ver 2) - * - * The 2 letter country code is in and the ISO-3166 country - * number is in x.y (number = x*256 + y). Version 2 of the protocol is missing - * the number. - * - * Ref: http://countries.nerd.dk/more.html - * - * Written by G. Vanem 2006, 2007 - * - * NB! This program may not be big-endian aware. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_STRINGS_H -#include -#endif - -#if defined(WIN32) && !defined(WATT32) - #include -#else - #include - #include - #include -#endif - -#include "ares.h" -#include "ares_getopt.h" -#include "ares_nowarn.h" - -#ifndef HAVE_STRDUP -# include "ares_strdup.h" -# define strdup(ptr) ares_strdup(ptr) -#endif - -#ifndef HAVE_STRCASECMP -# include "ares_strcasecmp.h" -# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2) -#endif - -#ifndef HAVE_STRNCASECMP -# include "ares_strcasecmp.h" -# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n) -#endif - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -/* By using a double cast, we can get rid of the bogus warning of - * warning: cast from 'const struct sockaddr *' to 'const struct sockaddr_in6 *' increases required alignment from 1 to 4 [-Wcast-align] - */ -#define CARES_INADDR_CAST(type, var) ((type)((void *)var)) - -static const char *usage = "acountry [-?hdv] {host|addr} ...\n"; -static const char nerd_fmt[] = "%u.%u.%u.%u.zz.countries.nerd.dk"; -static const char *nerd_ver1 = nerd_fmt + 14; /* .countries.nerd.dk */ -static const char *nerd_ver2 = nerd_fmt + 11; /* .zz.countries.nerd.dk */ -static int verbose = 0; - -#define TRACE(fmt) do { \ - if (verbose > 0) \ - printf fmt ; \ - } WHILE_FALSE - -static void wait_ares(ares_channel channel); -static void callback(void *arg, int status, int timeouts, struct hostent *host); -static void callback2(void *arg, int status, int timeouts, struct hostent *host); -static void find_country_from_cname(const char *cname, struct in_addr addr); -static void print_help_info_acountry(void); - -static void Abort(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - exit(1); -} - -int main(int argc, char **argv) -{ - ares_channel channel; - int ch, status; - -#if defined(WIN32) && !defined(WATT32) - WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK); - WSADATA wsaData; - WSAStartup(wVersionRequested, &wsaData); -#endif - - status = ares_library_init(ARES_LIB_INIT_ALL); - if (status != ARES_SUCCESS) - { - fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status)); - return 1; - } - - while ((ch = ares_getopt(argc, argv, "dvh?")) != -1) - switch (ch) - { - case 'd': -#ifdef WATT32 - dbug_init(); -#endif - break; - case 'v': - verbose++; - break; - case 'h': - print_help_info_acountry(); - break; - case '?': - print_help_info_acountry(); - break; - default: - Abort(usage); - } - - argc -= optind; - argv += optind; - if (argc < 1) - Abort(usage); - - status = ares_init(&channel); - if (status != ARES_SUCCESS) - { - fprintf(stderr, "ares_init: %s\n", ares_strerror(status)); - return 1; - } - - /* Initiate the queries, one per command-line argument. */ - for ( ; *argv; argv++) - { - struct in_addr addr; - char *buf; - - /* If this fails, assume '*argv' is a host-name that - * must be resolved first - */ - if (ares_inet_pton(AF_INET, *argv, &addr) != 1) - { - ares_gethostbyname(channel, *argv, AF_INET, callback2, &addr); - wait_ares(channel); - if (addr.s_addr == INADDR_NONE) - { - printf("Failed to lookup %s\n", *argv); - continue; - } - } - - buf = malloc(100); - sprintf(buf, nerd_fmt, - (unsigned int)(addr.s_addr >> 24), - (unsigned int)((addr.s_addr >> 16) & 255), - (unsigned int)((addr.s_addr >> 8) & 255), - (unsigned int)(addr.s_addr & 255)); - TRACE(("Looking up %s...", buf)); - fflush(stdout); - ares_gethostbyname(channel, buf, AF_INET, callback, buf); - } - - wait_ares(channel); - ares_destroy(channel); - - ares_library_cleanup(); - -#if defined(WIN32) && !defined(WATT32) - WSACleanup(); -#endif - - return 0; -} - -/* - * Wait for the queries to complete. - */ -static void wait_ares(ares_channel channel) -{ - for (;;) - { - struct timeval *tvp, tv; - fd_set read_fds, write_fds; - int nfds; - - FD_ZERO(&read_fds); - FD_ZERO(&write_fds); - nfds = ares_fds(channel, &read_fds, &write_fds); - if (nfds == 0) - break; - tvp = ares_timeout(channel, NULL, &tv); - nfds = select(nfds, &read_fds, &write_fds, NULL, tvp); - if (nfds < 0) - continue; - ares_process(channel, &read_fds, &write_fds); - } -} - -/* - * This is the callback used when we have the IP-address of interest. - * Extract the CNAME and figure out the country-code from it. - */ -static void callback(void *arg, int status, int timeouts, struct hostent *host) -{ - const char *name = (const char*)arg; - const char *cname; - char buf[20]; - - (void)timeouts; - - if (!host || status != ARES_SUCCESS) - { - printf("Failed to lookup %s: %s\n", name, ares_strerror(status)); - free(arg); - return; - } - - TRACE(("\nFound address %s, name %s\n", - ares_inet_ntop(AF_INET,(const char*)host->h_addr,buf,sizeof(buf)), - host->h_name)); - - cname = host->h_name; /* CNAME gets put here */ - if (!cname) - printf("Failed to get CNAME for %s\n", name); - else - find_country_from_cname(cname, *(CARES_INADDR_CAST(struct in_addr *, host->h_addr))); - free(arg); -} - -/* - * This is the callback used to obtain the IP-address of the host of interest. - */ -static void callback2(void *arg, int status, int timeouts, struct hostent *host) -{ - struct in_addr *addr = (struct in_addr*) arg; - - (void)timeouts; - if (!host || status != ARES_SUCCESS) - memset(addr, INADDR_NONE, sizeof(*addr)); - else - memcpy(addr, host->h_addr, sizeof(*addr)); -} - -struct search_list { - int country_number; /* ISO-3166 country number */ - char short_name[3]; /* A2 short country code */ - const char *long_name; /* normal country name */ - }; - -static const struct search_list *list_lookup(int number, const struct search_list *list, int num) -{ - while (num > 0 && list->long_name) - { - if (list->country_number == number) - return (list); - num--; - list++; - } - return (NULL); -} - -/* - * Ref: https://en.wikipedia.org/wiki/ISO_3166-1 - */ -static const struct search_list country_list[] = { - { 4, "af", "Afghanistan" }, - { 248, "ax", "Åland Island" }, - { 8, "al", "Albania" }, - { 12, "dz", "Algeria" }, - { 16, "as", "American Samoa" }, - { 20, "ad", "Andorra" }, - { 24, "ao", "Angola" }, - { 660, "ai", "Anguilla" }, - { 10, "aq", "Antarctica" }, - { 28, "ag", "Antigua & Barbuda" }, - { 32, "ar", "Argentina" }, - { 51, "am", "Armenia" }, - { 533, "aw", "Aruba" }, - { 36, "au", "Australia" }, - { 40, "at", "Austria" }, - { 31, "az", "Azerbaijan" }, - { 44, "bs", "Bahamas" }, - { 48, "bh", "Bahrain" }, - { 50, "bd", "Bangladesh" }, - { 52, "bb", "Barbados" }, - { 112, "by", "Belarus" }, - { 56, "be", "Belgium" }, - { 84, "bz", "Belize" }, - { 204, "bj", "Benin" }, - { 60, "bm", "Bermuda" }, - { 64, "bt", "Bhutan" }, - { 68, "bo", "Bolivia" }, - { 535, "bq", "Bonaire, Sint Eustatius and Saba" }, /* Formerly 'Bonaire' / 'Netherlands Antilles' */ - { 70, "ba", "Bosnia & Herzegovina" }, - { 72, "bw", "Botswana" }, - { 74, "bv", "Bouvet Island" }, - { 76, "br", "Brazil" }, - { 86, "io", "British Indian Ocean Territory" }, - { 96, "bn", "Brunei Darussalam" }, - { 100, "bg", "Bulgaria" }, - { 854, "bf", "Burkina Faso" }, - { 108, "bi", "Burundi" }, - { 116, "kh", "Cambodia" }, - { 120, "cm", "Cameroon" }, - { 124, "ca", "Canada" }, - { 132, "cv", "Cape Verde" }, - { 136, "ky", "Cayman Islands" }, - { 140, "cf", "Central African Republic" }, - { 148, "td", "Chad" }, - { 152, "cl", "Chile" }, - { 156, "cn", "China" }, - { 162, "cx", "Christmas Island" }, - { 166, "cc", "Cocos Islands" }, - { 170, "co", "Colombia" }, - { 174, "km", "Comoros" }, - { 178, "cg", "Congo" }, - { 180, "cd", "Congo" }, - { 184, "ck", "Cook Islands" }, - { 188, "cr", "Costa Rica" }, - { 384, "ci", "Cote d'Ivoire" }, - { 191, "hr", "Croatia" }, - { 192, "cu", "Cuba" }, - { 531, "cw", "Curaçao" }, - { 196, "cy", "Cyprus" }, - { 203, "cz", "Czech Republic" }, - { 208, "dk", "Denmark" }, - { 262, "dj", "Djibouti" }, - { 212, "dm", "Dominica" }, - { 214, "do", "Dominican Republic" }, - { 218, "ec", "Ecuador" }, - { 818, "eg", "Egypt" }, - { 222, "sv", "El Salvador" }, - { 226, "gq", "Equatorial Guinea" }, - { 232, "er", "Eritrea" }, - { 233, "ee", "Estonia" }, - { 748, "sz", "Eswatini" }, /* Formerly Swaziland */ - { 231, "et", "Ethiopia" }, - { 65281, "eu", "European Union" }, /* 127.0.255.1 */ - { 238, "fk", "Falkland Islands" }, - { 234, "fo", "Faroe Islands" }, - { 242, "fj", "Fiji" }, - { 246, "fi", "Finland" }, - { 250, "fr", "France" }, - { 249, "fx", "France, Metropolitan" }, - { 254, "gf", "French Guiana" }, - { 258, "pf", "French Polynesia" }, - { 260, "tf", "French Southern Territories" }, - { 266, "ga", "Gabon" }, - { 270, "gm", "Gambia" }, - { 268, "ge", "Georgia" }, - { 276, "de", "Germany" }, - { 288, "gh", "Ghana" }, - { 292, "gi", "Gibraltar" }, - { 300, "gr", "Greece" }, - { 304, "gl", "Greenland" }, - { 308, "gd", "Grenada" }, - { 312, "gp", "Guadeloupe" }, - { 316, "gu", "Guam" }, - { 320, "gt", "Guatemala" }, - { 831, "gg", "Guernsey" }, - { 324, "gn", "Guinea" }, - { 624, "gw", "Guinea-Bissau" }, - { 328, "gy", "Guyana" }, - { 332, "ht", "Haiti" }, - { 334, "hm", "Heard & Mc Donald Islands" }, - { 336, "va", "Holy See" }, /* Vatican City */ - { 340, "hn", "Honduras" }, - { 344, "hk", "Hong kong" }, - { 348, "hu", "Hungary" }, - { 352, "is", "Iceland" }, - { 356, "in", "India" }, - { 360, "id", "Indonesia" }, - { 364, "ir", "Iran" }, - { 368, "iq", "Iraq" }, - { 372, "ie", "Ireland" }, - { 833, "im", "Isle of Man" }, - { 376, "il", "Israel" }, - { 380, "it", "Italy" }, - { 388, "jm", "Jamaica" }, - { 392, "jp", "Japan" }, - { 832, "je", "Jersey" }, - { 400, "jo", "Jordan" }, - { 398, "kz", "Kazakhstan" }, - { 404, "ke", "Kenya" }, - { 296, "ki", "Kiribati" }, - { 408, "kp", "Korea (north)" }, - { 410, "kr", "Korea (south)" }, - { 0, "xk", "Kosovo" }, /* https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 */ - { 414, "kw", "Kuwait" }, - { 417, "kg", "Kyrgyzstan" }, - { 418, "la", "Laos" }, - { 428, "lv", "Latvia" }, - { 422, "lb", "Lebanon" }, - { 426, "ls", "Lesotho" }, - { 430, "lr", "Liberia" }, - { 434, "ly", "Libya" }, - { 438, "li", "Liechtenstein" }, - { 440, "lt", "Lithuania" }, - { 442, "lu", "Luxembourg" }, - { 446, "mo", "Macao" }, - { 450, "mg", "Madagascar" }, - { 454, "mw", "Malawi" }, - { 458, "my", "Malaysia" }, - { 462, "mv", "Maldives" }, - { 466, "ml", "Mali" }, - { 470, "mt", "Malta" }, - { 584, "mh", "Marshall Islands" }, - { 474, "mq", "Martinique" }, - { 478, "mr", "Mauritania" }, - { 480, "mu", "Mauritius" }, - { 175, "yt", "Mayotte" }, - { 484, "mx", "Mexico" }, - { 583, "fm", "Micronesia" }, - { 498, "md", "Moldova" }, - { 492, "mc", "Monaco" }, - { 496, "mn", "Mongolia" }, - { 499, "me", "Montenegro" }, - { 500, "ms", "Montserrat" }, - { 504, "ma", "Morocco" }, - { 508, "mz", "Mozambique" }, - { 104, "mm", "Myanmar" }, - { 516, "na", "Namibia" }, - { 520, "nr", "Nauru" }, - { 524, "np", "Nepal" }, - { 528, "nl", "Netherlands" }, - { 540, "nc", "New Caledonia" }, - { 554, "nz", "New Zealand" }, - { 558, "ni", "Nicaragua" }, - { 562, "ne", "Niger" }, - { 566, "ng", "Nigeria" }, - { 570, "nu", "Niue" }, - { 574, "nf", "Norfolk Island" }, - { 807, "mk", "North Macedonia" }, /* 'Macedonia' until February 2019 */ - { 580, "mp", "Northern Mariana Islands" }, - { 578, "no", "Norway" }, - { 512, "om", "Oman" }, - { 586, "pk", "Pakistan" }, - { 585, "pw", "Palau" }, - { 275, "ps", "Palestinian Territory" }, - { 591, "pa", "Panama" }, - { 598, "pg", "Papua New Guinea" }, - { 600, "py", "Paraguay" }, - { 604, "pe", "Peru" }, - { 608, "ph", "Philippines" }, - { 612, "pn", "Pitcairn" }, - { 616, "pl", "Poland" }, - { 620, "pt", "Portugal" }, - { 630, "pr", "Puerto Rico" }, - { 634, "qa", "Qatar" }, - { 638, "re", "Reunion" }, - { 642, "ro", "Romania" }, - { 643, "ru", "Russian Federation" }, - { 646, "rw", "Rwanda" }, - { 0, "bl", "Saint Barthélemy" }, /* https://en.wikipedia.org/wiki/ISO_3166-2:BL */ - { 659, "kn", "Saint Kitts & Nevis" }, - { 662, "lc", "Saint Lucia" }, - { 663, "mf", "Saint Martin" }, - { 670, "vc", "Saint Vincent" }, - { 882, "ws", "Samoa" }, - { 674, "sm", "San Marino" }, - { 678, "st", "Sao Tome & Principe" }, - { 682, "sa", "Saudi Arabia" }, - { 686, "sn", "Senegal" }, - { 688, "rs", "Serbia" }, - { 690, "sc", "Seychelles" }, - { 694, "sl", "Sierra Leone" }, - { 702, "sg", "Singapore" }, - { 534, "sx", "Sint Maarten" }, - { 703, "sk", "Slovakia" }, - { 705, "si", "Slovenia" }, - { 90, "sb", "Solomon Islands" }, - { 706, "so", "Somalia" }, - { 710, "za", "South Africa" }, - { 239, "gs", "South Georgia & South Sandwich Is." }, - { 728, "ss", "South Sudan" }, - { 724, "es", "Spain" }, - { 144, "lk", "Sri Lanka" }, - { 654, "sh", "St. Helena" }, - { 666, "pm", "St. Pierre & Miquelon" }, - { 736, "sd", "Sudan" }, - { 740, "sr", "Suriname" }, - { 744, "sj", "Svalbard & Jan Mayen Islands" }, - { 752, "se", "Sweden" }, - { 756, "ch", "Switzerland" }, - { 760, "sy", "Syrian Arab Republic" }, - { 158, "tw", "Taiwan" }, - { 762, "tj", "Tajikistan" }, - { 834, "tz", "Tanzania" }, - { 764, "th", "Thailand" }, - { 626, "tl", "Timor-Leste" }, - { 768, "tg", "Togo" }, - { 772, "tk", "Tokelau" }, - { 776, "to", "Tonga" }, - { 780, "tt", "Trinidad & Tobago" }, - { 788, "tn", "Tunisia" }, - { 792, "tr", "Turkey" }, - { 795, "tm", "Turkmenistan" }, - { 796, "tc", "Turks & Caicos Islands" }, - { 798, "tv", "Tuvalu" }, - { 800, "ug", "Uganda" }, - { 804, "ua", "Ukraine" }, - { 784, "ae", "United Arab Emirates" }, - { 826, "gb", "United Kingdom" }, - { 840, "us", "United States" }, - { 581, "um", "United States Minor Outlying Islands" }, - { 858, "uy", "Uruguay" }, - { 860, "uz", "Uzbekistan" }, - { 548, "vu", "Vanuatu" }, - { 862, "ve", "Venezuela" }, - { 704, "vn", "Vietnam" }, - { 92, "vg", "Virgin Islands (British)" }, - { 850, "vi", "Virgin Islands (US)" }, - { 876, "wf", "Wallis & Futuna Islands" }, - { 732, "eh", "Western Sahara" }, - { 887, "ye", "Yemen" }, - { 894, "zm", "Zambia" }, - { 716, "zw", "Zimbabwe" } - }; - -/* - * Check if start of 'str' is simply an IPv4 address. - */ -#define BYTE_OK(x) ((x) >= 0 && (x) <= 255) - -static int is_addr(char *str, char **end) -{ - int a0, a1, a2, a3, num, rc = 0, length = 0; - - num = sscanf(str,"%3d.%3d.%3d.%3d%n",&a0,&a1,&a2,&a3,&length); - if( (num == 4) && - BYTE_OK(a0) && BYTE_OK(a1) && BYTE_OK(a2) && BYTE_OK(a3) && - length >= (3+4)) - { - rc = 1; - *end = str + length; - } - return rc; -} - -/* - * Find the country-code and name from the CNAME. E.g.: - * version 1: CNAME = zzno.countries.nerd.dk with address 127.0.2.66 - * yields ccode_A" = "no" and cnumber 578 (2.66). - * version 2: CNAME = .zz.countries.nerd.dk with address 127.0.2.66 - * yields cnumber 578 (2.66). ccode_A is ""; - */ -static void find_country_from_cname(const char *cname, struct in_addr addr) -{ - const struct search_list *country; - char ccode_A2[3], *ccopy, *dot_4; - int cnumber, z0, z1, ver_1, ver_2; - unsigned long ip; - - ip = ntohl(addr.s_addr); - z0 = TOLOWER(cname[0]); - z1 = TOLOWER(cname[1]); - ccopy = strdup(cname); - dot_4 = NULL; - - ver_1 = (z0 == 'z' && z1 == 'z' && !strcasecmp(cname+4,nerd_ver1)); - ver_2 = (is_addr(ccopy,&dot_4) && !strcasecmp(dot_4,nerd_ver2)); - - if (ver_1) - { - const char *dot = strchr(cname, '.'); - if (dot != cname+4) - { - printf("Unexpected CNAME %s (ver_1)\n", cname); - free(ccopy); - return; - } - } - else if (ver_2) - { - z0 = TOLOWER(dot_4[1]); - z1 = TOLOWER(dot_4[2]); - if (z0 != 'z' && z1 != 'z') - { - printf("Unexpected CNAME %s (ver_2)\n", cname); - free(ccopy); - return; - } - } - else - { - printf("Unexpected CNAME %s (ver?)\n", cname); - free(ccopy); - return; - } - - if (ver_1) - { - ccode_A2[0] = (char)TOLOWER(cname[2]); - ccode_A2[1] = (char)TOLOWER(cname[3]); - ccode_A2[2] = '\0'; - } - else - ccode_A2[0] = '\0'; - - cnumber = ip & 0xFFFF; - - TRACE(("Found country-code `%s', number %d\n", - ver_1 ? ccode_A2 : "", cnumber)); - - country = list_lookup(cnumber, country_list, - sizeof(country_list) / sizeof(country_list[0])); - if (!country) - printf("Name for country-number %d not found.\n", cnumber); - else - { - if (ver_1) - { - if ((country->short_name[0] != ccode_A2[0]) || - (country->short_name[1] != ccode_A2[1]) || - (country->short_name[2] != ccode_A2[2])) - printf("short-name mismatch; %s vs %s\n", - country->short_name, ccode_A2); - } - printf("%s (%s), number %d.\n", - country->long_name, country->short_name, cnumber); - } - free(ccopy); -} - -/* Information from the man page. Formatting taken from man -h */ -static void print_help_info_acountry(void) { - printf("acountry, version %s\n\n", ARES_VERSION_STR); - printf("usage: acountry [-hdv] host|addr ...\n\n" - " h : Display this help and exit.\n" - " d : Print some extra debugging output.\n" - " v : Be more verbose. Print extra information.\n\n"); - exit(0); -} diff --git a/lib/c-ares-1.19.1/src/tools/adig.c b/lib/c-ares-1.19.1/src/tools/adig.c deleted file mode 100644 index cf5bd4d3f2f..00000000000 --- a/lib/c-ares-1.19.1/src/tools/adig.c +++ /dev/null @@ -1,988 +0,0 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#include "ares.h" -#include "ares_dns.h" -#include "ares_getopt.h" -#include "ares_nowarn.h" - -#ifndef HAVE_STRDUP -# include "ares_strdup.h" -# define strdup(ptr) ares_strdup(ptr) -#endif - -#ifndef HAVE_STRCASECMP -# include "ares_strcasecmp.h" -# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2) -#endif - -#ifndef HAVE_STRNCASECMP -# include "ares_strcasecmp.h" -# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n) -#endif - -#ifdef WATT32 -#undef WIN32 /* Redefined in MingW headers */ -#endif - - -struct nv { - const char *name; - int value; -}; - -static const struct nv flags[] = { - { "usevc", ARES_FLAG_USEVC }, - { "primary", ARES_FLAG_PRIMARY }, - { "igntc", ARES_FLAG_IGNTC }, - { "norecurse", ARES_FLAG_NORECURSE }, - { "stayopen", ARES_FLAG_STAYOPEN }, - { "noaliases", ARES_FLAG_NOALIASES } -}; -static const int nflags = sizeof(flags) / sizeof(flags[0]); - -static const struct nv classes[] = { - { "IN", C_IN }, - { "CHAOS", C_CHAOS }, - { "HS", C_HS }, - { "ANY", C_ANY } -}; -static const int nclasses = sizeof(classes) / sizeof(classes[0]); - -static const struct nv types[] = { - { "A", T_A }, - { "NS", T_NS }, - { "MD", T_MD }, - { "MF", T_MF }, - { "CNAME", T_CNAME }, - { "SOA", T_SOA }, - { "MB", T_MB }, - { "MG", T_MG }, - { "MR", T_MR }, - { "NULL", T_NULL }, - { "WKS", T_WKS }, - { "PTR", T_PTR }, - { "HINFO", T_HINFO }, - { "MINFO", T_MINFO }, - { "MX", T_MX }, - { "TXT", T_TXT }, - { "RP", T_RP }, - { "AFSDB", T_AFSDB }, - { "X25", T_X25 }, - { "ISDN", T_ISDN }, - { "RT", T_RT }, - { "NSAP", T_NSAP }, - { "NSAP_PTR", T_NSAP_PTR }, - { "SIG", T_SIG }, - { "KEY", T_KEY }, - { "PX", T_PX }, - { "GPOS", T_GPOS }, - { "AAAA", T_AAAA }, - { "LOC", T_LOC }, - { "SRV", T_SRV }, - { "AXFR", T_AXFR }, - { "MAILB", T_MAILB }, - { "MAILA", T_MAILA }, - { "NAPTR", T_NAPTR }, - { "DS", T_DS }, - { "SSHFP", T_SSHFP }, - { "RRSIG", T_RRSIG }, - { "NSEC", T_NSEC }, - { "DNSKEY", T_DNSKEY }, - { "CAA", T_CAA }, - { "URI", T_URI }, - { "ANY", T_ANY } -}; -static const int ntypes = sizeof(types) / sizeof(types[0]); - -static const char *opcodes[] = { - "QUERY", "IQUERY", "STATUS", "(reserved)", "NOTIFY", - "(unknown)", "(unknown)", "(unknown)", "(unknown)", - "UPDATEA", "UPDATED", "UPDATEDA", "UPDATEM", "UPDATEMA", - "ZONEINIT", "ZONEREF" -}; - -static const char *rcodes[] = { - "NOERROR", "FORMERR", "SERVFAIL", "NXDOMAIN", "NOTIMP", "REFUSED", - "(unknown)", "(unknown)", "(unknown)", "(unknown)", "(unknown)", - "(unknown)", "(unknown)", "(unknown)", "(unknown)", "NOCHANGE" -}; - -static void callback(void *arg, int status, int timeouts, - unsigned char *abuf, int alen); -static const unsigned char *display_question(const unsigned char *aptr, - const unsigned char *abuf, - int alen); -static const unsigned char *display_rr(const unsigned char *aptr, - const unsigned char *abuf, int alen); -static int convert_query (char **name, int use_bitstring); -static const char *type_name(int type); -static const char *class_name(int dnsclass); -static void usage(void); -static void destroy_addr_list(struct ares_addr_node *head); -static void append_addr_list(struct ares_addr_node **head, - struct ares_addr_node *node); -static void print_help_info_adig(void); - -int main(int argc, char **argv) -{ - ares_channel channel; - int c, i, optmask = ARES_OPT_FLAGS, dnsclass = C_IN, type = T_A; - int status, nfds, count; - int use_ptr_helper = 0; - struct ares_options options; - struct hostent *hostent; - fd_set read_fds, write_fds; - struct timeval *tvp, tv; - struct ares_addr_node *srvr, *servers = NULL; - -#ifdef USE_WINSOCK - WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK); - WSADATA wsaData; - WSAStartup(wVersionRequested, &wsaData); -#endif - - status = ares_library_init(ARES_LIB_INIT_ALL); - if (status != ARES_SUCCESS) - { - fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status)); - return 1; - } - - options.flags = ARES_FLAG_NOCHECKRESP; - options.servers = NULL; - options.nservers = 0; - while ((c = ares_getopt(argc, argv, "dh?f:s:c:t:T:U:x")) != -1) - { - switch (c) - { - case 'd': -#ifdef WATT32 - dbug_init(); -#endif - break; - case 'h': - print_help_info_adig(); - break; - case '?': - print_help_info_adig(); - break; - case 'f': - /* Add a flag. */ - for (i = 0; i < nflags; i++) - { - if (strcmp(flags[i].name, optarg) == 0) - break; - } - if (i < nflags) - options.flags |= flags[i].value; - else - usage(); - break; - - case 's': - /* User-specified name servers override default ones. */ - srvr = malloc(sizeof(struct ares_addr_node)); - if (!srvr) - { - fprintf(stderr, "Out of memory!\n"); - destroy_addr_list(servers); - return 1; - } - append_addr_list(&servers, srvr); - if (ares_inet_pton(AF_INET, optarg, &srvr->addr.addr4) > 0) - srvr->family = AF_INET; - else if (ares_inet_pton(AF_INET6, optarg, &srvr->addr.addr6) > 0) - srvr->family = AF_INET6; - else - { - hostent = gethostbyname(optarg); - if (!hostent) - { - fprintf(stderr, "adig: server %s not found.\n", optarg); - destroy_addr_list(servers); - return 1; - } - switch (hostent->h_addrtype) - { - case AF_INET: - srvr->family = AF_INET; - memcpy(&srvr->addr.addr4, hostent->h_addr, - sizeof(srvr->addr.addr4)); - break; - case AF_INET6: - srvr->family = AF_INET6; - memcpy(&srvr->addr.addr6, hostent->h_addr, - sizeof(srvr->addr.addr6)); - break; - default: - fprintf(stderr, - "adig: server %s unsupported address family.\n", optarg); - destroy_addr_list(servers); - return 1; - } - } - /* Notice that calling ares_init_options() without servers in the - * options struct and with ARES_OPT_SERVERS set simultaneously in - * the options mask, results in an initialization with no servers. - * When alternative name servers have been specified these are set - * later calling ares_set_servers() overriding any existing server - * configuration. To prevent initial configuration with default - * servers that will be discarded later, ARES_OPT_SERVERS is set. - * If this flag is not set here the result shall be the same but - * ares_init_options() will do needless work. */ - optmask |= ARES_OPT_SERVERS; - break; - - case 'c': - /* Set the query class. */ - for (i = 0; i < nclasses; i++) - { - if (strcasecmp(classes[i].name, optarg) == 0) - break; - } - if (i < nclasses) - dnsclass = classes[i].value; - else - usage(); - break; - - case 't': - /* Set the query type. */ - for (i = 0; i < ntypes; i++) - { - if (strcasecmp(types[i].name, optarg) == 0) - break; - } - if (i < ntypes) - type = types[i].value; - else - usage(); - break; - - case 'T': - /* Set the TCP port number. */ - if (!ISDIGIT(*optarg)) - usage(); - options.tcp_port = (unsigned short)strtol(optarg, NULL, 0); - options.flags |= ARES_FLAG_USEVC; - optmask |= ARES_OPT_TCP_PORT; - break; - - case 'U': - /* Set the UDP port number. */ - if (!ISDIGIT(*optarg)) - usage(); - options.udp_port = (unsigned short)strtol(optarg, NULL, 0); - optmask |= ARES_OPT_UDP_PORT; - break; - - case 'x': - use_ptr_helper++; - break; - } - } - argc -= optind; - argv += optind; - if (argc == 0) - usage(); - - status = ares_init_options(&channel, &options, optmask); - - if (status != ARES_SUCCESS) - { - fprintf(stderr, "ares_init_options: %s\n", - ares_strerror(status)); - return 1; - } - - if(servers) - { - status = ares_set_servers(channel, servers); - destroy_addr_list(servers); - if (status != ARES_SUCCESS) - { - fprintf(stderr, "ares_init_options: %s\n", - ares_strerror(status)); - return 1; - } - } - - /* Initiate the queries, one per command-line argument. If there is - * only one query to do, supply NULL as the callback argument; - * otherwise, supply the query name as an argument so we can - * distinguish responses for the user when printing them out. - */ - for (i = 1; *argv; i++, argv++) - { - char *query = *argv; - - if (type == T_PTR && dnsclass == C_IN && use_ptr_helper) - if (!convert_query (&query, use_ptr_helper >= 2)) - continue; - - ares_query(channel, query, dnsclass, type, callback, i < argc-1 ? (void*)query : NULL); - } - - /* Wait for all queries to complete. */ - for (;;) - { - FD_ZERO(&read_fds); - FD_ZERO(&write_fds); - nfds = ares_fds(channel, &read_fds, &write_fds); - if (nfds == 0) - break; - tvp = ares_timeout(channel, NULL, &tv); - count = select(nfds, &read_fds, &write_fds, NULL, tvp); - if (count < 0 && (status = SOCKERRNO) != EINVAL) - { - printf("select fail: %d", status); - return 1; - } - ares_process(channel, &read_fds, &write_fds); - } - - ares_destroy(channel); - - ares_library_cleanup(); - -#ifdef USE_WINSOCK - WSACleanup(); -#endif - - return 0; -} - -static void callback(void *arg, int status, int timeouts, - unsigned char *abuf, int alen) -{ - char *name = (char *) arg; - int id, qr, opcode, aa, tc, rd, ra, rcode; - unsigned int qdcount, ancount, nscount, arcount, i; - const unsigned char *aptr; - - (void) timeouts; - - /* Display the query name if given. */ - if (name) - printf("Answer for query %s:\n", name); - - /* Display an error message if there was an error, but only stop if - * we actually didn't get an answer buffer. - */ - if (status != ARES_SUCCESS) - { - printf("%s\n", ares_strerror(status)); - if (!abuf) - return; - } - - /* Won't happen, but check anyway, for safety. */ - if (alen < HFIXEDSZ) - return; - - /* Parse the answer header. */ - id = DNS_HEADER_QID(abuf); - qr = DNS_HEADER_QR(abuf); - opcode = DNS_HEADER_OPCODE(abuf); - aa = DNS_HEADER_AA(abuf); - tc = DNS_HEADER_TC(abuf); - rd = DNS_HEADER_RD(abuf); - ra = DNS_HEADER_RA(abuf); - rcode = DNS_HEADER_RCODE(abuf); - qdcount = DNS_HEADER_QDCOUNT(abuf); - ancount = DNS_HEADER_ANCOUNT(abuf); - nscount = DNS_HEADER_NSCOUNT(abuf); - arcount = DNS_HEADER_ARCOUNT(abuf); - - /* Display the answer header. */ - printf("id: %d\n", id); - printf("flags: %s%s%s%s%s\n", - qr ? "qr " : "", - aa ? "aa " : "", - tc ? "tc " : "", - rd ? "rd " : "", - ra ? "ra " : ""); - printf("opcode: %s\n", opcodes[opcode]); - printf("rcode: %s\n", rcodes[rcode]); - - /* Display the questions. */ - printf("Questions:\n"); - aptr = abuf + HFIXEDSZ; - for (i = 0; i < qdcount; i++) - { - aptr = display_question(aptr, abuf, alen); - if (aptr == NULL) - return; - } - - /* Display the answers. */ - printf("Answers:\n"); - for (i = 0; i < ancount; i++) - { - aptr = display_rr(aptr, abuf, alen); - if (aptr == NULL) - return; - } - - /* Display the NS records. */ - printf("NS records:\n"); - for (i = 0; i < nscount; i++) - { - aptr = display_rr(aptr, abuf, alen); - if (aptr == NULL) - return; - } - - /* Display the additional records. */ - printf("Additional records:\n"); - for (i = 0; i < arcount; i++) - { - aptr = display_rr(aptr, abuf, alen); - if (aptr == NULL) - return; - } -} - -static const unsigned char *display_question(const unsigned char *aptr, - const unsigned char *abuf, - int alen) -{ - char *name; - int type, dnsclass, status; - long len; - - /* Parse the question name. */ - status = ares_expand_name(aptr, abuf, alen, &name, &len); - if (status != ARES_SUCCESS) - return NULL; - aptr += len; - - /* Make sure there's enough data after the name for the fixed part - * of the question. - */ - if (aptr + QFIXEDSZ > abuf + alen) - { - ares_free_string(name); - return NULL; - } - - /* Parse the question type and class. */ - type = DNS_QUESTION_TYPE(aptr); - dnsclass = DNS_QUESTION_CLASS(aptr); - aptr += QFIXEDSZ; - - /* Display the question, in a format sort of similar to how we will - * display RRs. - */ - printf("\t%-15s.\t", name); - if (dnsclass != C_IN) - printf("\t%s", class_name(dnsclass)); - printf("\t%s\n", type_name(type)); - ares_free_string(name); - return aptr; -} - -static const unsigned char *display_rr(const unsigned char *aptr, - const unsigned char *abuf, int alen) -{ - const unsigned char *p; - int type, dnsclass, ttl, dlen, status, i; - long len; - int vlen; - char addr[46]; - union { - unsigned char * as_uchar; - char * as_char; - } name; - - /* Parse the RR name. */ - status = ares_expand_name(aptr, abuf, alen, &name.as_char, &len); - if (status != ARES_SUCCESS) - return NULL; - aptr += len; - - /* Make sure there is enough data after the RR name for the fixed - * part of the RR. - */ - if (aptr + RRFIXEDSZ > abuf + alen) - { - ares_free_string(name.as_char); - return NULL; - } - - /* Parse the fixed part of the RR, and advance to the RR data - * field. */ - type = DNS_RR_TYPE(aptr); - dnsclass = DNS_RR_CLASS(aptr); - ttl = DNS_RR_TTL(aptr); - dlen = DNS_RR_LEN(aptr); - aptr += RRFIXEDSZ; - if (aptr + dlen > abuf + alen) - { - ares_free_string(name.as_char); - return NULL; - } - - /* Display the RR name, class, and type. */ - printf("\t%-15s.\t%d", name.as_char, ttl); - if (dnsclass != C_IN) - printf("\t%s", class_name(dnsclass)); - printf("\t%s", type_name(type)); - ares_free_string(name.as_char); - - /* Display the RR data. Don't touch aptr. */ - switch (type) - { - case T_CNAME: - case T_MB: - case T_MD: - case T_MF: - case T_MG: - case T_MR: - case T_NS: - case T_PTR: - /* For these types, the RR data is just a domain name. */ - status = ares_expand_name(aptr, abuf, alen, &name.as_char, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t%s.", name.as_char); - ares_free_string(name.as_char); - break; - - case T_HINFO: - /* The RR data is two length-counted character strings. */ - p = aptr; - len = *p; - if (p + len + 1 > aptr + dlen) - return NULL; - status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t%s", name.as_char); - ares_free_string(name.as_char); - p += len; - len = *p; - if (p + len + 1 > aptr + dlen) - return NULL; - status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t%s", name.as_char); - ares_free_string(name.as_char); - break; - - case T_MINFO: - /* The RR data is two domain names. */ - p = aptr; - status = ares_expand_name(p, abuf, alen, &name.as_char, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t%s.", name.as_char); - ares_free_string(name.as_char); - p += len; - status = ares_expand_name(p, abuf, alen, &name.as_char, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t%s.", name.as_char); - ares_free_string(name.as_char); - break; - - case T_MX: - /* The RR data is two bytes giving a preference ordering, and - * then a domain name. - */ - if (dlen < 2) - return NULL; - printf("\t%d", (int)DNS__16BIT(aptr)); - status = ares_expand_name(aptr + 2, abuf, alen, &name.as_char, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t%s.", name.as_char); - ares_free_string(name.as_char); - break; - - case T_SOA: - /* The RR data is two domain names and then five four-byte - * numbers giving the serial number and some timeouts. - */ - p = aptr; - status = ares_expand_name(p, abuf, alen, &name.as_char, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t%s.\n", name.as_char); - ares_free_string(name.as_char); - p += len; - status = ares_expand_name(p, abuf, alen, &name.as_char, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t\t\t\t\t\t%s.\n", name.as_char); - ares_free_string(name.as_char); - p += len; - if (p + 20 > aptr + dlen) - return NULL; - printf("\t\t\t\t\t\t( %u %u %u %u %u )", - DNS__32BIT(p), DNS__32BIT(p+4), - DNS__32BIT(p+8), DNS__32BIT(p+12), - DNS__32BIT(p+16)); - break; - - case T_TXT: - /* The RR data is one or more length-counted character - * strings. */ - p = aptr; - while (p < aptr + dlen) - { - len = *p; - if (p + len + 1 > aptr + dlen) - return NULL; - status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t%s", name.as_char); - ares_free_string(name.as_char); - p += len; - } - break; - - case T_CAA: - - p = aptr; - - /* Flags */ - printf(" %u", (int)*p); - p += 1; - - /* Remainder of record */ - vlen = (int)dlen - ((char)*p) - 2; - - /* The Property identifier, one of: - - "issue", - - "iodef", or - - "issuewild" */ - status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); - if (status != ARES_SUCCESS) - return NULL; - printf(" %s", name.as_char); - ares_free_string(name.as_char); - p += len; - - if (p + vlen > abuf + alen) - return NULL; - - /* A sequence of octets representing the Property Value */ - printf(" %.*s", vlen, p); - break; - - case T_A: - /* The RR data is a four-byte Internet address. */ - if (dlen != 4) - return NULL; - printf("\t%s", ares_inet_ntop(AF_INET,aptr,addr,sizeof(addr))); - break; - - case T_AAAA: - /* The RR data is a 16-byte IPv6 address. */ - if (dlen != 16) - return NULL; - printf("\t%s", ares_inet_ntop(AF_INET6,aptr,addr,sizeof(addr))); - break; - - case T_WKS: - /* Not implemented yet */ - break; - - case T_SRV: - /* The RR data is three two-byte numbers representing the - * priority, weight, and port, followed by a domain name. - */ - - printf("\t%d", (int)DNS__16BIT(aptr)); - printf(" %d", (int)DNS__16BIT(aptr + 2)); - printf(" %d", (int)DNS__16BIT(aptr + 4)); - - status = ares_expand_name(aptr + 6, abuf, alen, &name.as_char, &len); - if (status != ARES_SUCCESS) - return NULL; - printf("\t%s.", name.as_char); - ares_free_string(name.as_char); - break; - - case T_URI: - /* The RR data is two two-byte numbers representing the - * priority and weight, followed by a target. - */ - - printf("\t%d ", (int)DNS__16BIT(aptr)); - printf("%d \t\t", (int)DNS__16BIT(aptr+2)); - p = aptr +4; - for (i=0; i "d.c.b.a".in-addr.arpa" for an IPv4 address. - * "a.b.c....x.y.z" -> "z.y.x....c.d.e.IP6.ARPA" for an IPv6 address. - * - * An example from 'dig -x PTR 2001:470:1:1b9::31': - * - * QUESTION SECTION: - * 1.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.b.1.0.1.0.0.0.0.7.4.0.1.0.0.2.IP6.ARPA. IN PTR - * - * ANSWER SECTION: - * 1.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.b.1.0.1.0.0.0.0.7.4.0.1.0.0.2.IP6.ARPA. 254148 IN PTR ipv6.cybernode.com. - * - * If 'use_bitstring == 1', try to use the more compact RFC-2673 bitstring format. - * Thus the above 'dig' query should become: - * [x13000000000000009b10100007401002].IP6.ARPA. IN PTR - */ -static int convert_query (char **name_p, int use_bitstring) -{ -#ifndef MAX_IP6_RR -#define MAX_IP6_RR (16*sizeof(".x.x") + sizeof(".IP6.ARPA") + 1) -#endif - -#ifdef HAVE_INET_PTON - #define ACCEPTED_RETVAL4 1 - #define ACCEPTED_RETVAL6 1 -#else - #define ACCEPTED_RETVAL4 32 - #define ACCEPTED_RETVAL6 128 -#endif - - static char new_name [MAX_IP6_RR]; - static const char hex_chars[] = "0123456789ABCDEF"; - - union { - struct in_addr addr4; - struct ares_in6_addr addr6; - } addr; - - if (ares_inet_pton (AF_INET, *name_p, &addr.addr4) == 1) - { - unsigned long laddr = ntohl(addr.addr4.s_addr); - unsigned long a1 = (laddr >> 24UL) & 0xFFUL; - unsigned long a2 = (laddr >> 16UL) & 0xFFUL; - unsigned long a3 = (laddr >> 8UL) & 0xFFUL; - unsigned long a4 = laddr & 0xFFUL; - - snprintf(new_name, sizeof(new_name), "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1); - *name_p = new_name; - return (1); - } - - if (ares_inet_pton(AF_INET6, *name_p, &addr.addr6) == 1) - { - char *c = new_name; - const unsigned char *ip = (const unsigned char*) &addr.addr6; - int max_i = (int)sizeof(addr.addr6) - 1; - int i, hi, lo; - - /* Use the more compact RFC-2673 notation? - * Currently doesn't work or unsupported by the DNS-servers I've tested against. - */ - if (use_bitstring) - { - *c++ = '\\'; - *c++ = '['; - *c++ = 'x'; - for (i = max_i; i >= 0; i--) - { - hi = ip[i] >> 4; - lo = ip[i] & 15; - *c++ = hex_chars [lo]; - *c++ = hex_chars [hi]; - } - strcpy (c, "].IP6.ARPA"); - } - else - { - for (i = max_i; i >= 0; i--) - { - hi = ip[i] >> 4; - lo = ip[i] & 15; - *c++ = hex_chars [lo]; - *c++ = '.'; - *c++ = hex_chars [hi]; - *c++ = '.'; - } - strcpy (c, "IP6.ARPA"); - } - *name_p = new_name; - return (1); - } - printf("Address %s was not legal for this query.\n", *name_p); - return (0); -} - -static const char *type_name(int type) -{ - int i; - - for (i = 0; i < ntypes; i++) - { - if (types[i].value == type) - return types[i].name; - } - return "(unknown)"; -} - -static const char *class_name(int dnsclass) -{ - int i; - - for (i = 0; i < nclasses; i++) - { - if (classes[i].value == dnsclass) - return classes[i].name; - } - return "(unknown)"; -} - -static void usage(void) -{ - fprintf(stderr, "usage: adig [-h] [-d] [-f flag] [-s server] [-c class] " - "[-t type] [-T|U port] [-x|-xx] name ...\n"); - exit(1); -} - -static void destroy_addr_list(struct ares_addr_node *head) -{ - while(head) - { - struct ares_addr_node *detached = head; - head = head->next; - free(detached); - } -} - -static void append_addr_list(struct ares_addr_node **head, - struct ares_addr_node *node) -{ - struct ares_addr_node *last; - node->next = NULL; - if(*head) - { - last = *head; - while(last->next) - last = last->next; - last->next = node; - } - else - *head = node; -} - - -/* Information from the man page. Formatting taken from man -h */ -static void print_help_info_adig(void) { - printf("adig, version %s\n\n", ARES_VERSION_STR); - printf("usage: adig [-h] [-d] [-f flag] [[-s server] ...] [-T|U port] [-c class] [-t type] [-x|-xx] name ...\n\n" - " h : Display this help and exit.\n" - " d : Print some extra debugging output.\n\n" - " f flag : Add a behavior control flag. Possible values are\n" - " igntc - ignore to query in TCP to get truncated UDP answer,\n" - " noaliases - don't honor the HOSTALIASES environment variable,\n" - " norecurse - don't query upstream servers recursively,\n" - " primary - use the first server,\n" - " stayopen - don't close the communication sockets, and\n" - " usevc - use TCP only.\n" - " s server : Connect to the specified DNS server, instead of the system's default one(s).\n" - " Servers are tried in round-robin, if the previous one failed.\n" - " T port : Connect to the specified TCP port of DNS server.\n" - " U port : Connect to the specified UDP port of DNS server.\n" - " c class : Set the query class. Possible values for class are ANY, CHAOS, HS and IN (default)\n" - " t type : Query records of the specified type.\n" - " Possible values for type are A (default), AAAA, AFSDB, ANY, AXFR,\n" - " CNAME, GPOS, HINFO, ISDN, KEY, LOC, MAILA, MAILB, MB, MD, MF, MG,\n" - " MINFO, MR, MX, NAPTR, NS, NSAP, NSAP_PTR, NULL, PTR, PX, RP, RT,\n" - " SIG, SOA, SRV, TXT, URI, WKS and X25.\n\n" - " -x : For a '-t PTR a.b.c.d' lookup, query for 'd.c.b.a.in-addr.arpa.'\n" - " -xx : As above, but for IPv6, compact the format into a bitstring like\n" - " '[xabcdef00000000000000000000000000].IP6.ARPA.'\n"); - exit(0); -} diff --git a/lib/c-ares-1.19.1/src/tools/ahost.c b/lib/c-ares-1.19.1/src/tools/ahost.c deleted file mode 100644 index 8ac2106698b..00000000000 --- a/lib/c-ares-1.19.1/src/tools/ahost.c +++ /dev/null @@ -1,228 +0,0 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#if !defined(WIN32) || defined(WATT32) -#include -#include -#include -#endif - -#ifdef HAVE_STRINGS_H -#include -#endif - -#include "ares.h" -#include "ares_dns.h" -#include "ares_getopt.h" -#include "ares_ipv6.h" -#include "ares_nowarn.h" - -#ifndef HAVE_STRDUP -# include "ares_strdup.h" -# define strdup(ptr) ares_strdup(ptr) -#endif - -#ifndef HAVE_STRCASECMP -# include "ares_strcasecmp.h" -# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2) -#endif - -#ifndef HAVE_STRNCASECMP -# include "ares_strcasecmp.h" -# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n) -#endif - -static void callback(void *arg, int status, int timeouts, struct hostent *host); -static void usage(void); -static void print_help_info_ahost(void); - -int main(int argc, char **argv) -{ - struct ares_options options; - int optmask = 0; - ares_channel channel; - int status, nfds, c, addr_family = AF_INET; - fd_set read_fds, write_fds; - struct timeval *tvp, tv; - struct in_addr addr4; - struct ares_in6_addr addr6; - -#ifdef USE_WINSOCK - WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK); - WSADATA wsaData; - WSAStartup(wVersionRequested, &wsaData); -#endif - - memset(&options, 0, sizeof(options)); - - status = ares_library_init(ARES_LIB_INIT_ALL); - if (status != ARES_SUCCESS) - { - fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status)); - return 1; - } - - while ((c = ares_getopt(argc,argv,"dt:h?s:")) != -1) - { - switch (c) - { - case 'd': -#ifdef WATT32 - dbug_init(); -#endif - break; - case 's': - optmask |= ARES_OPT_DOMAINS; - options.ndomains++; - options.domains = (char **)realloc(options.domains, - options.ndomains * sizeof(char *)); - options.domains[options.ndomains - 1] = strdup(optarg); - break; - case 't': - if (!strcasecmp(optarg,"a")) - addr_family = AF_INET; - else if (!strcasecmp(optarg,"aaaa")) - addr_family = AF_INET6; - else if (!strcasecmp(optarg,"u")) - addr_family = AF_UNSPEC; - else - usage(); - break; - case 'h': - print_help_info_ahost(); - break; - case '?': - print_help_info_ahost(); - break; - default: - usage(); - break; - } - } - - argc -= optind; - argv += optind; - if (argc < 1) - usage(); - - status = ares_init_options(&channel, &options, optmask); - if (status != ARES_SUCCESS) - { - fprintf(stderr, "ares_init: %s\n", ares_strerror(status)); - return 1; - } - - /* Initiate the queries, one per command-line argument. */ - for ( ; *argv; argv++) - { - if (ares_inet_pton(AF_INET, *argv, &addr4) == 1) - { - ares_gethostbyaddr(channel, &addr4, sizeof(addr4), AF_INET, callback, - *argv); - } - else if (ares_inet_pton(AF_INET6, *argv, &addr6) == 1) - { - ares_gethostbyaddr(channel, &addr6, sizeof(addr6), AF_INET6, callback, - *argv); - } - else - { - ares_gethostbyname(channel, *argv, addr_family, callback, *argv); - } - } - - /* Wait for all queries to complete. */ - for (;;) - { - int res; - FD_ZERO(&read_fds); - FD_ZERO(&write_fds); - nfds = ares_fds(channel, &read_fds, &write_fds); - if (nfds == 0) - break; - tvp = ares_timeout(channel, NULL, &tv); - res = select(nfds, &read_fds, &write_fds, NULL, tvp); - if (-1 == res) - break; - ares_process(channel, &read_fds, &write_fds); - } - - ares_destroy(channel); - - ares_library_cleanup(); - -#ifdef USE_WINSOCK - WSACleanup(); -#endif - - return 0; -} - -static void callback(void *arg, int status, int timeouts, struct hostent *host) -{ - char **p; - - (void)timeouts; - - if (status != ARES_SUCCESS) - { - fprintf(stderr, "%s: %s\n", (char *) arg, ares_strerror(status)); - return; - } - - for (p = host->h_addr_list; *p; p++) - { - char addr_buf[46] = "??"; - - ares_inet_ntop(host->h_addrtype, *p, addr_buf, sizeof(addr_buf)); - printf("%-32s\t%s", host->h_name, addr_buf); -#if 0 - if (host->h_aliases[0]) - { - int i; - - printf (", Aliases: "); - for (i = 0; host->h_aliases[i]; i++) - printf("%s ", host->h_aliases[i]); - } -#endif - puts(""); - } -} - -static void usage(void) -{ - fprintf(stderr, "usage: ahost [-h] [-d] [-s {domain}] [-t {a|aaaa|u}] {host|addr} ...\n"); - exit(1); -} - -/* Information from the man page. Formatting taken from man -h */ -static void print_help_info_ahost(void) { - printf("ahost, version %s\n\n", ARES_VERSION_STR); - printf("usage: ahost [-h] [-d] [[-s domain] ...] [-t a|aaaa|u] host|addr ...\n\n" - " h : Display this help and exit.\n" - " d : Print some extra debugging output.\n\n" - " s domain : Specify the domain to search instead of using the default values\n" - " from /etc/resolv.conf. This option only has an effect on\n" - " platforms that use /etc/resolv.conf for DNS configuration;\n" - " it has no effect on other platforms (such as Win32 or Android).\n\n" - " t type : If type is \"a\", print the A record (default).\n" - " If type is \"aaaa\", print the AAAA record.\n" - " If type is \"u\", look for either AAAA or A record (in that order).\n\n"); - exit(0); -} diff --git a/lib/c-ares-1.19.1/src/tools/ares_getopt.c b/lib/c-ares-1.19.1/src/tools/ares_getopt.c deleted file mode 100644 index 1e02d086866..00000000000 --- a/lib/c-ares-1.19.1/src/tools/ares_getopt.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Original file name getopt.c Initial import into the c-ares source tree - * on 2007-04-11. Lifted from version 5.2 of the 'Open Mash' project with - * the modified BSD license, BSD license without the advertising clause. - * - */ - -/* - * getopt.c -- - * - * Standard UNIX getopt function. Code is from BSD. - * - * Copyright (c) 1987-2001 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * A. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * B. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * C. Neither the names of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS - * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* #if !defined(lint) - * static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94"; - * #endif - */ - -#include -#include -#include -#include "ares_getopt.h" - -int opterr = 1, /* if error message should be printed */ - optind = 1; /* index into parent argv vector */ -int optopt = 0; /* character checked for validity */ -static int optreset; /* reset getopt */ -char *optarg; /* argument associated with option */ - -#define BADCH (int)'?' -#define BADARG (int)':' -#define EMSG (char *)"" - -/* - * ares_getopt -- - * Parse argc/argv argument vector. - */ -int -ares_getopt(int nargc, char * const nargv[], const char *ostr) -{ - static char *place = EMSG; /* option letter processing */ - char *oli; /* option letter list index */ - - if (optreset || !*place) { /* update scanning pointer */ - optreset = 0; - if (optind >= nargc || *(place = nargv[optind]) != '-') { - place = EMSG; - return (EOF); - } - if (place[1] && *++place == '-') { /* found "--" */ - ++optind; - place = EMSG; - return (EOF); - } - } /* option letter okay? */ - if ((optopt = (int)*place++) == (int)':' || - (oli = strchr(ostr, optopt)) == NULL) { - /* - * if the user didn't specify '-' as an option, - * assume it means EOF. - */ - if (optopt == (int)'-') - return (EOF); - if (!*place) - ++optind; - if (opterr && *ostr != ':') - (void)fprintf(stderr, - "%s: illegal option -- %c\n", __FILE__, optopt); - return (BADCH); - } - if (*++oli != ':') { /* don't need argument */ - optarg = NULL; - if (!*place) - ++optind; - } - else { /* need an argument */ - if (*place) /* no white space */ - optarg = place; - else if (nargc <= ++optind) { /* no arg */ - place = EMSG; - if (*ostr == ':') - return (BADARG); - if (opterr) - (void)fprintf(stderr, - "%s: option requires an argument -- %c\n", - __FILE__, optopt); - return (BADCH); - } - else /* white space */ - optarg = nargv[optind]; - place = EMSG; - ++optind; - } - return (optopt); /* dump back option letter */ -} diff --git a/lib/c-ares-1.19.1/test/Makefile.am b/lib/c-ares-1.19.1/test/Makefile.am deleted file mode 100644 index 504e65e468a..00000000000 --- a/lib/c-ares-1.19.1/test/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -ARES_BLD_DIR = $(top_builddir)/.. -ARES_SRC_DIR = $(top_srcdir)/.. - -AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6 -ACLOCAL_AMFLAGS = -I ../m4 --install - -# Note use of -isystem to force use of local gMock/gTest even if there's an installed version. -CPPFLAGS += -I$(ARES_BLD_DIR)/include \ - -I$(ARES_BLD_DIR)/src/lib \ - -I$(ARES_SRC_DIR)/include \ - -I$(ARES_SRC_DIR)/src/lib \ - -I$(top_builddir) \ - -isystem $(srcdir)/gmock-1.11.0 -CXXFLAGS += -Wall $(PTHREAD_CFLAGS) - -# Makefile.inc provides the various *SOURCES and *HEADERS defines -include Makefile.inc - -TESTS = arestest fuzzcheck.sh - -noinst_LTLIBRARIES = libgmock.la - -libgmock_la_SOURCES = \ - gmock-1.11.0/gmock-gtest-all.cc \ - gmock-1.11.0/gmock/gmock.h \ - gmock-1.11.0/gtest/gtest.h - -libgmock_la_CPPFLAGS = -isystem $(srcdir)/gmock-1.11.0 - - -noinst_PROGRAMS = arestest aresfuzz aresfuzzname dnsdump -EXTRA_DIST = fuzzcheck.sh CMakeLists.txt Makefile.m32 Makefile.msvc README.md buildconf $(srcdir)/fuzzinput/* $(srcdir)/fuzznames/* -arestest_SOURCES = $(TESTSOURCES) $(TESTHEADERS) - -# Not interested in coverage of test code, but linking the test binary needs the coverage option -arestest_LDADD = libgmock.la $(ARES_BLD_DIR)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) - -include $(top_srcdir)/aminclude_static.am - -aresfuzz_SOURCES = $(FUZZSOURCES) -aresfuzz_LDADD = $(ARES_BLD_DIR)/src/lib/libcares.la $(CODE_COVERAGE_LIBS) - -aresfuzzname_SOURCES = $(FUZZNAMESOURCES) -aresfuzzname_LDADD = $(ARES_BLD_DIR)/src/lib/libcares.la $(CODE_COVERAGE_LIBS) - -dnsdump_SOURCES = $(DUMPSOURCES) -dnsdump_LDADD = $(ARES_BLD_DIR)/src/lib/libcares.la $(CODE_COVERAGE_LIBS) - -test: check diff --git a/lib/c-ares-1.19.1/test/Makefile.in b/lib/c-ares-1.19.1/test/Makefile.in deleted file mode 100644 index b4c9d24faba..00000000000 --- a/lib/c-ares-1.19.1/test/Makefile.in +++ /dev/null @@ -1,1636 +0,0 @@ -# Makefile.in generated by automake 1.16.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2021 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# aminclude_static.am generated automatically by Autoconf -# from AX_AM_MACROS_STATIC on Mon May 22 13:36:05 CEST 2023 - - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -TESTS = arestest$(EXEEXT) fuzzcheck.sh -noinst_PROGRAMS = arestest$(EXEEXT) aresfuzz$(EXEEXT) \ - aresfuzzname$(EXEEXT) dnsdump$(EXEEXT) -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../m4/ax_ac_append_to_file.m4 \ - $(top_srcdir)/../m4/ax_ac_print_to_file.m4 \ - $(top_srcdir)/../m4/ax_add_am_macro_static.m4 \ - $(top_srcdir)/../m4/ax_am_macros_static.m4 \ - $(top_srcdir)/../m4/ax_check_gnu_make.m4 \ - $(top_srcdir)/../m4/ax_check_user_namespace.m4 \ - $(top_srcdir)/../m4/ax_check_uts_namespace.m4 \ - $(top_srcdir)/../m4/ax_code_coverage.m4 \ - $(top_srcdir)/../m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/../m4/ax_cxx_compile_stdcxx_11.m4 \ - $(top_srcdir)/../m4/ax_file_escapes.m4 \ - $(top_srcdir)/../m4/ax_pthread.m4 \ - $(top_srcdir)/../m4/ax_require_defined.m4 \ - $(top_srcdir)/../m4/libtool.m4 \ - $(top_srcdir)/../m4/ltoptions.m4 \ - $(top_srcdir)/../m4/ltsugar.m4 \ - $(top_srcdir)/../m4/ltversion.m4 \ - $(top_srcdir)/../m4/lt~obsolete.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(am__DIST_COMMON) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -PROGRAMS = $(noinst_PROGRAMS) -LTLIBRARIES = $(noinst_LTLIBRARIES) -libgmock_la_LIBADD = -am__dirstamp = $(am__leading_dot)dirstamp -am_libgmock_la_OBJECTS = gmock-1.11.0/libgmock_la-gmock-gtest-all.lo -libgmock_la_OBJECTS = $(am_libgmock_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -am__objects_1 = ares-test-fuzz.$(OBJEXT) ares-fuzz.$(OBJEXT) -am_aresfuzz_OBJECTS = $(am__objects_1) -aresfuzz_OBJECTS = $(am_aresfuzz_OBJECTS) -am__DEPENDENCIES_1 = -aresfuzz_DEPENDENCIES = $(ARES_BLD_DIR)/src/lib/libcares.la \ - $(am__DEPENDENCIES_1) -am__objects_2 = ares-test-fuzz-name.$(OBJEXT) ares-fuzz.$(OBJEXT) -am_aresfuzzname_OBJECTS = $(am__objects_2) -aresfuzzname_OBJECTS = $(am_aresfuzzname_OBJECTS) -aresfuzzname_DEPENDENCIES = $(ARES_BLD_DIR)/src/lib/libcares.la \ - $(am__DEPENDENCIES_1) -am__objects_3 = ares-test-main.$(OBJEXT) ares-test-init.$(OBJEXT) \ - ares-test.$(OBJEXT) ares-test-ns.$(OBJEXT) \ - ares-test-parse.$(OBJEXT) ares-test-parse-a.$(OBJEXT) \ - ares-test-parse-aaaa.$(OBJEXT) ares-test-parse-caa.$(OBJEXT) \ - ares-test-parse-mx.$(OBJEXT) ares-test-parse-naptr.$(OBJEXT) \ - ares-test-parse-ns.$(OBJEXT) ares-test-parse-ptr.$(OBJEXT) \ - ares-test-parse-soa.$(OBJEXT) \ - ares-test-parse-soa-any.$(OBJEXT) \ - ares-test-parse-srv.$(OBJEXT) ares-test-parse-txt.$(OBJEXT) \ - ares-test-parse-uri.$(OBJEXT) ares-test-misc.$(OBJEXT) \ - ares-test-live.$(OBJEXT) ares-test-mock.$(OBJEXT) \ - ares-test-mock-ai.$(OBJEXT) ares-test-internal.$(OBJEXT) \ - dns-proto.$(OBJEXT) dns-proto-test.$(OBJEXT) -am__objects_4 = -am_arestest_OBJECTS = $(am__objects_3) $(am__objects_4) -arestest_OBJECTS = $(am_arestest_OBJECTS) -arestest_DEPENDENCIES = libgmock.la \ - $(ARES_BLD_DIR)/src/lib/libcares.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -am__objects_5 = dns-proto.$(OBJEXT) dns-dump.$(OBJEXT) -am_dnsdump_OBJECTS = $(am__objects_5) -dnsdump_OBJECTS = $(am_dnsdump_OBJECTS) -dnsdump_DEPENDENCIES = $(ARES_BLD_DIR)/src/lib/libcares.la \ - $(am__DEPENDENCIES_1) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/ares-fuzz.Po \ - ./$(DEPDIR)/ares-test-fuzz-name.Po \ - ./$(DEPDIR)/ares-test-fuzz.Po ./$(DEPDIR)/ares-test-init.Po \ - ./$(DEPDIR)/ares-test-internal.Po \ - ./$(DEPDIR)/ares-test-live.Po ./$(DEPDIR)/ares-test-main.Po \ - ./$(DEPDIR)/ares-test-misc.Po ./$(DEPDIR)/ares-test-mock-ai.Po \ - ./$(DEPDIR)/ares-test-mock.Po ./$(DEPDIR)/ares-test-ns.Po \ - ./$(DEPDIR)/ares-test-parse-a.Po \ - ./$(DEPDIR)/ares-test-parse-aaaa.Po \ - ./$(DEPDIR)/ares-test-parse-caa.Po \ - ./$(DEPDIR)/ares-test-parse-mx.Po \ - ./$(DEPDIR)/ares-test-parse-naptr.Po \ - ./$(DEPDIR)/ares-test-parse-ns.Po \ - ./$(DEPDIR)/ares-test-parse-ptr.Po \ - ./$(DEPDIR)/ares-test-parse-soa-any.Po \ - ./$(DEPDIR)/ares-test-parse-soa.Po \ - ./$(DEPDIR)/ares-test-parse-srv.Po \ - ./$(DEPDIR)/ares-test-parse-txt.Po \ - ./$(DEPDIR)/ares-test-parse-uri.Po \ - ./$(DEPDIR)/ares-test-parse.Po ./$(DEPDIR)/ares-test.Po \ - ./$(DEPDIR)/dns-dump.Po ./$(DEPDIR)/dns-proto-test.Po \ - ./$(DEPDIR)/dns-proto.Po \ - gmock-1.11.0/$(DEPDIR)/libgmock_la-gmock-gtest-all.Plo -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(libgmock_la_SOURCES) $(aresfuzz_SOURCES) \ - $(aresfuzzname_SOURCES) $(arestest_SOURCES) $(dnsdump_SOURCES) -DIST_SOURCES = $(libgmock_la_SOURCES) $(aresfuzz_SOURCES) \ - $(aresfuzzname_SOURCES) $(arestest_SOURCES) $(dnsdump_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ - config.h.in -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -AM_RECURSIVE_TARGETS = cscope check recheck -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red=''; \ - grn=''; \ - lgn=''; \ - blu=''; \ - mgn=''; \ - brg=''; \ - std=''; \ - fi; \ -} -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' -RECHECK_LOGS = $(TEST_LOGS) -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \ - $(srcdir)/config.h.in $(top_srcdir)/aminclude_static.am \ - README.md compile config.guess config.sub depcomp install-sh \ - ltmain.sh missing test-driver -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__post_remove_distdir = $(am__remove_distdir) -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -DIST_TARGETS = dist-gzip -# Exists only to be overridden by the user if desired. -AM_DISTCHECK_DVI_TARGET = dvi -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ -CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ -CPP = @CPP@ - -# Note use of -isystem to force use of local gMock/gTest even if there's an installed version. -CPPFLAGS = @CPPFLAGS@ -I$(ARES_BLD_DIR)/include \ - -I$(ARES_BLD_DIR)/src/lib -I$(ARES_SRC_DIR)/include \ - -I$(ARES_SRC_DIR)/src/lib -I$(top_builddir) -isystem \ - $(srcdir)/gmock-1.11.0 -CSCOPE = @CSCOPE@ -CTAGS = @CTAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -Wall $(PTHREAD_CFLAGS) -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ETAGS = @ETAGS@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -FILECMD = @FILECMD@ -GCOV = @GCOV@ -GENHTML = @GENHTML@ -GREP = @GREP@ -HAVE_CXX11 = @HAVE_CXX11@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_CXX = @PTHREAD_CXX@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -ifGNUmake = @ifGNUmake@ -ifnGNUmake = @ifnGNUmake@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -ARES_BLD_DIR = $(top_builddir)/.. -ARES_SRC_DIR = $(top_srcdir)/.. -AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6 -ACLOCAL_AMFLAGS = -I ../m4 --install -TESTSOURCES = ares-test-main.cc \ - ares-test-init.cc \ - ares-test.cc \ - ares-test-ns.cc \ - ares-test-parse.cc \ - ares-test-parse-a.cc \ - ares-test-parse-aaaa.cc \ - ares-test-parse-caa.cc \ - ares-test-parse-mx.cc \ - ares-test-parse-naptr.cc \ - ares-test-parse-ns.cc \ - ares-test-parse-ptr.cc \ - ares-test-parse-soa.cc \ - ares-test-parse-soa-any.cc \ - ares-test-parse-srv.cc \ - ares-test-parse-txt.cc \ - ares-test-parse-uri.cc \ - ares-test-misc.cc \ - ares-test-live.cc \ - ares-test-mock.cc \ - ares-test-mock-ai.cc \ - ares-test-internal.cc \ - dns-proto.cc \ - dns-proto-test.cc - -TESTHEADERS = ares-test.h \ - dns-proto.h \ - ares-test-ai.h - -FUZZSOURCES = ares-test-fuzz.c \ - ares-fuzz.c - -FUZZNAMESOURCES = ares-test-fuzz-name.c \ - ares-fuzz.c - -DUMPSOURCES = dns-proto.cc \ - dns-dump.cc - -noinst_LTLIBRARIES = libgmock.la -libgmock_la_SOURCES = \ - gmock-1.11.0/gmock-gtest-all.cc \ - gmock-1.11.0/gmock/gmock.h \ - gmock-1.11.0/gtest/gtest.h - -libgmock_la_CPPFLAGS = -isystem $(srcdir)/gmock-1.11.0 -EXTRA_DIST = fuzzcheck.sh CMakeLists.txt Makefile.m32 Makefile.msvc README.md buildconf $(srcdir)/fuzzinput/* $(srcdir)/fuzznames/* -arestest_SOURCES = $(TESTSOURCES) $(TESTHEADERS) - -# Not interested in coverage of test code, but linking the test binary needs the coverage option -arestest_LDADD = libgmock.la $(ARES_BLD_DIR)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) -@CODE_COVERAGE_ENABLED_TRUE@GITIGNOREFILES := $(GITIGNOREFILES) $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE); -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN); -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)"; -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_quiet = $(code_coverage_quiet_$(V)) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_quiet_0 = --quiet - -# sanitizes the test-name: replaces with underscores: dashes and dots -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) -@CODE_COVERAGE_ENABLED_TRUE@AM_DISTCHECK_CONFIGURE_FLAGS := $(AM_DISTCHECK_CONFIGURE_FLAGS) --disable-code-coverage -aresfuzz_SOURCES = $(FUZZSOURCES) -aresfuzz_LDADD = $(ARES_BLD_DIR)/src/lib/libcares.la $(CODE_COVERAGE_LIBS) -aresfuzzname_SOURCES = $(FUZZNAMESOURCES) -aresfuzzname_LDADD = $(ARES_BLD_DIR)/src/lib/libcares.la $(CODE_COVERAGE_LIBS) -dnsdump_SOURCES = $(DUMPSOURCES) -dnsdump_LDADD = $(ARES_BLD_DIR)/src/lib/libcares.la $(CODE_COVERAGE_LIBS) -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .cc .lo .log .o .obj .test .test$(EXEEXT) .trs -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(top_srcdir)/aminclude_static.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ - esac; -$(srcdir)/Makefile.inc $(top_srcdir)/aminclude_static.am $(am__empty): - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): - -config.h: stamp-h1 - @test -f $@ || rm -f stamp-h1 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } -gmock-1.11.0/$(am__dirstamp): - @$(MKDIR_P) gmock-1.11.0 - @: > gmock-1.11.0/$(am__dirstamp) -gmock-1.11.0/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) gmock-1.11.0/$(DEPDIR) - @: > gmock-1.11.0/$(DEPDIR)/$(am__dirstamp) -gmock-1.11.0/libgmock_la-gmock-gtest-all.lo: \ - gmock-1.11.0/$(am__dirstamp) \ - gmock-1.11.0/$(DEPDIR)/$(am__dirstamp) - -libgmock.la: $(libgmock_la_OBJECTS) $(libgmock_la_DEPENDENCIES) $(EXTRA_libgmock_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(libgmock_la_OBJECTS) $(libgmock_la_LIBADD) $(LIBS) - -aresfuzz$(EXEEXT): $(aresfuzz_OBJECTS) $(aresfuzz_DEPENDENCIES) $(EXTRA_aresfuzz_DEPENDENCIES) - @rm -f aresfuzz$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(aresfuzz_OBJECTS) $(aresfuzz_LDADD) $(LIBS) - -aresfuzzname$(EXEEXT): $(aresfuzzname_OBJECTS) $(aresfuzzname_DEPENDENCIES) $(EXTRA_aresfuzzname_DEPENDENCIES) - @rm -f aresfuzzname$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(aresfuzzname_OBJECTS) $(aresfuzzname_LDADD) $(LIBS) - -arestest$(EXEEXT): $(arestest_OBJECTS) $(arestest_DEPENDENCIES) $(EXTRA_arestest_DEPENDENCIES) - @rm -f arestest$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(arestest_OBJECTS) $(arestest_LDADD) $(LIBS) - -dnsdump$(EXEEXT): $(dnsdump_OBJECTS) $(dnsdump_DEPENDENCIES) $(EXTRA_dnsdump_DEPENDENCIES) - @rm -f dnsdump$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(dnsdump_OBJECTS) $(dnsdump_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f gmock-1.11.0/*.$(OBJEXT) - -rm -f gmock-1.11.0/*.lo - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-fuzz.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-fuzz-name.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-fuzz.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-init.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-internal.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-live.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-main.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-misc.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-mock-ai.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-mock.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-ns.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-a.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-aaaa.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-caa.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-mx.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-naptr.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-ns.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-ptr.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-soa-any.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-soa.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-srv.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-txt.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse-uri.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test-parse.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ares-test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dns-dump.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dns-proto-test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dns-proto.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@gmock-1.11.0/$(DEPDIR)/libgmock_la-gmock-gtest-all.Plo@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -.cc.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cc.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -gmock-1.11.0/libgmock_la-gmock-gtest-all.lo: gmock-1.11.0/gmock-gtest-all.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgmock_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gmock-1.11.0/libgmock_la-gmock-gtest-all.lo -MD -MP -MF gmock-1.11.0/$(DEPDIR)/libgmock_la-gmock-gtest-all.Tpo -c -o gmock-1.11.0/libgmock_la-gmock-gtest-all.lo `test -f 'gmock-1.11.0/gmock-gtest-all.cc' || echo '$(srcdir)/'`gmock-1.11.0/gmock-gtest-all.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) gmock-1.11.0/$(DEPDIR)/libgmock_la-gmock-gtest-all.Tpo gmock-1.11.0/$(DEPDIR)/libgmock_la-gmock-gtest-all.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='gmock-1.11.0/gmock-gtest-all.cc' object='gmock-1.11.0/libgmock_la-gmock-gtest-all.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgmock_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gmock-1.11.0/libgmock_la-gmock-gtest-all.lo `test -f 'gmock-1.11.0/gmock-gtest-all.cc' || echo '$(srcdir)/'`gmock-1.11.0/gmock-gtest-all.cc - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -rm -rf gmock-1.11.0/.libs gmock-1.11.0/_libs - -distclean-libtool: - -rm -f libtool config.lt - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscope: cscope.files - test ! -s cscope.files \ - || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) -clean-cscope: - -rm -f cscope.files -cscope.files: clean-cscope cscopelist -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - elif test -n "$$redo_logs"; then \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ - done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ - else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ - fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ - else \ - color_start= color_end=; \ - fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -arestest.log: arestest$(EXEEXT) - @p='arestest$(EXEEXT)'; \ - b='arestest'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -fuzzcheck.sh.log: fuzzcheck.sh - @p='fuzzcheck.sh'; \ - b='fuzzcheck.sh'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz - $(am__post_remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__post_remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__post_remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__post_remove_distdir) - -dist-zstd: distdir - tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst - $(am__post_remove_distdir) - -dist-tarZ: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__post_remove_distdir) - -dist-shar: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz - $(am__post_remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__post_remove_distdir) - -dist dist-all: - $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' - $(am__post_remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - *.tar.zst*) \ - zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ - esac - chmod -R a-w $(distdir) - chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build/sub \ - && ../../configure \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=../.. --prefix="$$dc_install_base" \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__post_remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) config.h -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -rm -f gmock-1.11.0/$(DEPDIR)/$(am__dirstamp) - -rm -f gmock-1.11.0/$(am__dirstamp) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f ./$(DEPDIR)/ares-fuzz.Po - -rm -f ./$(DEPDIR)/ares-test-fuzz-name.Po - -rm -f ./$(DEPDIR)/ares-test-fuzz.Po - -rm -f ./$(DEPDIR)/ares-test-init.Po - -rm -f ./$(DEPDIR)/ares-test-internal.Po - -rm -f ./$(DEPDIR)/ares-test-live.Po - -rm -f ./$(DEPDIR)/ares-test-main.Po - -rm -f ./$(DEPDIR)/ares-test-misc.Po - -rm -f ./$(DEPDIR)/ares-test-mock-ai.Po - -rm -f ./$(DEPDIR)/ares-test-mock.Po - -rm -f ./$(DEPDIR)/ares-test-ns.Po - -rm -f ./$(DEPDIR)/ares-test-parse-a.Po - -rm -f ./$(DEPDIR)/ares-test-parse-aaaa.Po - -rm -f ./$(DEPDIR)/ares-test-parse-caa.Po - -rm -f ./$(DEPDIR)/ares-test-parse-mx.Po - -rm -f ./$(DEPDIR)/ares-test-parse-naptr.Po - -rm -f ./$(DEPDIR)/ares-test-parse-ns.Po - -rm -f ./$(DEPDIR)/ares-test-parse-ptr.Po - -rm -f ./$(DEPDIR)/ares-test-parse-soa-any.Po - -rm -f ./$(DEPDIR)/ares-test-parse-soa.Po - -rm -f ./$(DEPDIR)/ares-test-parse-srv.Po - -rm -f ./$(DEPDIR)/ares-test-parse-txt.Po - -rm -f ./$(DEPDIR)/ares-test-parse-uri.Po - -rm -f ./$(DEPDIR)/ares-test-parse.Po - -rm -f ./$(DEPDIR)/ares-test.Po - -rm -f ./$(DEPDIR)/dns-dump.Po - -rm -f ./$(DEPDIR)/dns-proto-test.Po - -rm -f ./$(DEPDIR)/dns-proto.Po - -rm -f gmock-1.11.0/$(DEPDIR)/libgmock_la-gmock-gtest-all.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f ./$(DEPDIR)/ares-fuzz.Po - -rm -f ./$(DEPDIR)/ares-test-fuzz-name.Po - -rm -f ./$(DEPDIR)/ares-test-fuzz.Po - -rm -f ./$(DEPDIR)/ares-test-init.Po - -rm -f ./$(DEPDIR)/ares-test-internal.Po - -rm -f ./$(DEPDIR)/ares-test-live.Po - -rm -f ./$(DEPDIR)/ares-test-main.Po - -rm -f ./$(DEPDIR)/ares-test-misc.Po - -rm -f ./$(DEPDIR)/ares-test-mock-ai.Po - -rm -f ./$(DEPDIR)/ares-test-mock.Po - -rm -f ./$(DEPDIR)/ares-test-ns.Po - -rm -f ./$(DEPDIR)/ares-test-parse-a.Po - -rm -f ./$(DEPDIR)/ares-test-parse-aaaa.Po - -rm -f ./$(DEPDIR)/ares-test-parse-caa.Po - -rm -f ./$(DEPDIR)/ares-test-parse-mx.Po - -rm -f ./$(DEPDIR)/ares-test-parse-naptr.Po - -rm -f ./$(DEPDIR)/ares-test-parse-ns.Po - -rm -f ./$(DEPDIR)/ares-test-parse-ptr.Po - -rm -f ./$(DEPDIR)/ares-test-parse-soa-any.Po - -rm -f ./$(DEPDIR)/ares-test-parse-soa.Po - -rm -f ./$(DEPDIR)/ares-test-parse-srv.Po - -rm -f ./$(DEPDIR)/ares-test-parse-txt.Po - -rm -f ./$(DEPDIR)/ares-test-parse-uri.Po - -rm -f ./$(DEPDIR)/ares-test-parse.Po - -rm -f ./$(DEPDIR)/ares-test.Po - -rm -f ./$(DEPDIR)/dns-dump.Po - -rm -f ./$(DEPDIR)/dns-proto-test.Po - -rm -f ./$(DEPDIR)/dns-proto.Po - -rm -f gmock-1.11.0/$(DEPDIR)/libgmock_la-gmock-gtest-all.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: all check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles am--refresh check \ - check-TESTS check-am clean clean-cscope clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ - cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ - dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - dist-zstd distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - recheck tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# Code coverage -# -# Optional: -# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. -# Multiple directories may be specified, separated by whitespace. -# (Default: $(top_builddir)) -# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated -# by lcov for code coverage. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) -# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage -# reports to be created. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) -# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, -# set to 0 to disable it and leave empty to stay with the default. -# (Default: empty) -# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov -# instances. (Default: based on ) -# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov -# instances. (Default: ) -# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov -# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the -# collecting lcov instance. (Default: ) -# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov -# instance. (Default: ) -# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering -# lcov instance. (Default: empty) -# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov -# instance. (Default: ) -# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the -# genhtml instance. (Default: based on ) -# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml -# instance. (Default: ) -# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore -# -# The generated report will be titled using the $(PACKAGE_NAME) and -# $(PACKAGE_VERSION). In order to add the current git hash to the title, -# use the git-version-gen script, available online. -# Optional variables -# run only on top dir -@CODE_COVERAGE_ENABLED_TRUE@ ifeq ($(abs_builddir), $(abs_top_builddir)) -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_DIRECTORY ?= $(top_builddir) -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage - -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_BRANCH_COVERAGE ?= -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=$(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) -@CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_IGNORE_PATTERN ?= - -# Use recursive makes in order to ignore errors during check -@CODE_COVERAGE_ENABLED_TRUE@check-code-coverage: -@CODE_COVERAGE_ENABLED_TRUE@ -$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check -@CODE_COVERAGE_ENABLED_TRUE@ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture - -# Capture code coverage data -@CODE_COVERAGE_ENABLED_TRUE@code-coverage-capture: code-coverage-capture-hook -@CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) -@CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) -@CODE_COVERAGE_ENABLED_TRUE@ -@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp" -@CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) -@CODE_COVERAGE_ENABLED_TRUE@ @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" - -@CODE_COVERAGE_ENABLED_TRUE@code-coverage-clean: -@CODE_COVERAGE_ENABLED_TRUE@ -$(LCOV) --directory $(top_builddir) -z -@CODE_COVERAGE_ENABLED_TRUE@ -rm -rf "$(CODE_COVERAGE_OUTPUT_FILE)" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" -@CODE_COVERAGE_ENABLED_TRUE@ -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete - -@CODE_COVERAGE_ENABLED_TRUE@code-coverage-dist-clean: -@CODE_COVERAGE_ENABLED_TRUE@ else # ifneq ($(abs_builddir), $(abs_top_builddir)) -@CODE_COVERAGE_ENABLED_TRUE@check-code-coverage: - -@CODE_COVERAGE_ENABLED_TRUE@code-coverage-capture: code-coverage-capture-hook - -@CODE_COVERAGE_ENABLED_TRUE@code-coverage-clean: - -@CODE_COVERAGE_ENABLED_TRUE@code-coverage-dist-clean: -@CODE_COVERAGE_ENABLED_TRUE@ endif # ifeq ($(abs_builddir), $(abs_top_builddir)) -# Use recursive makes in order to ignore errors during check -@CODE_COVERAGE_ENABLED_FALSE@check-code-coverage: -@CODE_COVERAGE_ENABLED_FALSE@ @echo "Need to reconfigure with --enable-code-coverage" -# Capture code coverage data -@CODE_COVERAGE_ENABLED_FALSE@code-coverage-capture: code-coverage-capture-hook -@CODE_COVERAGE_ENABLED_FALSE@ @echo "Need to reconfigure with --enable-code-coverage" - -@CODE_COVERAGE_ENABLED_FALSE@code-coverage-clean: - -@CODE_COVERAGE_ENABLED_FALSE@code-coverage-dist-clean: - -# Hook rule executed before code-coverage-capture, overridable by the user -code-coverage-capture-hook: - -.PHONY: check-code-coverage code-coverage-capture code-coverage-dist-clean code-coverage-clean code-coverage-capture-hook - -test: check - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lib/c-ares-1.19.1/test/ares-fuzz.c b/lib/c-ares-1.19.1/test/ares-fuzz.c deleted file mode 100644 index 5526f46284e..00000000000 --- a/lib/c-ares-1.19.1/test/ares-fuzz.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * General driver to allow command-line fuzzer (i.e. afl) to - * exercise the libFuzzer entrypoint. - */ - -#include -#include -#include -#include -#include -#ifdef WIN32 -#include -#else -#include -#endif - -#define kMaxAflInputSize (1 << 20) -static unsigned char afl_buffer[kMaxAflInputSize]; - -#ifdef __AFL_LOOP -/* If we are built with afl-clang-fast, use persistent mode */ -#define KEEP_FUZZING(count) __AFL_LOOP(1000) -#else -/* If we are built with afl-clang, execute each input once */ -#define KEEP_FUZZING(count) ((count) < 1) -#endif - -/* In ares-test-fuzz.c and ares-test-fuzz-name.c: */ -int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size); - -static void ProcessFile(int fd) { - int count = read(fd, afl_buffer, kMaxAflInputSize); - /* - * Make a copy of the data so that it's not part of a larger - * buffer (where buffer overflows would go unnoticed). - */ - unsigned char *copied_data = (unsigned char *)malloc(count); - memcpy(copied_data, afl_buffer, count); - LLVMFuzzerTestOneInput(copied_data, count); - free(copied_data); -} - -int main(int argc, char *argv[]) { - if (argc == 1) { - int count = 0; - while (KEEP_FUZZING(count)) { - ProcessFile(fileno(stdin)); - count++; - } - } else { - int ii; - for (ii = 1; ii < argc; ++ii) { - int fd = open(argv[ii], O_RDONLY); - if (fd < 0) { - fprintf(stderr, "Failed to open '%s'\n", argv[ii]); - continue; - } - ProcessFile(fd); - close(fd); - } - } - return 0; -} diff --git a/lib/c-ares-1.19.1/test/ares-test-ai.h b/lib/c-ares-1.19.1/test/ares-test-ai.h deleted file mode 100644 index 7cf27e33069..00000000000 --- a/lib/c-ares-1.19.1/test/ares-test-ai.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef ARES_TEST_AI_H -#define ARES_TEST_AI_H - -#include -#include "gtest/gtest.h" -#include "gmock/gmock.h" -#include "ares-test.h" - -namespace ares { -namespace test { - -class MockChannelTestAI - : public MockChannelOptsTest, - public ::testing::WithParamInterface< std::pair > { - public: - MockChannelTestAI() : MockChannelOptsTest(1, GetParam().first, GetParam().second, nullptr, 0) {} -}; - -class MockUDPChannelTestAI - : public MockChannelOptsTest, - public ::testing::WithParamInterface { - public: - MockUDPChannelTestAI() : MockChannelOptsTest(1, GetParam(), false, nullptr, 0) {} -}; - -class MockTCPChannelTestAI - : public MockChannelOptsTest, - public ::testing::WithParamInterface { - public: - MockTCPChannelTestAI() : MockChannelOptsTest(1, GetParam(), true, nullptr, 0) {} -}; - - -// Test fixture that uses a default channel. -class DefaultChannelTestAI : public LibraryTest { - public: - DefaultChannelTestAI() : channel_(nullptr) { - EXPECT_EQ(ARES_SUCCESS, ares_init(&channel_)); - EXPECT_NE(nullptr, channel_); - } - - ~DefaultChannelTestAI() { - ares_destroy(channel_); - channel_ = nullptr; - } - - // Process all pending work on ares-owned file descriptors. - void Process(); - - protected: - ares_channel channel_; -}; - -} -} - -#endif diff --git a/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c b/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c deleted file mode 100644 index 82df74370c7..00000000000 --- a/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -#include "ares.h" -// Include ares internal file for DNS protocol constants -#include "ares_nameser.h" - -// Entrypoint for Clang's libfuzzer, exercising query creation. -int LLVMFuzzerTestOneInput(const unsigned char *data, - unsigned long size) { - // Null terminate the data. - char *name = malloc(size + 1); - name[size] = '\0'; - memcpy(name, data, size); - - unsigned char *buf = NULL; - int buflen = 0; - ares_create_query(name, C_IN, T_AAAA, 1234, 0, &buf, &buflen, 1024); - free(buf); - free(name); - return 0; -} diff --git a/lib/c-ares-1.19.1/test/ares-test-fuzz.c b/lib/c-ares-1.19.1/test/ares-test-fuzz.c deleted file mode 100644 index ddd6583c071..00000000000 --- a/lib/c-ares-1.19.1/test/ares-test-fuzz.c +++ /dev/null @@ -1,59 +0,0 @@ -#include - -#include "ares.h" - -// Entrypoint for Clang's libfuzzer -int LLVMFuzzerTestOneInput(const unsigned char *data, - unsigned long size) { - // Feed the data into each of the ares_parse_*_reply functions. - struct hostent *host = NULL; - struct ares_addrttl info[5]; - int count = 5; - ares_parse_a_reply(data, size, &host, info, &count); - if (host) ares_free_hostent(host); - - host = NULL; - struct ares_addr6ttl info6[5]; - count = 5; - ares_parse_aaaa_reply(data, size, &host, info6, &count); - if (host) ares_free_hostent(host); - - host = NULL; - unsigned char addrv4[4] = {0x10, 0x20, 0x30, 0x40}; - ares_parse_ptr_reply(data, size, addrv4, sizeof(addrv4), AF_INET, &host); - if (host) ares_free_hostent(host); - - host = NULL; - ares_parse_ns_reply(data, size, &host); - if (host) ares_free_hostent(host); - - struct ares_srv_reply* srv = NULL; - ares_parse_srv_reply(data, size, &srv); - if (srv) ares_free_data(srv); - - struct ares_mx_reply* mx = NULL; - ares_parse_mx_reply(data, size, &mx); - if (mx) ares_free_data(mx); - - struct ares_txt_reply* txt = NULL; - ares_parse_txt_reply(data, size, &txt); - if (txt) ares_free_data(txt); - - struct ares_soa_reply* soa = NULL; - ares_parse_soa_reply(data, size, &soa); - if (soa) ares_free_data(soa); - - struct ares_naptr_reply* naptr = NULL; - ares_parse_naptr_reply(data, size, &naptr); - if (naptr) ares_free_data(naptr); - - struct ares_caa_reply* caa = NULL; - ares_parse_caa_reply(data, size, &caa); - if (caa) ares_free_data(caa); - - struct ares_uri_reply* uri = NULL; - ares_parse_uri_reply(data, size, &uri); - if (uri) ares_free_data(uri); - - return 0; -} diff --git a/lib/c-ares-1.19.1/test/ares-test-internal.cc b/lib/c-ares-1.19.1/test/ares-test-internal.cc deleted file mode 100644 index 40cc82b86ec..00000000000 --- a/lib/c-ares-1.19.1/test/ares-test-internal.cc +++ /dev/null @@ -1,632 +0,0 @@ -#include "ares-test.h" -#include "dns-proto.h" - -#include - -#ifdef HAVE_UNISTD_H -#include -#endif -#include - -extern "C" { -// Remove command-line defines of package variables for the test project... -#undef PACKAGE_NAME -#undef PACKAGE_BUGREPORT -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -// ... so we can include the library's config without symbol redefinitions. -#include "ares_setup.h" -#include "ares_nowarn.h" -#include "ares_inet_net_pton.h" -#include "ares_data.h" -#include "ares_strsplit.h" -#include "ares_private.h" -#include "bitncmp.h" - -#ifdef HAVE_ARPA_INET_H -#include -#endif -#ifdef HAVE_SYS_UIO_H -# include -#endif -} - -#include -#include - -namespace ares { -namespace test { - -#ifndef CARES_SYMBOL_HIDING -void CheckPtoN4(int size, unsigned int value, const char *input) { - struct in_addr a4; - a4.s_addr = 0; - uint32_t expected = htonl(value); - EXPECT_EQ(size, ares_inet_net_pton(AF_INET, input, &a4, sizeof(a4))) - << " for input " << input; - EXPECT_EQ(expected, a4.s_addr) << " for input " << input; -} -#endif - -#ifndef CARES_SYMBOL_HIDING -TEST_F(LibraryTest, Strsplit) { - using std::vector; - using std::string; - size_t n; - struct { - vector inputs; - vector delimiters; - vector> expected; - } data = { - { - "", - " ", - " ", - "example.com, example.co", - " a, b, A,c, d, e,,,D,e,e,E", - }, - { ", ", ", ", ", ", ", ", ", " }, - { - {}, {}, {}, - { "example.com", "example.co" }, - { "a", "b", "c", "d", "e" }, - }, - }; - for(size_t i = 0; i < data.inputs.size(); i++) { - char **out = ares__strsplit(data.inputs.at(i).c_str(), - data.delimiters.at(i).c_str(), &n); - if(data.expected.at(i).size() == 0) { - EXPECT_EQ(out, nullptr); - } - else { - EXPECT_EQ(n, data.expected.at(i).size()); - for(size_t j = 0; j < n && j < data.expected.at(i).size(); j++) { - EXPECT_STREQ(out[j], data.expected.at(i).at(j).c_str()); - } - } - ares__strsplit_free(out, n); - } -} -#endif - -TEST_F(LibraryTest, InetPtoN) { - struct in_addr a4; - struct in6_addr a6; - -#ifndef CARES_SYMBOL_HIDING - uint32_t expected; - - CheckPtoN4(4 * 8, 0x01020304, "1.2.3.4"); - CheckPtoN4(4 * 8, 0x81010101, "129.1.1.1"); - CheckPtoN4(4 * 8, 0xC0010101, "192.1.1.1"); - CheckPtoN4(4 * 8, 0xE0010101, "224.1.1.1"); - CheckPtoN4(4 * 8, 0xE1010101, "225.1.1.1"); - CheckPtoN4(4, 0xE0000000, "224"); - CheckPtoN4(4 * 8, 0xFD000000, "253"); - CheckPtoN4(4 * 8, 0xF0010101, "240.1.1.1"); - CheckPtoN4(4 * 8, 0x02030405, "02.3.4.5"); - CheckPtoN4(3 * 8, 0x01020304, "1.2.3.4/24"); - CheckPtoN4(3 * 8, 0x01020300, "1.2.3/24"); - CheckPtoN4(2 * 8, 0xa0000000, "0xa"); - CheckPtoN4(0, 0x02030405, "2.3.4.5/000"); - CheckPtoN4(1 * 8, 0x01020000, "1.2/8"); - CheckPtoN4(2 * 8, 0x01020000, "0x0102/16"); - CheckPtoN4(4 * 8, 0x02030405, "02.3.4.5"); - - EXPECT_EQ(16 * 8, ares_inet_net_pton(AF_INET6, "::", &a6, sizeof(a6))); - EXPECT_EQ(16 * 8, ares_inet_net_pton(AF_INET6, "::1", &a6, sizeof(a6))); - EXPECT_EQ(16 * 8, ares_inet_net_pton(AF_INET6, "1234:5678::", &a6, sizeof(a6))); - EXPECT_EQ(16 * 8, ares_inet_net_pton(AF_INET6, "12:34::ff", &a6, sizeof(a6))); - EXPECT_EQ(16 * 8, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3.4", &a6, sizeof(a6))); - EXPECT_EQ(23, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3.4/23", &a6, sizeof(a6))); - EXPECT_EQ(3 * 8, ares_inet_net_pton(AF_INET6, "12:34::ff/24", &a6, sizeof(a6))); - EXPECT_EQ(0, ares_inet_net_pton(AF_INET6, "12:34::ff/0", &a6, sizeof(a6))); - EXPECT_EQ(16 * 8, ares_inet_net_pton(AF_INET6, "12:34::ffff:0.2", &a6, sizeof(a6))); - EXPECT_EQ(16 * 8, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234", &a6, sizeof(a6))); - EXPECT_EQ(2, ares_inet_net_pton(AF_INET6, "0::00:00:00/2", &a6, sizeof(a6))); - - // Various malformed versions - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, " ", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x ", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "x0", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0xXYZZY", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "xyzzy", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET+AF_INET6, "1.2.3.4", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "257.2.3.4", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "002.3.4.x", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "00.3.4.x", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "2.3.4.x", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "2.3.4.5.6", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "2.3.4.5.6/12", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "2.3.4:5", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "2.3.4.5/120", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "2.3.4.5/1x", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "2.3.4.5/x", &a4, sizeof(a4))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ff/240", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ff/02", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ff/2y", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ff/y", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ff/", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, ":x", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, ":", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, ": :1234", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "::12345", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234::2345:3456::0011", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234:", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234::", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1.2.3.4", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, ":1234:1234:1234:1234:1234:1234:1234:1234", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, ":1234:1234:1234:1234:1234:1234:1234:1234:", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234:5678", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234:5678:5678", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234:5678:5678:5678", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:257.2.3.4", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3.4.5.6", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3.4.5", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3.z", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3001.4", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3..4", &a6, sizeof(a6))); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3.", &a6, sizeof(a6))); - - // Hex constants are allowed. - EXPECT_EQ(4 * 8, ares_inet_net_pton(AF_INET, "0x01020304", &a4, sizeof(a4))); - expected = htonl(0x01020304); - EXPECT_EQ(expected, a4.s_addr); - EXPECT_EQ(4 * 8, ares_inet_net_pton(AF_INET, "0x0a0b0c0d", &a4, sizeof(a4))); - expected = htonl(0x0a0b0c0d); - EXPECT_EQ(expected, a4.s_addr); - EXPECT_EQ(4 * 8, ares_inet_net_pton(AF_INET, "0x0A0B0C0D", &a4, sizeof(a4))); - expected = htonl(0x0a0b0c0d); - EXPECT_EQ(expected, a4.s_addr); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x0xyz", &a4, sizeof(a4))); - EXPECT_EQ(4 * 8, ares_inet_net_pton(AF_INET, "0x1122334", &a4, sizeof(a4))); - expected = htonl(0x11223340); - EXPECT_EQ(expected, a4.s_addr); // huh? - - // No room, no room. - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "1.2.3.4", &a4, sizeof(a4) - 1)); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ff", &a6, sizeof(a6) - 1)); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x01020304", &a4, 2)); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x01020304", &a4, 0)); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x0a0b0c0d", &a4, 0)); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x0xyz", &a4, 0)); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x1122334", &a4, sizeof(a4) - 1)); - EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "253", &a4, sizeof(a4) - 1)); -#endif - - EXPECT_EQ(1, ares_inet_pton(AF_INET, "1.2.3.4", &a4)); - EXPECT_EQ(1, ares_inet_pton(AF_INET6, "12:34::ff", &a6)); - EXPECT_EQ(1, ares_inet_pton(AF_INET6, "12:34::ffff:1.2.3.4", &a6)); - EXPECT_EQ(0, ares_inet_pton(AF_INET, "xyzzy", &a4)); - EXPECT_EQ(-1, ares_inet_pton(AF_INET+AF_INET6, "1.2.3.4", &a4)); -} - -TEST_F(LibraryTest, FreeCorruptData) { - // ares_free_data(p) expects that there is a type field and a marker - // field in the memory before p. Feed it incorrect versions of each. - struct ares_data *data = (struct ares_data *)malloc(sizeof(struct ares_data)); - void* p = &(data->data); - - // Invalid type - data->type = (ares_datatype)99; - data->mark = ARES_DATATYPE_MARK; - ares_free_data(p); - - // Invalid marker - data->type = (ares_datatype)ARES_DATATYPE_MX_REPLY; - data->mark = ARES_DATATYPE_MARK + 1; - ares_free_data(p); - - // Null pointer - ares_free_data(nullptr); - - free(data); -} - -#ifndef CARES_SYMBOL_HIDING -TEST_F(LibraryTest, FreeLongChain) { - struct ares_addr_node *data = nullptr; - for (int ii = 0; ii < 100000; ii++) { - struct ares_addr_node *prev = (struct ares_addr_node*)ares_malloc_data(ARES_DATATYPE_ADDR_NODE); - prev->next = data; - data = prev; - } - - ares_free_data(data); -} - -TEST(LibraryInit, StrdupFailures) { - EXPECT_EQ(ARES_SUCCESS, ares_library_init(ARES_LIB_INIT_ALL)); - char* copy = ares_strdup("string"); - EXPECT_NE(nullptr, copy); - ares_free(copy); - ares_library_cleanup(); -} - -TEST_F(LibraryTest, StrdupFailures) { - SetAllocFail(1); - char* copy = ares_strdup("string"); - EXPECT_EQ(nullptr, copy); -} - -TEST_F(LibraryTest, MallocDataFail) { - EXPECT_EQ(nullptr, ares_malloc_data((ares_datatype)99)); - SetAllocSizeFail(sizeof(struct ares_data)); - EXPECT_EQ(nullptr, ares_malloc_data(ARES_DATATYPE_MX_REPLY)); -} - -TEST(Misc, Bitncmp) { - byte a[4] = {0x80, 0x01, 0x02, 0x03}; - byte b[4] = {0x80, 0x01, 0x02, 0x04}; - byte c[4] = {0x01, 0xFF, 0x80, 0x02}; - EXPECT_GT(0, ares__bitncmp(a, b, sizeof(a)*8)); - EXPECT_LT(0, ares__bitncmp(b, a, sizeof(a)*8)); - EXPECT_EQ(0, ares__bitncmp(a, a, sizeof(a)*8)); - - for (int ii = 1; ii < (3*8+5); ii++) { - EXPECT_EQ(0, ares__bitncmp(a, b, ii)); - EXPECT_EQ(0, ares__bitncmp(b, a, ii)); - EXPECT_LT(0, ares__bitncmp(a, c, ii)); - EXPECT_GT(0, ares__bitncmp(c, a, ii)); - } - - // Last byte differs at 5th bit - EXPECT_EQ(0, ares__bitncmp(a, b, 3*8 + 3)); - EXPECT_EQ(0, ares__bitncmp(a, b, 3*8 + 4)); - EXPECT_EQ(0, ares__bitncmp(a, b, 3*8 + 5)); - EXPECT_GT(0, ares__bitncmp(a, b, 3*8 + 6)); - EXPECT_GT(0, ares__bitncmp(a, b, 3*8 + 7)); -} - -TEST_F(LibraryTest, Casts) { - ares_ssize_t ssz = 100; - unsigned int u = 100; - int i = 100; - long l = 100; - - unsigned int ru = aresx_sztoui(ssz); - EXPECT_EQ(u, ru); - int ri = aresx_sztosi(ssz); - EXPECT_EQ(i, ri); - - ri = aresx_sltosi(l); - EXPECT_EQ(l, (long)ri); -} - -TEST_F(LibraryTest, ReadLine) { - TempFile temp("abcde\n0123456789\nXYZ\n012345678901234567890\n\n"); - FILE *fp = fopen(temp.filename(), "r"); - size_t bufsize = 4; - char *buf = (char *)ares_malloc(bufsize); - - EXPECT_EQ(ARES_SUCCESS, ares__read_line(fp, &buf, &bufsize)); - EXPECT_EQ("abcde", std::string(buf)); - EXPECT_EQ(ARES_SUCCESS, ares__read_line(fp, &buf, &bufsize)); - EXPECT_EQ("0123456789", std::string(buf)); - EXPECT_EQ(ARES_SUCCESS, ares__read_line(fp, &buf, &bufsize)); - EXPECT_EQ("XYZ", std::string(buf)); - SetAllocFail(1); - EXPECT_EQ(ARES_ENOMEM, ares__read_line(fp, &buf, &bufsize)); - EXPECT_EQ(nullptr, buf); - - fclose(fp); - ares_free(buf); -} - -TEST_F(LibraryTest, ReadLineNoBuf) { - TempFile temp("abcde\n0123456789\nXYZ\n012345678901234567890"); - FILE *fp = fopen(temp.filename(), "r"); - size_t bufsize = 0; - char *buf = nullptr; - - SetAllocFail(1); - EXPECT_EQ(ARES_ENOMEM, ares__read_line(fp, &buf, &bufsize)); - - EXPECT_EQ(ARES_SUCCESS, ares__read_line(fp, &buf, &bufsize)); - EXPECT_EQ("abcde", std::string(buf)); - EXPECT_EQ(ARES_SUCCESS, ares__read_line(fp, &buf, &bufsize)); - EXPECT_EQ("0123456789", std::string(buf)); - EXPECT_EQ(ARES_SUCCESS, ares__read_line(fp, &buf, &bufsize)); - EXPECT_EQ("XYZ", std::string(buf)); - EXPECT_EQ(ARES_SUCCESS, ares__read_line(fp, &buf, &bufsize)); - EXPECT_EQ("012345678901234567890", std::string(buf)); - - fclose(fp); - ares_free(buf); -} - -TEST(Misc, GetHostent) { - TempFile hostsfile("1.2.3.4 example.com \n" - " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n" - "#comment\n" - "4.5.6.7\n" - "1.3.5.7 \n" - "::1 ipv6.com"); - struct hostent *host = nullptr; - FILE *fp = fopen(hostsfile.filename(), "r"); - ASSERT_NE(nullptr, fp); - EXPECT_EQ(ARES_EBADFAMILY, ares__get_hostent(fp, AF_INET+AF_INET6, &host)); - rewind(fp); - - EXPECT_EQ(ARES_SUCCESS, ares__get_hostent(fp, AF_INET, &host)); - ASSERT_NE(nullptr, host); - std::stringstream ss1; - ss1 << HostEnt(host); - EXPECT_EQ("{'example.com' aliases=[] addrs=[1.2.3.4]}", ss1.str()); - ares_free_hostent(host); - host = nullptr; - - EXPECT_EQ(ARES_SUCCESS, ares__get_hostent(fp, AF_INET, &host)); - ASSERT_NE(nullptr, host); - std::stringstream ss2; - ss2 << HostEnt(host); - EXPECT_EQ("{'google.com' aliases=[www.google.com, www2.google.com] addrs=[2.3.4.5]}", ss2.str()); - ares_free_hostent(host); - host = nullptr; - - EXPECT_EQ(ARES_EOF, ares__get_hostent(fp, AF_INET, &host)); - - rewind(fp); - EXPECT_EQ(ARES_SUCCESS, ares__get_hostent(fp, AF_INET6, &host)); - ASSERT_NE(nullptr, host); - std::stringstream ss3; - ss3 << HostEnt(host); - EXPECT_EQ("{'ipv6.com' aliases=[] addrs=[0000:0000:0000:0000:0000:0000:0000:0001]}", ss3.str()); - ares_free_hostent(host); - host = nullptr; - EXPECT_EQ(ARES_EOF, ares__get_hostent(fp, AF_INET6, &host)); - fclose(fp); -} - -TEST_F(LibraryTest, GetHostentAllocFail) { - TempFile hostsfile("1.2.3.4 example.com alias1 alias2\n"); - struct hostent *host = nullptr; - FILE *fp = fopen(hostsfile.filename(), "r"); - ASSERT_NE(nullptr, fp); - - for (int ii = 1; ii <= 8; ii++) { - rewind(fp); - ClearFails(); - SetAllocFail(ii); - host = nullptr; - EXPECT_EQ(ARES_ENOMEM, ares__get_hostent(fp, AF_INET, &host)) << ii; - } - fclose(fp); -} - -TEST_F(DefaultChannelTest, GetAddrInfoHostsPositive) { - TempFile hostsfile("1.2.3.4 example.com \n" - " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n" - "#comment\n" - "4.5.6.7\n" - "1.3.5.7 \n" - "::1 ipv6.com"); - EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; - AddrInfoResult result = {}; - hints.ai_family = AF_INET; - hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; - ares_getaddrinfo(channel_, "example.com", NULL, &hints, AddrInfoCallback, &result); - Process(); - EXPECT_TRUE(result.done_); - std::stringstream ss; - ss << result.ai_; - EXPECT_EQ("{example.com addr=[1.2.3.4]}", ss.str()); -} - -TEST_F(DefaultChannelTest, GetAddrInfoHostsSpaces) { - TempFile hostsfile("1.2.3.4 example.com \n" - " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n" - "#comment\n" - "4.5.6.7\n" - "1.3.5.7 \n" - "::1 ipv6.com"); - EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; - AddrInfoResult result = {}; - hints.ai_family = AF_INET; - hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; - ares_getaddrinfo(channel_, "google.com", NULL, &hints, AddrInfoCallback, &result); - Process(); - EXPECT_TRUE(result.done_); - std::stringstream ss; - ss << result.ai_; - EXPECT_EQ("{www.google.com->google.com, www2.google.com->google.com addr=[2.3.4.5]}", ss.str()); -} - -TEST_F(DefaultChannelTest, GetAddrInfoHostsByALias) { - TempFile hostsfile("1.2.3.4 example.com \n" - " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n" - "#comment\n" - "4.5.6.7\n" - "1.3.5.7 \n" - "::1 ipv6.com"); - EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; - AddrInfoResult result = {}; - hints.ai_family = AF_INET; - hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; - ares_getaddrinfo(channel_, "www2.google.com", NULL, &hints, AddrInfoCallback, &result); - Process(); - EXPECT_TRUE(result.done_); - std::stringstream ss; - ss << result.ai_; - EXPECT_EQ("{www.google.com->google.com, www2.google.com->google.com addr=[2.3.4.5]}", ss.str()); -} - -TEST_F(DefaultChannelTest, GetAddrInfoHostsIPV6) { - TempFile hostsfile("1.2.3.4 example.com \n" - " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n" - "#comment\n" - "4.5.6.7\n" - "1.3.5.7 \n" - "::1 ipv6.com"); - EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; - AddrInfoResult result = {}; - hints.ai_family = AF_INET6; - hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; - ares_getaddrinfo(channel_, "ipv6.com", NULL, &hints, AddrInfoCallback, &result); - Process(); - EXPECT_TRUE(result.done_); - std::stringstream ss; - ss << result.ai_; - EXPECT_EQ("{ipv6.com addr=[[0000:0000:0000:0000:0000:0000:0000:0001]]}", ss.str()); -} - -TEST_F(LibraryTest, GetAddrInfoAllocFail) { - TempFile hostsfile("1.2.3.4 example.com alias1 alias2\n"); - struct ares_addrinfo_hints hints; - unsigned short port = 80; - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_INET; - - FILE *fp = fopen(hostsfile.filename(), "r"); - ASSERT_NE(nullptr, fp); - - for (int ii = 1; ii <= 3; ii++) { - rewind(fp); - ClearFails(); - SetAllocFail(ii); - struct ares_addrinfo ai; - EXPECT_EQ(ARES_ENOMEM, ares__readaddrinfo(fp, "example.com", port, &hints, &ai)) << ii; - } - fclose(fp); -} - -TEST(Misc, OnionDomain) { - EXPECT_EQ(0, ares__is_onion_domain("onion.no")); - EXPECT_EQ(0, ares__is_onion_domain(".onion.no")); - EXPECT_EQ(1, ares__is_onion_domain(".onion")); - EXPECT_EQ(1, ares__is_onion_domain(".onion.")); - EXPECT_EQ(1, ares__is_onion_domain("yes.onion")); - EXPECT_EQ(1, ares__is_onion_domain("yes.onion.")); - EXPECT_EQ(1, ares__is_onion_domain("YES.ONION")); - EXPECT_EQ(1, ares__is_onion_domain("YES.ONION.")); -} -#endif - -#ifdef CARES_EXPOSE_STATICS -// These tests access internal static functions from the library, which -// are only exposed when CARES_EXPOSE_STATICS has been configured. As such -// they are tightly couple to the internal library implementation details. -extern "C" char *ares_striendstr(const char*, const char*); -TEST_F(LibraryTest, Striendstr) { - EXPECT_EQ(nullptr, ares_striendstr("abc", "12345")); - EXPECT_NE(nullptr, ares_striendstr("abc12345", "12345")); - EXPECT_NE(nullptr, ares_striendstr("abcxyzzy", "XYZZY")); - EXPECT_NE(nullptr, ares_striendstr("xyzzy", "XYZZY")); - EXPECT_EQ(nullptr, ares_striendstr("xyxzy", "XYZZY")); - EXPECT_NE(nullptr, ares_striendstr("", "")); - const char *str = "plugh"; - EXPECT_NE(nullptr, ares_striendstr(str, str)); -} -extern "C" int ares__single_domain(ares_channel, const char*, char**); -TEST_F(DefaultChannelTest, SingleDomain) { - TempFile aliases("www www.google.com\n"); - EnvValue with_env("HOSTALIASES", aliases.filename()); - - SetAllocSizeFail(128); - char *ptr = nullptr; - EXPECT_EQ(ARES_ENOMEM, ares__single_domain(channel_, "www", &ptr)); - - channel_->flags |= ARES_FLAG_NOSEARCH|ARES_FLAG_NOALIASES; - EXPECT_EQ(ARES_SUCCESS, ares__single_domain(channel_, "www", &ptr)); - EXPECT_EQ("www", std::string(ptr)); - ares_free(ptr); - ptr = nullptr; - - SetAllocFail(1); - EXPECT_EQ(ARES_ENOMEM, ares__single_domain(channel_, "www", &ptr)); - EXPECT_EQ(nullptr, ptr); -} -#endif - -TEST_F(DefaultChannelTest, SaveInvalidChannel) { - int saved = channel_->nservers; - channel_->nservers = -1; - struct ares_options opts; - int optmask = 0; - EXPECT_EQ(ARES_ENODATA, ares_save_options(channel_, &opts, &optmask)); - channel_->nservers = saved; -} - -// Need to put this in own function due to nested lambda bug -// in VS2013. (C2888) -static int configure_socket(ares_socket_t s) { - // transposed from ares-process, simplified non-block setter. -#if defined(USE_BLOCKING_SOCKETS) - return 0; /* returns success */ -#elif defined(HAVE_FCNTL_O_NONBLOCK) - /* most recent unix versions */ - int flags; - flags = fcntl(s, F_GETFL, 0); - return fcntl(s, F_SETFL, flags | O_NONBLOCK); -#elif defined(HAVE_IOCTL_FIONBIO) - /* older unix versions */ - int flags = 1; - return ioctl(s, FIONBIO, &flags); -#elif defined(HAVE_IOCTLSOCKET_FIONBIO) -#ifdef WATT32 - char flags = 1; -#else - /* Windows */ - unsigned long flags = 1UL; -#endif - return ioctlsocket(s, FIONBIO, &flags); -#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO) - /* Amiga */ - long flags = 1L; - return IoctlSocket(s, FIONBIO, flags); -#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK) - /* BeOS */ - long b = 1L; - return setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); -#else -# error "no non-blocking method was found/used/set" -#endif -} - -// TODO: This should not really be in this file, but we need ares config -// flags, and here they are available. -const struct ares_socket_functions VirtualizeIO::default_functions = { - [](int af, int type, int protocol, void *) -> ares_socket_t { - auto s = ::socket(af, type, protocol); - if (s == ARES_SOCKET_BAD) { - return s; - } - if (configure_socket(s) != 0) { - sclose(s); - return ares_socket_t(-1); - } - return s; - }, - [](ares_socket_t s, void * p) { - return :: sclose(s); - }, - [](ares_socket_t s, const struct sockaddr * addr, socklen_t len, void *) { - return ::connect(s, addr, len); - }, - [](ares_socket_t s, void * dst, size_t len, int flags, struct sockaddr * addr, socklen_t * alen, void *) -> ares_ssize_t { -#ifdef HAVE_RECVFROM - return ::recvfrom(s, reinterpret_cast(dst), len, flags, addr, alen); -#else - return sread(s, dst, len); -#endif - }, - [](ares_socket_t s, const struct iovec * vec, int len, void *) { -#ifndef HAVE_WRITEV - return ares_writev(s, vec, len); -#else - return :: writev(s, vec, len); -#endif - } -}; - - -} // namespace test -} // namespace ares diff --git a/lib/c-ares-1.19.1/test/ares-test.h b/lib/c-ares-1.19.1/test/ares-test.h deleted file mode 100644 index 9337915ebbd..00000000000 --- a/lib/c-ares-1.19.1/test/ares-test.h +++ /dev/null @@ -1,494 +0,0 @@ -// -*- mode: c++ -*- -#ifndef ARES_TEST_H -#define ARES_TEST_H - -#include "ares_setup.h" -#include "ares.h" - -#include "dns-proto.h" -// Include ares internal file for DNS protocol constants -#include "ares_nameser.h" - -#include "gtest/gtest.h" -#include "gmock/gmock.h" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#if defined(HAVE_USER_NAMESPACE) && defined(HAVE_UTS_NAMESPACE) -#define HAVE_CONTAINER -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace ares { - -typedef unsigned char byte; - -namespace test { - -extern bool verbose; -extern int mock_port; -extern const std::vector both_families; -extern const std::vector ipv4_family; -extern const std::vector ipv6_family; - -extern const std::vector> both_families_both_modes; -extern const std::vector> ipv4_family_both_modes; -extern const std::vector> ipv6_family_both_modes; - -// Which parameters to use in tests -extern std::vector families; -extern std::vector> families_modes; - -// Process all pending work on ares-owned file descriptors, plus -// optionally the given set-of-FDs + work function. -void ProcessWork(ares_channel channel, - std::function()> get_extrafds, - std::function process_extra); -std::set NoExtraFDs(); - -// Test fixture that ensures library initialization, and allows -// memory allocations to be failed. -class LibraryTest : public ::testing::Test { - public: - LibraryTest() { - EXPECT_EQ(ARES_SUCCESS, - ares_library_init_mem(ARES_LIB_INIT_ALL, - &LibraryTest::amalloc, - &LibraryTest::afree, - &LibraryTest::arealloc)); - } - ~LibraryTest() { - ares_library_cleanup(); - ClearFails(); - } - // Set the n-th malloc call (of any size) from the library to fail. - // (nth == 1 means the next call) - static void SetAllocFail(int nth); - // Set the next malloc call for the given size to fail. - static void SetAllocSizeFail(size_t size); - // Remove any pending alloc failures. - static void ClearFails(); - - static void *amalloc(size_t size); - static void* arealloc(void *ptr, size_t size); - static void afree(void *ptr); - private: - static bool ShouldAllocFail(size_t size); - static unsigned long long fails_; - static std::map size_fails_; -}; - -// Test fixture that uses a default channel. -class DefaultChannelTest : public LibraryTest { - public: - DefaultChannelTest() : channel_(nullptr) { - EXPECT_EQ(ARES_SUCCESS, ares_init(&channel_)); - EXPECT_NE(nullptr, channel_); - } - - ~DefaultChannelTest() { - ares_destroy(channel_); - channel_ = nullptr; - } - - // Process all pending work on ares-owned file descriptors. - void Process(); - - protected: - ares_channel channel_; -}; - -// Test fixture that uses a default channel with the specified lookup mode. -class DefaultChannelModeTest - : public LibraryTest, - public ::testing::WithParamInterface { - public: - DefaultChannelModeTest() : channel_(nullptr) { - struct ares_options opts = {0}; - opts.lookups = strdup(GetParam().c_str()); - int optmask = ARES_OPT_LOOKUPS; - EXPECT_EQ(ARES_SUCCESS, ares_init_options(&channel_, &opts, optmask)); - EXPECT_NE(nullptr, channel_); - free(opts.lookups); - } - - ~DefaultChannelModeTest() { - ares_destroy(channel_); - channel_ = nullptr; - } - - // Process all pending work on ares-owned file descriptors. - void Process(); - - protected: - ares_channel channel_; -}; - -// Mock DNS server to allow responses to be scripted by tests. -class MockServer { - public: - MockServer(int family, int port); - ~MockServer(); - - // Mock method indicating the processing of a particular - // request. - MOCK_METHOD2(OnRequest, void(const std::string& name, int rrtype)); - - // Set the reply to be sent next; the query ID field will be overwritten - // with the value from the request. - void SetReplyData(const std::vector& reply) { reply_ = reply; } - void SetReply(const DNSPacket* reply) { SetReplyData(reply->data()); } - void SetReplyQID(int qid) { qid_ = qid; } - - // The set of file descriptors that the server handles. - std::set fds() const; - - // Process activity on a file descriptor. - void ProcessFD(int fd); - - // Ports the server is responding to - int udpport() const { return udpport_; } - int tcpport() const { return tcpport_; } - - private: - void ProcessRequest(int fd, struct sockaddr_storage* addr, int addrlen, - int qid, const std::string& name, int rrtype); - void ProcessPacket(int fd, struct sockaddr_storage *addr, socklen_t addrlen, - byte *data, int len); - int udpport_; - int tcpport_; - int udpfd_; - int tcpfd_; - std::set connfds_; - std::vector reply_; - int qid_; -}; - -// Test fixture that uses a mock DNS server. -class MockChannelOptsTest : public LibraryTest { - public: - MockChannelOptsTest(int count, int family, bool force_tcp, struct ares_options* givenopts, int optmask); - ~MockChannelOptsTest(); - - // Process all pending work on ares-owned and mock-server-owned file descriptors. - void Process(); - - protected: - // NiceMockServer doesn't complain about uninteresting calls. - typedef testing::NiceMock NiceMockServer; - typedef std::vector< std::unique_ptr > NiceMockServers; - - std::set fds() const; - void ProcessFD(int fd); - - static NiceMockServers BuildServers(int count, int family, int base_port); - - NiceMockServers servers_; - // Convenience reference to first server. - NiceMockServer& server_; - ares_channel channel_; -}; - -class MockChannelTest - : public MockChannelOptsTest, - public ::testing::WithParamInterface< std::pair > { - public: - MockChannelTest() : MockChannelOptsTest(1, GetParam().first, GetParam().second, nullptr, 0) {} -}; - -class MockUDPChannelTest - : public MockChannelOptsTest, - public ::testing::WithParamInterface { - public: - MockUDPChannelTest() : MockChannelOptsTest(1, GetParam(), false, nullptr, 0) {} -}; - -class MockTCPChannelTest - : public MockChannelOptsTest, - public ::testing::WithParamInterface { - public: - MockTCPChannelTest() : MockChannelOptsTest(1, GetParam(), true, nullptr, 0) {} -}; - -// gMock action to set the reply for a mock server. -ACTION_P2(SetReplyData, mockserver, data) { - mockserver->SetReplyData(data); -} -ACTION_P2(SetReply, mockserver, reply) { - mockserver->SetReply(reply); -} -ACTION_P2(SetReplyQID, mockserver, qid) { - mockserver->SetReplyQID(qid); -} -// gMock action to cancel a channel. -ACTION_P2(CancelChannel, mockserver, channel) { - ares_cancel(channel); -} - -// C++ wrapper for struct hostent. -struct HostEnt { - HostEnt() : addrtype_(-1) {} - HostEnt(const struct hostent* hostent); - std::string name_; - std::vector aliases_; - int addrtype_; // AF_INET or AF_INET6 - std::vector addrs_; -}; -std::ostream& operator<<(std::ostream& os, const HostEnt& result); - -// Structure that describes the result of an ares_host_callback invocation. -struct HostResult { - HostResult() : done_(false), status_(0), timeouts_(0) {} - // Whether the callback has been invoked. - bool done_; - // Explicitly provided result information. - int status_; - int timeouts_; - // Contents of the hostent structure, if provided. - HostEnt host_; -}; -std::ostream& operator<<(std::ostream& os, const HostResult& result); - -// Structure that describes the result of an ares_callback invocation. -struct SearchResult { - // Whether the callback has been invoked. - bool done_; - // Explicitly provided result information. - int status_; - int timeouts_; - std::vector data_; -}; -std::ostream& operator<<(std::ostream& os, const SearchResult& result); - -// Structure that describes the result of an ares_nameinfo_callback invocation. -struct NameInfoResult { - // Whether the callback has been invoked. - bool done_; - // Explicitly provided result information. - int status_; - int timeouts_; - std::string node_; - std::string service_; -}; -std::ostream& operator<<(std::ostream& os, const NameInfoResult& result); - -struct AddrInfoDeleter { - void operator() (ares_addrinfo *ptr) { - if (ptr) ares_freeaddrinfo(ptr); - } -}; - -// C++ wrapper for struct ares_addrinfo. -using AddrInfo = std::unique_ptr; - -std::ostream& operator<<(std::ostream& os, const AddrInfo& result); - -// Structure that describes the result of an ares_addrinfo_callback invocation. -struct AddrInfoResult { - AddrInfoResult() : done_(false), status_(-1), timeouts_(0) {} - // Whether the callback has been invoked. - bool done_; - // Explicitly provided result information. - int status_; - int timeouts_; - // Contents of the ares_addrinfo structure, if provided. - AddrInfo ai_; -}; -std::ostream& operator<<(std::ostream& os, const AddrInfoResult& result); - -// Standard implementation of ares callbacks that fill out the corresponding -// structures. -void HostCallback(void *data, int status, int timeouts, - struct hostent *hostent); -void SearchCallback(void *data, int status, int timeouts, - unsigned char *abuf, int alen); -void NameInfoCallback(void *data, int status, int timeouts, - char *node, char *service); -void AddrInfoCallback(void *data, int status, int timeouts, - struct ares_addrinfo *res); - -// Retrieve the name servers used by a channel. -std::vector GetNameServers(ares_channel channel); - - -// RAII class to temporarily create a directory of a given name. -class TransientDir { - public: - TransientDir(const std::string& dirname); - ~TransientDir(); - - private: - std::string dirname_; -}; - -// C++ wrapper around tempnam() -std::string TempNam(const char *dir, const char *prefix); - -// RAII class to temporarily create file of a given name and contents. -class TransientFile { - public: - TransientFile(const std::string &filename, const std::string &contents); - ~TransientFile(); - - protected: - std::string filename_; -}; - -// RAII class for a temporary file with the given contents. -class TempFile : public TransientFile { - public: - TempFile(const std::string& contents); - const char* filename() const { return filename_.c_str(); } -}; - -#ifdef _WIN32 -extern "C" { - -static int setenv(const char *name, const char *value, int overwrite) -{ - char *buffer; - size_t buf_size; - - if (name == NULL) - return -1; - - if (value == NULL) - value = ""; /* For unset */ - - if (!overwrite && getenv(name) != NULL) { - return -1; - } - - buf_size = strlen(name) + strlen(value) + 1 /* = */ + 1 /* NULL */; - buffer = (char *)malloc(buf_size); - _snprintf(buffer, buf_size, "%s=%s", name, value); - _putenv(buffer); - free(buffer); - return 0; -} - -static int unsetenv(const char *name) -{ - return setenv(name, NULL, 1); -} - -} /* extern "C" */ -#endif - -// RAII class for a temporary environment variable value. -class EnvValue { - public: - EnvValue(const char *name, const char *value) : name_(name), restore_(false) { - char *original = getenv(name); - if (original) { - restore_ = true; - original_ = original; - } - setenv(name_.c_str(), value, 1); - } - ~EnvValue() { - if (restore_) { - setenv(name_.c_str(), original_.c_str(), 1); - } else { - unsetenv(name_.c_str()); - } - } - private: - std::string name_; - bool restore_; - std::string original_; -}; - - -#ifdef HAVE_CONTAINER -// Linux-specific functionality for running code in a container, implemented -// in ares-test-ns.cc -typedef std::function VoidToIntFn; -typedef std::vector> NameContentList; - -class ContainerFilesystem { - public: - ContainerFilesystem(NameContentList files, const std::string& mountpt); - ~ContainerFilesystem(); - std::string root() const { return rootdir_; }; - std::string mountpt() const { return mountpt_; }; - private: - void EnsureDirExists(const std::string& dir); - std::string rootdir_; - std::string mountpt_; - std::list dirs_; - std::vector> files_; -}; - -int RunInContainer(ContainerFilesystem* fs, const std::string& hostname, - const std::string& domainname, VoidToIntFn fn); - -#define ICLASS_NAME(casename, testname) Contained##casename##_##testname -#define CONTAINED_TEST_F(casename, testname, hostname, domainname, files) \ - class ICLASS_NAME(casename, testname) : public casename { \ - public: \ - ICLASS_NAME(casename, testname)() {} \ - static int InnerTestBody(); \ - }; \ - TEST_F(ICLASS_NAME(casename, testname), _) { \ - ContainerFilesystem chroot(files, ".."); \ - VoidToIntFn fn(ICLASS_NAME(casename, testname)::InnerTestBody); \ - EXPECT_EQ(0, RunInContainer(&chroot, hostname, domainname, fn)); \ - } \ - int ICLASS_NAME(casename, testname)::InnerTestBody() - -#endif - -/* Assigns virtual IO functions to a channel. These functions simply call - * the actual system functions. - */ -class VirtualizeIO { -public: - VirtualizeIO(ares_channel); - ~VirtualizeIO(); - - static const ares_socket_functions default_functions; -private: - ares_channel channel_; -}; - -/* - * Slightly white-box macro to generate two runs for a given test case: - * One with no modifications, and one with all IO functions set to use - * the virtual io structure. - * Since no magic socket setup or anything is done in the latter case - * this should probably only be used for test with very vanilla IO - * requirements. - */ -#define VCLASS_NAME(casename, testname) Virt##casename##_##testname -#define VIRT_NONVIRT_TEST_F(casename, testname) \ - class VCLASS_NAME(casename, testname) : public casename { \ - public: \ - VCLASS_NAME(casename, testname)() {} \ - void InnerTestBody(); \ - }; \ - GTEST_TEST_(casename, testname, VCLASS_NAME(casename, testname), \ - ::testing::internal::GetTypeId()) { \ - InnerTestBody(); \ - } \ - GTEST_TEST_(casename, testname##_virtualized, \ - VCLASS_NAME(casename, testname), \ - ::testing::internal::GetTypeId()) { \ - VirtualizeIO vio(channel_); \ - InnerTestBody(); \ - } \ - void VCLASS_NAME(casename, testname)::InnerTestBody() - -} // namespace test -} // namespace ares - -#endif diff --git a/lib/c-ares-1.19.1/test/buildconf b/lib/c-ares-1.19.1/test/buildconf deleted file mode 100755 index 5a9d7a34607..00000000000 --- a/lib/c-ares-1.19.1/test/buildconf +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -autoreconf -iv \ No newline at end of file diff --git a/lib/c-ares-1.19.1/test/configure.ac b/lib/c-ares-1.19.1/test/configure.ac deleted file mode 100644 index 9ed28dae49c..00000000000 --- a/lib/c-ares-1.19.1/test/configure.ac +++ /dev/null @@ -1,25 +0,0 @@ -AC_PREREQ(2.57) -AC_INIT([c-ares-test],[-],[-]) -AC_CONFIG_SRCDIR([ares-test.cc]) -AC_CONFIG_MACRO_DIR([../m4]) - -AM_INIT_AUTOMAKE([no-define]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX_11]) -AX_REQUIRE_DEFINED([AX_PTHREAD]) - -dnl Checks for programs. -AC_PROG_CXX -AX_CXX_COMPILE_STDCXX_11([noext],[mandatory]) -LT_INIT -AC_SUBST(LIBTOOL_DEPS) -AX_PTHREAD -AX_CODE_COVERAGE -AX_CHECK_USER_NAMESPACE -AX_CHECK_UTS_NAMESPACE - -AC_CHECK_HEADERS(netdb.h netinet/tcp.h) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/lib/c-ares-1.19.1/test/dns-dump.cc b/lib/c-ares-1.19.1/test/dns-dump.cc deleted file mode 100644 index f00a2d4cf6a..00000000000 --- a/lib/c-ares-1.19.1/test/dns-dump.cc +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#ifdef _MSC_VER -# include -#else -# include -#endif - -#include -#include - -#include "dns-proto.h" - -namespace ares { - -static void ShowFile(const char* filename) { - int fd = open(filename, O_RDONLY); - if (fd < 0) { - std::cerr << "Failed to open '" << filename << "'" << std::endl; - return; - } - std::vector contents; - while (true) { - unsigned char buffer[1024]; - int len = read(fd, buffer, sizeof(buffer)); - if (len <= 0) break; - contents.insert(contents.end(), buffer, buffer + len); - } - std::cout << PacketToString(contents) << std::endl; -} - -} // namespace ares - -int main(int argc, char* argv[]) { - for (int ii = 1; ii < argc; ++ii) { - ares::ShowFile(argv[ii]); - } - return 0; -} - diff --git a/lib/c-ares-1.19.1/test/dns-proto.h b/lib/c-ares-1.19.1/test/dns-proto.h deleted file mode 100644 index d8a8e579936..00000000000 --- a/lib/c-ares-1.19.1/test/dns-proto.h +++ /dev/null @@ -1,254 +0,0 @@ -// -*- mode: c++ -*- -#ifndef DNS_PROTO_H -#define DNS_PROTO_H -// Utilities for processing DNS packet contents - -#include "ares_setup.h" -#include "ares.h" -// Include ares internal file for DNS protocol constants -#include "ares_nameser.h" - -#include -#include -#include - -namespace ares { - -typedef unsigned char byte; - -std::string HexDump(std::vector data); -std::string HexDump(const byte *data, int len); -std::string HexDump(const char *data, int len); - -std::string StatusToString(int status); -std::string RcodeToString(int rcode); -std::string RRTypeToString(int rrtype); -std::string ClassToString(int qclass); -std::string AddressToString(const void* addr, int len); - -// Convert DNS protocol data to strings. -// Note that these functions are not defensive; they assume -// a validly formatted input, and so should not be used on -// externally-determined inputs. -std::string PacketToString(const std::vector& packet); -std::string QuestionToString(const std::vector& packet, - const byte** data, int* len); -std::string RRToString(const std::vector& packet, - const byte** data, int* len); - - -// Manipulate DNS protocol data. -void PushInt32(std::vector* data, int value); -void PushInt16(std::vector* data, int value); -std::vector EncodeString(const std::string& name); - -struct DNSQuestion { - DNSQuestion(const std::string& name, int rrtype, int qclass) - : name_(name), rrtype_(rrtype), qclass_(qclass) {} - DNSQuestion(const std::string& name, int rrtype) - : name_(name), rrtype_(rrtype), qclass_(C_IN) {} - virtual ~DNSQuestion() {} - virtual std::vector data() const; - std::string name_; - int rrtype_; - int qclass_; -}; - -struct DNSRR : public DNSQuestion { - DNSRR(const std::string& name, int rrtype, int qclass, int ttl) - : DNSQuestion(name, rrtype, qclass), ttl_(ttl) {} - DNSRR(const std::string& name, int rrtype, int ttl) - : DNSQuestion(name, rrtype), ttl_(ttl) {} - virtual ~DNSRR() {} - virtual std::vector data() const = 0; - int ttl_; -}; - -struct DNSAddressRR : public DNSRR { - DNSAddressRR(const std::string& name, int rrtype, int ttl, - const byte* addr, int addrlen) - : DNSRR(name, rrtype, ttl), addr_(addr, addr + addrlen) {} - DNSAddressRR(const std::string& name, int rrtype, int ttl, - const std::vector& addr) - : DNSRR(name, rrtype, ttl), addr_(addr) {} - virtual std::vector data() const; - std::vector addr_; -}; - -struct DNSARR : public DNSAddressRR { - DNSARR(const std::string& name, int ttl, const byte* addr, int addrlen) - : DNSAddressRR(name, T_A, ttl, addr, addrlen) {} - DNSARR(const std::string& name, int ttl, const std::vector& addr) - : DNSAddressRR(name, T_A, ttl, addr) {} -}; - -struct DNSAaaaRR : public DNSAddressRR { - DNSAaaaRR(const std::string& name, int ttl, const byte* addr, int addrlen) - : DNSAddressRR(name, T_AAAA, ttl, addr, addrlen) {} - DNSAaaaRR(const std::string& name, int ttl, const std::vector& addr) - : DNSAddressRR(name, T_AAAA, ttl, addr) {} -}; - -struct DNSSingleNameRR : public DNSRR { - DNSSingleNameRR(const std::string& name, int rrtype, int ttl, - const std::string& other) - : DNSRR(name, rrtype, ttl), other_(other) {} - virtual std::vector data() const; - std::string other_; -}; - -struct DNSCnameRR : public DNSSingleNameRR { - DNSCnameRR(const std::string& name, int ttl, const std::string& other) - : DNSSingleNameRR(name, T_CNAME, ttl, other) {} -}; - -struct DNSNsRR : public DNSSingleNameRR { - DNSNsRR(const std::string& name, int ttl, const std::string& other) - : DNSSingleNameRR(name, T_NS, ttl, other) {} -}; - -struct DNSPtrRR : public DNSSingleNameRR { - DNSPtrRR(const std::string& name, int ttl, const std::string& other) - : DNSSingleNameRR(name, T_PTR, ttl, other) {} -}; - -struct DNSTxtRR : public DNSRR { - DNSTxtRR(const std::string& name, int ttl, const std::vector& txt) - : DNSRR(name, T_TXT, ttl), txt_(txt) {} - virtual std::vector data() const; - std::vector txt_; -}; - -struct DNSMxRR : public DNSRR { - DNSMxRR(const std::string& name, int ttl, int pref, const std::string& other) - : DNSRR(name, T_MX, ttl), pref_(pref), other_(other) {} - virtual std::vector data() const; - int pref_; - std::string other_; -}; - -struct DNSSrvRR : public DNSRR { - DNSSrvRR(const std::string& name, int ttl, - int prio, int weight, int port, const std::string& target) - : DNSRR(name, T_SRV, ttl), prio_(prio), weight_(weight), port_(port), target_(target) {} - virtual std::vector data() const; - int prio_; - int weight_; - int port_; - std::string target_; -}; - -struct DNSUriRR : public DNSRR { - DNSUriRR(const std::string& name, int ttl, - int prio, int weight, const std::string& target) - : DNSRR(name, T_URI, ttl), prio_(prio), weight_(weight), target_(target) {} - virtual std::vector data() const; - int prio_; - int weight_; - std::string target_; -}; - -struct DNSSoaRR : public DNSRR { - DNSSoaRR(const std::string& name, int ttl, - const std::string& nsname, const std::string& rname, - int serial, int refresh, int retry, int expire, int minimum) - : DNSRR(name, T_SOA, ttl), nsname_(nsname), rname_(rname), - serial_(serial), refresh_(refresh), retry_(retry), - expire_(expire), minimum_(minimum) {} - virtual std::vector data() const; - std::string nsname_; - std::string rname_; - int serial_; - int refresh_; - int retry_; - int expire_; - int minimum_; -}; - -struct DNSNaptrRR : public DNSRR { - DNSNaptrRR(const std::string& name, int ttl, - int order, int pref, - const std::string& flags, - const std::string& service, - const std::string& regexp, - const std::string& replacement) - : DNSRR(name, T_NAPTR, ttl), order_(order), pref_(pref), - flags_(flags), service_(service), regexp_(regexp), replacement_(replacement) {} - virtual std::vector data() const; - int order_; - int pref_; - std::string flags_; - std::string service_; - std::string regexp_; - std::string replacement_; -}; - -struct DNSOption { - int code_; - std::vector data_; -}; - -struct DNSOptRR : public DNSRR { - DNSOptRR(int extrcode, int udpsize) - : DNSRR("", T_OPT, static_cast(udpsize), extrcode) {} - virtual std::vector data() const; - std::vector opts_; -}; - -struct DNSPacket { - DNSPacket() - : qid_(0), response_(false), opcode_(O_QUERY), - aa_(false), tc_(false), rd_(false), ra_(false), - z_(false), ad_(false), cd_(false), rcode_(NOERROR) {} - // Convenience functions that take ownership of given pointers. - DNSPacket& add_question(DNSQuestion *q) { - questions_.push_back(std::unique_ptr(q)); - return *this; - } - DNSPacket& add_answer(DNSRR *q) { - answers_.push_back(std::unique_ptr(q)); - return *this; - } - DNSPacket& add_auth(DNSRR *q) { - auths_.push_back(std::unique_ptr(q)); - return *this; - } - DNSPacket& add_additional(DNSRR *q) { - adds_.push_back(std::unique_ptr(q)); - return *this; - } - // Chainable setters. - DNSPacket& set_qid(int qid) { qid_ = qid; return *this; } - DNSPacket& set_response(bool v = true) { response_ = v; return *this; } - DNSPacket& set_aa(bool v = true) { aa_ = v; return *this; } - DNSPacket& set_tc(bool v = true) { tc_ = v; return *this; } - DNSPacket& set_rd(bool v = true) { rd_ = v; return *this; } - DNSPacket& set_ra(bool v = true) { ra_ = v; return *this; } - DNSPacket& set_z(bool v = true) { z_ = v; return *this; } - DNSPacket& set_ad(bool v = true) { ad_ = v; return *this; } - DNSPacket& set_cd(bool v = true) { cd_ = v; return *this; } - DNSPacket& set_rcode(int rcode) { rcode_ = rcode; return *this; } - - // Return the encoded packet. - std::vector data() const; - - int qid_; - bool response_; - int opcode_; - bool aa_; - bool tc_; - bool rd_; - bool ra_; - bool z_; - bool ad_; - bool cd_; - int rcode_; - std::vector> questions_; - std::vector> answers_; - std::vector> auths_; - std::vector> adds_; -}; - -} // namespace ares - -#endif diff --git a/lib/c-ares-1.19.1/test/gmock-1.11.0/gmock-gtest-all.cc b/lib/c-ares-1.19.1/test/gmock-1.11.0/gmock-gtest-all.cc deleted file mode 100644 index 6d86e6ee085..00000000000 --- a/lib/c-ares-1.19.1/test/gmock-1.11.0/gmock-gtest-all.cc +++ /dev/null @@ -1,14463 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// Google C++ Testing and Mocking Framework (Google Test) -// -// Sometimes it's desirable to build Google Test by compiling a single file. -// This file serves this purpose. - -// This line ensures that gtest.h can be compiled on its own, even -// when it's fused. -#include "gtest/gtest.h" - -// The following lines pull in the real gtest *.cc files. -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// The Google C++ Testing and Mocking Framework (Google Test) - -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// Utilities for testing Google Test itself and code that uses Google Test -// (e.g. frameworks built on top of Google Test). - -// GOOGLETEST_CM0004 DO NOT DELETE - -#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_ -#define GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_ - - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// This helper class can be used to mock out Google Test failure reporting -// so that we can test Google Test or code that builds on Google Test. -// -// An object of this class appends a TestPartResult object to the -// TestPartResultArray object given in the constructor whenever a Google Test -// failure is reported. It can either intercept only failures that are -// generated in the same thread that created this object or it can intercept -// all generated failures. The scope of this mock object can be controlled with -// the second argument to the two arguments constructor. -class GTEST_API_ ScopedFakeTestPartResultReporter - : public TestPartResultReporterInterface { - public: - // The two possible mocking modes of this object. - enum InterceptMode { - INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures. - INTERCEPT_ALL_THREADS // Intercepts all failures. - }; - - // The c'tor sets this object as the test part result reporter used - // by Google Test. The 'result' parameter specifies where to report the - // results. This reporter will only catch failures generated in the current - // thread. DEPRECATED - explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result); - - // Same as above, but you can choose the interception scope of this object. - ScopedFakeTestPartResultReporter(InterceptMode intercept_mode, - TestPartResultArray* result); - - // The d'tor restores the previous test part result reporter. - ~ScopedFakeTestPartResultReporter() override; - - // Appends the TestPartResult object to the TestPartResultArray - // received in the constructor. - // - // This method is from the TestPartResultReporterInterface - // interface. - void ReportTestPartResult(const TestPartResult& result) override; - - private: - void Init(); - - const InterceptMode intercept_mode_; - TestPartResultReporterInterface* old_reporter_; - TestPartResultArray* const result_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter); -}; - -namespace internal { - -// A helper class for implementing EXPECT_FATAL_FAILURE() and -// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given -// TestPartResultArray contains exactly one failure that has the given -// type and contains the given substring. If that's not the case, a -// non-fatal failure will be generated. -class GTEST_API_ SingleFailureChecker { - public: - // The constructor remembers the arguments. - SingleFailureChecker(const TestPartResultArray* results, - TestPartResult::Type type, const std::string& substr); - ~SingleFailureChecker(); - private: - const TestPartResultArray* const results_; - const TestPartResult::Type type_; - const std::string substr_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker); -}; - -} // namespace internal - -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -// A set of macros for testing Google Test assertions or code that's expected -// to generate Google Test fatal failures. It verifies that the given -// statement will cause exactly one fatal Google Test failure with 'substr' -// being part of the failure message. -// -// There are two different versions of this macro. EXPECT_FATAL_FAILURE only -// affects and considers failures generated in the current thread and -// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. -// -// The verification of the assertion is done correctly even when the statement -// throws an exception or aborts the current function. -// -// Known restrictions: -// - 'statement' cannot reference local non-static variables or -// non-static members of the current object. -// - 'statement' cannot return a value. -// - You cannot stream a failure message to this macro. -// -// Note that even though the implementations of the following two -// macros are much alike, we cannot refactor them to use a common -// helper macro, due to some peculiarity in how the preprocessor -// works. The AcceptsMacroThatExpandsToUnprotectedComma test in -// gtest_unittest.cc will fail to compile if we do that. -#define EXPECT_FATAL_FAILURE(statement, substr) \ - do { \ - class GTestExpectFatalFailureHelper {\ - public:\ - static void Execute() { statement; }\ - };\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter:: \ - INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ - GTestExpectFatalFailureHelper::Execute();\ - }\ - } while (::testing::internal::AlwaysFalse()) - -#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ - do { \ - class GTestExpectFatalFailureHelper {\ - public:\ - static void Execute() { statement; }\ - };\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter:: \ - INTERCEPT_ALL_THREADS, >est_failures);\ - GTestExpectFatalFailureHelper::Execute();\ - }\ - } while (::testing::internal::AlwaysFalse()) - -// A macro for testing Google Test assertions or code that's expected to -// generate Google Test non-fatal failures. It asserts that the given -// statement will cause exactly one non-fatal Google Test failure with 'substr' -// being part of the failure message. -// -// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only -// affects and considers failures generated in the current thread and -// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. -// -// 'statement' is allowed to reference local variables and members of -// the current object. -// -// The verification of the assertion is done correctly even when the statement -// throws an exception or aborts the current function. -// -// Known restrictions: -// - You cannot stream a failure message to this macro. -// -// Note that even though the implementations of the following two -// macros are much alike, we cannot refactor them to use a common -// helper macro, due to some peculiarity in how the preprocessor -// works. If we do that, the code won't compile when the user gives -// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that -// expands to code containing an unprotected comma. The -// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc -// catches that. -// -// For the same reason, we have to write -// if (::testing::internal::AlwaysTrue()) { statement; } -// instead of -// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) -// to avoid an MSVC warning on unreachable code. -#define EXPECT_NONFATAL_FAILURE(statement, substr) \ - do {\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ - (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter:: \ - INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ - if (::testing::internal::AlwaysTrue()) { statement; }\ - }\ - } while (::testing::internal::AlwaysFalse()) - -#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ - do {\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ - (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ - >est_failures);\ - if (::testing::internal::AlwaysTrue()) { statement; }\ - }\ - } while (::testing::internal::AlwaysFalse()) - -#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include // NOLINT -#include -#include -#include -#include -#include -#include -#include // NOLINT -#include -#include - -#if GTEST_OS_LINUX - -# include // NOLINT -# include // NOLINT -# include // NOLINT -// Declares vsnprintf(). This header is not available on Windows. -# include // NOLINT -# include // NOLINT -# include // NOLINT -# include // NOLINT -# include - -#elif GTEST_OS_ZOS -# include // NOLINT - -// On z/OS we additionally need strings.h for strcasecmp. -# include // NOLINT - -#elif GTEST_OS_WINDOWS_MOBILE // We are on Windows CE. - -# include // NOLINT -# undef min - -#elif GTEST_OS_WINDOWS // We are on Windows proper. - -# include // NOLINT -# undef min - -#ifdef _MSC_VER -# include // NOLINT -#endif - -# include // NOLINT -# include // NOLINT -# include // NOLINT -# include // NOLINT - -# if GTEST_OS_WINDOWS_MINGW -# include // NOLINT -# endif // GTEST_OS_WINDOWS_MINGW - -#else - -// cpplint thinks that the header is already included, so we want to -// silence it. -# include // NOLINT -# include // NOLINT - -#endif // GTEST_OS_LINUX - -#if GTEST_HAS_EXCEPTIONS -# include -#endif - -#if GTEST_CAN_STREAM_RESULTS_ -# include // NOLINT -# include // NOLINT -# include // NOLINT -# include // NOLINT -#endif - -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Utility functions and classes used by the Google C++ testing framework.// -// This file contains purely Google Test's internal implementation. Please -// DO NOT #INCLUDE IT IN A USER PROGRAM. - -#ifndef GOOGLETEST_SRC_GTEST_INTERNAL_INL_H_ -#define GOOGLETEST_SRC_GTEST_INTERNAL_INL_H_ - -#ifndef _WIN32_WCE -# include -#endif // !_WIN32_WCE -#include -#include // For strtoll/_strtoul64/malloc/free. -#include // For memmove. - -#include -#include -#include -#include -#include - - -#if GTEST_CAN_STREAM_RESULTS_ -# include // NOLINT -# include // NOLINT -#endif - -#if GTEST_OS_WINDOWS -# include // NOLINT -#endif // GTEST_OS_WINDOWS - - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// Declares the flags. -// -// We don't want the users to modify this flag in the code, but want -// Google Test's own unit tests to be able to access it. Therefore we -// declare it here as opposed to in gtest.h. -GTEST_DECLARE_bool_(death_test_use_fork); - -namespace internal { - -// The value of GetTestTypeId() as seen from within the Google Test -// library. This is solely for testing GetTestTypeId(). -GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest; - -// Names of the flags (needed for parsing Google Test flags). -const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests"; -const char kBreakOnFailureFlag[] = "break_on_failure"; -const char kCatchExceptionsFlag[] = "catch_exceptions"; -const char kColorFlag[] = "color"; -const char kFailFast[] = "fail_fast"; -const char kFilterFlag[] = "filter"; -const char kListTestsFlag[] = "list_tests"; -const char kOutputFlag[] = "output"; -const char kBriefFlag[] = "brief"; -const char kPrintTimeFlag[] = "print_time"; -const char kPrintUTF8Flag[] = "print_utf8"; -const char kRandomSeedFlag[] = "random_seed"; -const char kRepeatFlag[] = "repeat"; -const char kShuffleFlag[] = "shuffle"; -const char kStackTraceDepthFlag[] = "stack_trace_depth"; -const char kStreamResultToFlag[] = "stream_result_to"; -const char kThrowOnFailureFlag[] = "throw_on_failure"; -const char kFlagfileFlag[] = "flagfile"; - -// A valid random seed must be in [1, kMaxRandomSeed]. -const int kMaxRandomSeed = 99999; - -// g_help_flag is true if and only if the --help flag or an equivalent form -// is specified on the command line. -GTEST_API_ extern bool g_help_flag; - -// Returns the current time in milliseconds. -GTEST_API_ TimeInMillis GetTimeInMillis(); - -// Returns true if and only if Google Test should use colors in the output. -GTEST_API_ bool ShouldUseColor(bool stdout_is_tty); - -// Formats the given time in milliseconds as seconds. -GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms); - -// Converts the given time in milliseconds to a date string in the ISO 8601 -// format, without the timezone information. N.B.: due to the use the -// non-reentrant localtime() function, this function is not thread safe. Do -// not use it in any code that can be called from multiple threads. -GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms); - -// Parses a string for an Int32 flag, in the form of "--flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -GTEST_API_ bool ParseInt32Flag( - const char* str, const char* flag, int32_t* value); - -// Returns a random seed in range [1, kMaxRandomSeed] based on the -// given --gtest_random_seed flag value. -inline int GetRandomSeedFromFlag(int32_t random_seed_flag) { - const unsigned int raw_seed = (random_seed_flag == 0) ? - static_cast(GetTimeInMillis()) : - static_cast(random_seed_flag); - - // Normalizes the actual seed to range [1, kMaxRandomSeed] such that - // it's easy to type. - const int normalized_seed = - static_cast((raw_seed - 1U) % - static_cast(kMaxRandomSeed)) + 1; - return normalized_seed; -} - -// Returns the first valid random seed after 'seed'. The behavior is -// undefined if 'seed' is invalid. The seed after kMaxRandomSeed is -// considered to be 1. -inline int GetNextRandomSeed(int seed) { - GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed) - << "Invalid random seed " << seed << " - must be in [1, " - << kMaxRandomSeed << "]."; - const int next_seed = seed + 1; - return (next_seed > kMaxRandomSeed) ? 1 : next_seed; -} - -// This class saves the values of all Google Test flags in its c'tor, and -// restores them in its d'tor. -class GTestFlagSaver { - public: - // The c'tor. - GTestFlagSaver() { - also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests); - break_on_failure_ = GTEST_FLAG(break_on_failure); - catch_exceptions_ = GTEST_FLAG(catch_exceptions); - color_ = GTEST_FLAG(color); - death_test_style_ = GTEST_FLAG(death_test_style); - death_test_use_fork_ = GTEST_FLAG(death_test_use_fork); - fail_fast_ = GTEST_FLAG(fail_fast); - filter_ = GTEST_FLAG(filter); - internal_run_death_test_ = GTEST_FLAG(internal_run_death_test); - list_tests_ = GTEST_FLAG(list_tests); - output_ = GTEST_FLAG(output); - brief_ = GTEST_FLAG(brief); - print_time_ = GTEST_FLAG(print_time); - print_utf8_ = GTEST_FLAG(print_utf8); - random_seed_ = GTEST_FLAG(random_seed); - repeat_ = GTEST_FLAG(repeat); - shuffle_ = GTEST_FLAG(shuffle); - stack_trace_depth_ = GTEST_FLAG(stack_trace_depth); - stream_result_to_ = GTEST_FLAG(stream_result_to); - throw_on_failure_ = GTEST_FLAG(throw_on_failure); - } - - // The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS. - ~GTestFlagSaver() { - GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_; - GTEST_FLAG(break_on_failure) = break_on_failure_; - GTEST_FLAG(catch_exceptions) = catch_exceptions_; - GTEST_FLAG(color) = color_; - GTEST_FLAG(death_test_style) = death_test_style_; - GTEST_FLAG(death_test_use_fork) = death_test_use_fork_; - GTEST_FLAG(filter) = filter_; - GTEST_FLAG(fail_fast) = fail_fast_; - GTEST_FLAG(internal_run_death_test) = internal_run_death_test_; - GTEST_FLAG(list_tests) = list_tests_; - GTEST_FLAG(output) = output_; - GTEST_FLAG(brief) = brief_; - GTEST_FLAG(print_time) = print_time_; - GTEST_FLAG(print_utf8) = print_utf8_; - GTEST_FLAG(random_seed) = random_seed_; - GTEST_FLAG(repeat) = repeat_; - GTEST_FLAG(shuffle) = shuffle_; - GTEST_FLAG(stack_trace_depth) = stack_trace_depth_; - GTEST_FLAG(stream_result_to) = stream_result_to_; - GTEST_FLAG(throw_on_failure) = throw_on_failure_; - } - - private: - // Fields for saving the original values of flags. - bool also_run_disabled_tests_; - bool break_on_failure_; - bool catch_exceptions_; - std::string color_; - std::string death_test_style_; - bool death_test_use_fork_; - bool fail_fast_; - std::string filter_; - std::string internal_run_death_test_; - bool list_tests_; - std::string output_; - bool brief_; - bool print_time_; - bool print_utf8_; - int32_t random_seed_; - int32_t repeat_; - bool shuffle_; - int32_t stack_trace_depth_; - std::string stream_result_to_; - bool throw_on_failure_; -} GTEST_ATTRIBUTE_UNUSED_; - -// Converts a Unicode code point to a narrow string in UTF-8 encoding. -// code_point parameter is of type UInt32 because wchar_t may not be -// wide enough to contain a code point. -// If the code_point is not a valid Unicode code point -// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted -// to "(Invalid Unicode 0xXXXXXXXX)". -GTEST_API_ std::string CodePointToUtf8(uint32_t code_point); - -// Converts a wide string to a narrow string in UTF-8 encoding. -// The wide string is assumed to have the following encoding: -// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin) -// UTF-32 if sizeof(wchar_t) == 4 (on Linux) -// Parameter str points to a null-terminated wide string. -// Parameter num_chars may additionally limit the number -// of wchar_t characters processed. -1 is used when the entire string -// should be processed. -// If the string contains code points that are not valid Unicode code points -// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output -// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding -// and contains invalid UTF-16 surrogate pairs, values in those pairs -// will be encoded as individual Unicode characters from Basic Normal Plane. -GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars); - -// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file -// if the variable is present. If a file already exists at this location, this -// function will write over it. If the variable is present, but the file cannot -// be created, prints an error and exits. -void WriteToShardStatusFileIfNeeded(); - -// Checks whether sharding is enabled by examining the relevant -// environment variable values. If the variables are present, -// but inconsistent (e.g., shard_index >= total_shards), prints -// an error and exits. If in_subprocess_for_death_test, sharding is -// disabled because it must only be applied to the original test -// process. Otherwise, we could filter out death tests we intended to execute. -GTEST_API_ bool ShouldShard(const char* total_shards_str, - const char* shard_index_str, - bool in_subprocess_for_death_test); - -// Parses the environment variable var as a 32-bit integer. If it is unset, -// returns default_val. If it is not a 32-bit integer, prints an error and -// and aborts. -GTEST_API_ int32_t Int32FromEnvOrDie(const char* env_var, int32_t default_val); - -// Given the total number of shards, the shard index, and the test id, -// returns true if and only if the test should be run on this shard. The test id -// is some arbitrary but unique non-negative integer assigned to each test -// method. Assumes that 0 <= shard_index < total_shards. -GTEST_API_ bool ShouldRunTestOnShard( - int total_shards, int shard_index, int test_id); - -// STL container utilities. - -// Returns the number of elements in the given container that satisfy -// the given predicate. -template -inline int CountIf(const Container& c, Predicate predicate) { - // Implemented as an explicit loop since std::count_if() in libCstd on - // Solaris has a non-standard signature. - int count = 0; - for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) { - if (predicate(*it)) - ++count; - } - return count; -} - -// Applies a function/functor to each element in the container. -template -void ForEach(const Container& c, Functor functor) { - std::for_each(c.begin(), c.end(), functor); -} - -// Returns the i-th element of the vector, or default_value if i is not -// in range [0, v.size()). -template -inline E GetElementOr(const std::vector& v, int i, E default_value) { - return (i < 0 || i >= static_cast(v.size())) ? default_value - : v[static_cast(i)]; -} - -// Performs an in-place shuffle of a range of the vector's elements. -// 'begin' and 'end' are element indices as an STL-style range; -// i.e. [begin, end) are shuffled, where 'end' == size() means to -// shuffle to the end of the vector. -template -void ShuffleRange(internal::Random* random, int begin, int end, - std::vector* v) { - const int size = static_cast(v->size()); - GTEST_CHECK_(0 <= begin && begin <= size) - << "Invalid shuffle range start " << begin << ": must be in range [0, " - << size << "]."; - GTEST_CHECK_(begin <= end && end <= size) - << "Invalid shuffle range finish " << end << ": must be in range [" - << begin << ", " << size << "]."; - - // Fisher-Yates shuffle, from - // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle - for (int range_width = end - begin; range_width >= 2; range_width--) { - const int last_in_range = begin + range_width - 1; - const int selected = - begin + - static_cast(random->Generate(static_cast(range_width))); - std::swap((*v)[static_cast(selected)], - (*v)[static_cast(last_in_range)]); - } -} - -// Performs an in-place shuffle of the vector's elements. -template -inline void Shuffle(internal::Random* random, std::vector* v) { - ShuffleRange(random, 0, static_cast(v->size()), v); -} - -// A function for deleting an object. Handy for being used as a -// functor. -template -static void Delete(T* x) { - delete x; -} - -// A predicate that checks the key of a TestProperty against a known key. -// -// TestPropertyKeyIs is copyable. -class TestPropertyKeyIs { - public: - // Constructor. - // - // TestPropertyKeyIs has NO default constructor. - explicit TestPropertyKeyIs(const std::string& key) : key_(key) {} - - // Returns true if and only if the test name of test property matches on key_. - bool operator()(const TestProperty& test_property) const { - return test_property.key() == key_; - } - - private: - std::string key_; -}; - -// Class UnitTestOptions. -// -// This class contains functions for processing options the user -// specifies when running the tests. It has only static members. -// -// In most cases, the user can specify an option using either an -// environment variable or a command line flag. E.g. you can set the -// test filter using either GTEST_FILTER or --gtest_filter. If both -// the variable and the flag are present, the latter overrides the -// former. -class GTEST_API_ UnitTestOptions { - public: - // Functions for processing the gtest_output flag. - - // Returns the output format, or "" for normal printed output. - static std::string GetOutputFormat(); - - // Returns the absolute path of the requested output file, or the - // default (test_detail.xml in the original working directory) if - // none was explicitly specified. - static std::string GetAbsolutePathToOutputFile(); - - // Functions for processing the gtest_filter flag. - - // Returns true if and only if the user-specified filter matches the test - // suite name and the test name. - static bool FilterMatchesTest(const std::string& test_suite_name, - const std::string& test_name); - -#if GTEST_OS_WINDOWS - // Function for supporting the gtest_catch_exception flag. - - // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the - // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise. - // This function is useful as an __except condition. - static int GTestShouldProcessSEH(DWORD exception_code); -#endif // GTEST_OS_WINDOWS - - // Returns true if "name" matches the ':' separated list of glob-style - // filters in "filter". - static bool MatchesFilter(const std::string& name, const char* filter); -}; - -// Returns the current application's name, removing directory path if that -// is present. Used by UnitTestOptions::GetOutputFile. -GTEST_API_ FilePath GetCurrentExecutableName(); - -// The role interface for getting the OS stack trace as a string. -class OsStackTraceGetterInterface { - public: - OsStackTraceGetterInterface() {} - virtual ~OsStackTraceGetterInterface() {} - - // Returns the current OS stack trace as an std::string. Parameters: - // - // max_depth - the maximum number of stack frames to be included - // in the trace. - // skip_count - the number of top frames to be skipped; doesn't count - // against max_depth. - virtual std::string CurrentStackTrace(int max_depth, int skip_count) = 0; - - // UponLeavingGTest() should be called immediately before Google Test calls - // user code. It saves some information about the current stack that - // CurrentStackTrace() will use to find and hide Google Test stack frames. - virtual void UponLeavingGTest() = 0; - - // This string is inserted in place of stack frames that are part of - // Google Test's implementation. - static const char* const kElidedFramesMarker; - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface); -}; - -// A working implementation of the OsStackTraceGetterInterface interface. -class OsStackTraceGetter : public OsStackTraceGetterInterface { - public: - OsStackTraceGetter() {} - - std::string CurrentStackTrace(int max_depth, int skip_count) override; - void UponLeavingGTest() override; - - private: -#if GTEST_HAS_ABSL - Mutex mutex_; // Protects all internal state. - - // We save the stack frame below the frame that calls user code. - // We do this because the address of the frame immediately below - // the user code changes between the call to UponLeavingGTest() - // and any calls to the stack trace code from within the user code. - void* caller_frame_ = nullptr; -#endif // GTEST_HAS_ABSL - - GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter); -}; - -// Information about a Google Test trace point. -struct TraceInfo { - const char* file; - int line; - std::string message; -}; - -// This is the default global test part result reporter used in UnitTestImpl. -// This class should only be used by UnitTestImpl. -class DefaultGlobalTestPartResultReporter - : public TestPartResultReporterInterface { - public: - explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test); - // Implements the TestPartResultReporterInterface. Reports the test part - // result in the current test. - void ReportTestPartResult(const TestPartResult& result) override; - - private: - UnitTestImpl* const unit_test_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter); -}; - -// This is the default per thread test part result reporter used in -// UnitTestImpl. This class should only be used by UnitTestImpl. -class DefaultPerThreadTestPartResultReporter - : public TestPartResultReporterInterface { - public: - explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test); - // Implements the TestPartResultReporterInterface. The implementation just - // delegates to the current global test part result reporter of *unit_test_. - void ReportTestPartResult(const TestPartResult& result) override; - - private: - UnitTestImpl* const unit_test_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter); -}; - -// The private implementation of the UnitTest class. We don't protect -// the methods under a mutex, as this class is not accessible by a -// user and the UnitTest class that delegates work to this class does -// proper locking. -class GTEST_API_ UnitTestImpl { - public: - explicit UnitTestImpl(UnitTest* parent); - virtual ~UnitTestImpl(); - - // There are two different ways to register your own TestPartResultReporter. - // You can register your own repoter to listen either only for test results - // from the current thread or for results from all threads. - // By default, each per-thread test result repoter just passes a new - // TestPartResult to the global test result reporter, which registers the - // test part result for the currently running test. - - // Returns the global test part result reporter. - TestPartResultReporterInterface* GetGlobalTestPartResultReporter(); - - // Sets the global test part result reporter. - void SetGlobalTestPartResultReporter( - TestPartResultReporterInterface* reporter); - - // Returns the test part result reporter for the current thread. - TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread(); - - // Sets the test part result reporter for the current thread. - void SetTestPartResultReporterForCurrentThread( - TestPartResultReporterInterface* reporter); - - // Gets the number of successful test suites. - int successful_test_suite_count() const; - - // Gets the number of failed test suites. - int failed_test_suite_count() const; - - // Gets the number of all test suites. - int total_test_suite_count() const; - - // Gets the number of all test suites that contain at least one test - // that should run. - int test_suite_to_run_count() const; - - // Gets the number of successful tests. - int successful_test_count() const; - - // Gets the number of skipped tests. - int skipped_test_count() const; - - // Gets the number of failed tests. - int failed_test_count() const; - - // Gets the number of disabled tests that will be reported in the XML report. - int reportable_disabled_test_count() const; - - // Gets the number of disabled tests. - int disabled_test_count() const; - - // Gets the number of tests to be printed in the XML report. - int reportable_test_count() const; - - // Gets the number of all tests. - int total_test_count() const; - - // Gets the number of tests that should run. - int test_to_run_count() const; - - // Gets the time of the test program start, in ms from the start of the - // UNIX epoch. - TimeInMillis start_timestamp() const { return start_timestamp_; } - - // Gets the elapsed time, in milliseconds. - TimeInMillis elapsed_time() const { return elapsed_time_; } - - // Returns true if and only if the unit test passed (i.e. all test suites - // passed). - bool Passed() const { return !Failed(); } - - // Returns true if and only if the unit test failed (i.e. some test suite - // failed or something outside of all tests failed). - bool Failed() const { - return failed_test_suite_count() > 0 || ad_hoc_test_result()->Failed(); - } - - // Gets the i-th test suite among all the test suites. i can range from 0 to - // total_test_suite_count() - 1. If i is not in that range, returns NULL. - const TestSuite* GetTestSuite(int i) const { - const int index = GetElementOr(test_suite_indices_, i, -1); - return index < 0 ? nullptr : test_suites_[static_cast(i)]; - } - - // Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - const TestCase* GetTestCase(int i) const { return GetTestSuite(i); } -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Gets the i-th test suite among all the test suites. i can range from 0 to - // total_test_suite_count() - 1. If i is not in that range, returns NULL. - TestSuite* GetMutableSuiteCase(int i) { - const int index = GetElementOr(test_suite_indices_, i, -1); - return index < 0 ? nullptr : test_suites_[static_cast(index)]; - } - - // Provides access to the event listener list. - TestEventListeners* listeners() { return &listeners_; } - - // Returns the TestResult for the test that's currently running, or - // the TestResult for the ad hoc test if no test is running. - TestResult* current_test_result(); - - // Returns the TestResult for the ad hoc test. - const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; } - - // Sets the OS stack trace getter. - // - // Does nothing if the input and the current OS stack trace getter - // are the same; otherwise, deletes the old getter and makes the - // input the current getter. - void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter); - - // Returns the current OS stack trace getter if it is not NULL; - // otherwise, creates an OsStackTraceGetter, makes it the current - // getter, and returns it. - OsStackTraceGetterInterface* os_stack_trace_getter(); - - // Returns the current OS stack trace as an std::string. - // - // The maximum number of stack frames to be included is specified by - // the gtest_stack_trace_depth flag. The skip_count parameter - // specifies the number of top frames to be skipped, which doesn't - // count against the number of frames to be included. - // - // For example, if Foo() calls Bar(), which in turn calls - // CurrentOsStackTraceExceptTop(1), Foo() will be included in the - // trace but Bar() and CurrentOsStackTraceExceptTop() won't. - std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_; - - // Finds and returns a TestSuite with the given name. If one doesn't - // exist, creates one and returns it. - // - // Arguments: - // - // test_suite_name: name of the test suite - // type_param: the name of the test's type parameter, or NULL if - // this is not a typed or a type-parameterized test. - // set_up_tc: pointer to the function that sets up the test suite - // tear_down_tc: pointer to the function that tears down the test suite - TestSuite* GetTestSuite(const char* test_suite_name, const char* type_param, - internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc); - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - TestCase* GetTestCase(const char* test_case_name, const char* type_param, - internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc) { - return GetTestSuite(test_case_name, type_param, set_up_tc, tear_down_tc); - } -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Adds a TestInfo to the unit test. - // - // Arguments: - // - // set_up_tc: pointer to the function that sets up the test suite - // tear_down_tc: pointer to the function that tears down the test suite - // test_info: the TestInfo object - void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc, - TestInfo* test_info) { -#if GTEST_HAS_DEATH_TEST - // In order to support thread-safe death tests, we need to - // remember the original working directory when the test program - // was first invoked. We cannot do this in RUN_ALL_TESTS(), as - // the user may have changed the current directory before calling - // RUN_ALL_TESTS(). Therefore we capture the current directory in - // AddTestInfo(), which is called to register a TEST or TEST_F - // before main() is reached. - if (original_working_dir_.IsEmpty()) { - original_working_dir_.Set(FilePath::GetCurrentDir()); - GTEST_CHECK_(!original_working_dir_.IsEmpty()) - << "Failed to get the current working directory."; - } -#endif // GTEST_HAS_DEATH_TEST - - GetTestSuite(test_info->test_suite_name(), test_info->type_param(), - set_up_tc, tear_down_tc) - ->AddTestInfo(test_info); - } - - // Returns ParameterizedTestSuiteRegistry object used to keep track of - // value-parameterized tests and instantiate and register them. - internal::ParameterizedTestSuiteRegistry& parameterized_test_registry() { - return parameterized_test_registry_; - } - - std::set* ignored_parameterized_test_suites() { - return &ignored_parameterized_test_suites_; - } - - // Returns TypeParameterizedTestSuiteRegistry object used to keep track of - // type-parameterized tests and instantiations of them. - internal::TypeParameterizedTestSuiteRegistry& - type_parameterized_test_registry() { - return type_parameterized_test_registry_; - } - - // Sets the TestSuite object for the test that's currently running. - void set_current_test_suite(TestSuite* a_current_test_suite) { - current_test_suite_ = a_current_test_suite; - } - - // Sets the TestInfo object for the test that's currently running. If - // current_test_info is NULL, the assertion results will be stored in - // ad_hoc_test_result_. - void set_current_test_info(TestInfo* a_current_test_info) { - current_test_info_ = a_current_test_info; - } - - // Registers all parameterized tests defined using TEST_P and - // INSTANTIATE_TEST_SUITE_P, creating regular tests for each test/parameter - // combination. This method can be called more then once; it has guards - // protecting from registering the tests more then once. If - // value-parameterized tests are disabled, RegisterParameterizedTests is - // present but does nothing. - void RegisterParameterizedTests(); - - // Runs all tests in this UnitTest object, prints the result, and - // returns true if all tests are successful. If any exception is - // thrown during a test, this test is considered to be failed, but - // the rest of the tests will still be run. - bool RunAllTests(); - - // Clears the results of all tests, except the ad hoc tests. - void ClearNonAdHocTestResult() { - ForEach(test_suites_, TestSuite::ClearTestSuiteResult); - } - - // Clears the results of ad-hoc test assertions. - void ClearAdHocTestResult() { - ad_hoc_test_result_.Clear(); - } - - // Adds a TestProperty to the current TestResult object when invoked in a - // context of a test or a test suite, or to the global property set. If the - // result already contains a property with the same key, the value will be - // updated. - void RecordProperty(const TestProperty& test_property); - - enum ReactionToSharding { - HONOR_SHARDING_PROTOCOL, - IGNORE_SHARDING_PROTOCOL - }; - - // Matches the full name of each test against the user-specified - // filter to decide whether the test should run, then records the - // result in each TestSuite and TestInfo object. - // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests - // based on sharding variables in the environment. - // Returns the number of tests that should run. - int FilterTests(ReactionToSharding shard_tests); - - // Prints the names of the tests matching the user-specified filter flag. - void ListTestsMatchingFilter(); - - const TestSuite* current_test_suite() const { return current_test_suite_; } - TestInfo* current_test_info() { return current_test_info_; } - const TestInfo* current_test_info() const { return current_test_info_; } - - // Returns the vector of environments that need to be set-up/torn-down - // before/after the tests are run. - std::vector& environments() { return environments_; } - - // Getters for the per-thread Google Test trace stack. - std::vector& gtest_trace_stack() { - return *(gtest_trace_stack_.pointer()); - } - const std::vector& gtest_trace_stack() const { - return gtest_trace_stack_.get(); - } - -#if GTEST_HAS_DEATH_TEST - void InitDeathTestSubprocessControlInfo() { - internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag()); - } - // Returns a pointer to the parsed --gtest_internal_run_death_test - // flag, or NULL if that flag was not specified. - // This information is useful only in a death test child process. - // Must not be called before a call to InitGoogleTest. - const InternalRunDeathTestFlag* internal_run_death_test_flag() const { - return internal_run_death_test_flag_.get(); - } - - // Returns a pointer to the current death test factory. - internal::DeathTestFactory* death_test_factory() { - return death_test_factory_.get(); - } - - void SuppressTestEventsIfInSubprocess(); - - friend class ReplaceDeathTestFactory; -#endif // GTEST_HAS_DEATH_TEST - - // Initializes the event listener performing XML output as specified by - // UnitTestOptions. Must not be called before InitGoogleTest. - void ConfigureXmlOutput(); - -#if GTEST_CAN_STREAM_RESULTS_ - // Initializes the event listener for streaming test results to a socket. - // Must not be called before InitGoogleTest. - void ConfigureStreamingOutput(); -#endif - - // Performs initialization dependent upon flag values obtained in - // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to - // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest - // this function is also called from RunAllTests. Since this function can be - // called more than once, it has to be idempotent. - void PostFlagParsingInit(); - - // Gets the random seed used at the start of the current test iteration. - int random_seed() const { return random_seed_; } - - // Gets the random number generator. - internal::Random* random() { return &random_; } - - // Shuffles all test suites, and the tests within each test suite, - // making sure that death tests are still run first. - void ShuffleTests(); - - // Restores the test suites and tests to their order before the first shuffle. - void UnshuffleTests(); - - // Returns the value of GTEST_FLAG(catch_exceptions) at the moment - // UnitTest::Run() starts. - bool catch_exceptions() const { return catch_exceptions_; } - - private: - friend class ::testing::UnitTest; - - // Used by UnitTest::Run() to capture the state of - // GTEST_FLAG(catch_exceptions) at the moment it starts. - void set_catch_exceptions(bool value) { catch_exceptions_ = value; } - - // The UnitTest object that owns this implementation object. - UnitTest* const parent_; - - // The working directory when the first TEST() or TEST_F() was - // executed. - internal::FilePath original_working_dir_; - - // The default test part result reporters. - DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_; - DefaultPerThreadTestPartResultReporter - default_per_thread_test_part_result_reporter_; - - // Points to (but doesn't own) the global test part result reporter. - TestPartResultReporterInterface* global_test_part_result_repoter_; - - // Protects read and write access to global_test_part_result_reporter_. - internal::Mutex global_test_part_result_reporter_mutex_; - - // Points to (but doesn't own) the per-thread test part result reporter. - internal::ThreadLocal - per_thread_test_part_result_reporter_; - - // The vector of environments that need to be set-up/torn-down - // before/after the tests are run. - std::vector environments_; - - // The vector of TestSuites in their original order. It owns the - // elements in the vector. - std::vector test_suites_; - - // Provides a level of indirection for the test suite list to allow - // easy shuffling and restoring the test suite order. The i-th - // element of this vector is the index of the i-th test suite in the - // shuffled order. - std::vector test_suite_indices_; - - // ParameterizedTestRegistry object used to register value-parameterized - // tests. - internal::ParameterizedTestSuiteRegistry parameterized_test_registry_; - internal::TypeParameterizedTestSuiteRegistry - type_parameterized_test_registry_; - - // The set holding the name of parameterized - // test suites that may go uninstantiated. - std::set ignored_parameterized_test_suites_; - - // Indicates whether RegisterParameterizedTests() has been called already. - bool parameterized_tests_registered_; - - // Index of the last death test suite registered. Initially -1. - int last_death_test_suite_; - - // This points to the TestSuite for the currently running test. It - // changes as Google Test goes through one test suite after another. - // When no test is running, this is set to NULL and Google Test - // stores assertion results in ad_hoc_test_result_. Initially NULL. - TestSuite* current_test_suite_; - - // This points to the TestInfo for the currently running test. It - // changes as Google Test goes through one test after another. When - // no test is running, this is set to NULL and Google Test stores - // assertion results in ad_hoc_test_result_. Initially NULL. - TestInfo* current_test_info_; - - // Normally, a user only writes assertions inside a TEST or TEST_F, - // or inside a function called by a TEST or TEST_F. Since Google - // Test keeps track of which test is current running, it can - // associate such an assertion with the test it belongs to. - // - // If an assertion is encountered when no TEST or TEST_F is running, - // Google Test attributes the assertion result to an imaginary "ad hoc" - // test, and records the result in ad_hoc_test_result_. - TestResult ad_hoc_test_result_; - - // The list of event listeners that can be used to track events inside - // Google Test. - TestEventListeners listeners_; - - // The OS stack trace getter. Will be deleted when the UnitTest - // object is destructed. By default, an OsStackTraceGetter is used, - // but the user can set this field to use a custom getter if that is - // desired. - OsStackTraceGetterInterface* os_stack_trace_getter_; - - // True if and only if PostFlagParsingInit() has been called. - bool post_flag_parse_init_performed_; - - // The random number seed used at the beginning of the test run. - int random_seed_; - - // Our random number generator. - internal::Random random_; - - // The time of the test program start, in ms from the start of the - // UNIX epoch. - TimeInMillis start_timestamp_; - - // How long the test took to run, in milliseconds. - TimeInMillis elapsed_time_; - -#if GTEST_HAS_DEATH_TEST - // The decomposed components of the gtest_internal_run_death_test flag, - // parsed when RUN_ALL_TESTS is called. - std::unique_ptr internal_run_death_test_flag_; - std::unique_ptr death_test_factory_; -#endif // GTEST_HAS_DEATH_TEST - - // A per-thread stack of traces created by the SCOPED_TRACE() macro. - internal::ThreadLocal > gtest_trace_stack_; - - // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests() - // starts. - bool catch_exceptions_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl); -}; // class UnitTestImpl - -// Convenience function for accessing the global UnitTest -// implementation object. -inline UnitTestImpl* GetUnitTestImpl() { - return UnitTest::GetInstance()->impl(); -} - -#if GTEST_USES_SIMPLE_RE - -// Internal helper functions for implementing the simple regular -// expression matcher. -GTEST_API_ bool IsInSet(char ch, const char* str); -GTEST_API_ bool IsAsciiDigit(char ch); -GTEST_API_ bool IsAsciiPunct(char ch); -GTEST_API_ bool IsRepeat(char ch); -GTEST_API_ bool IsAsciiWhiteSpace(char ch); -GTEST_API_ bool IsAsciiWordChar(char ch); -GTEST_API_ bool IsValidEscape(char ch); -GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch); -GTEST_API_ bool ValidateRegex(const char* regex); -GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str); -GTEST_API_ bool MatchRepetitionAndRegexAtHead( - bool escaped, char ch, char repeat, const char* regex, const char* str); -GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str); - -#endif // GTEST_USES_SIMPLE_RE - -// Parses the command line for Google Test flags, without initializing -// other parts of Google Test. -GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv); -GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv); - -#if GTEST_HAS_DEATH_TEST - -// Returns the message describing the last system error, regardless of the -// platform. -GTEST_API_ std::string GetLastErrnoDescription(); - -// Attempts to parse a string into a positive integer pointed to by the -// number parameter. Returns true if that is possible. -// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use -// it here. -template -bool ParseNaturalNumber(const ::std::string& str, Integer* number) { - // Fail fast if the given string does not begin with a digit; - // this bypasses strtoXXX's "optional leading whitespace and plus - // or minus sign" semantics, which are undesirable here. - if (str.empty() || !IsDigit(str[0])) { - return false; - } - errno = 0; - - char* end; - // BiggestConvertible is the largest integer type that system-provided - // string-to-number conversion routines can return. - using BiggestConvertible = unsigned long long; // NOLINT - - const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10); // NOLINT - const bool parse_success = *end == '\0' && errno == 0; - - GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed)); - - const Integer result = static_cast(parsed); - if (parse_success && static_cast(result) == parsed) { - *number = result; - return true; - } - return false; -} -#endif // GTEST_HAS_DEATH_TEST - -// TestResult contains some private methods that should be hidden from -// Google Test user but are required for testing. This class allow our tests -// to access them. -// -// This class is supplied only for the purpose of testing Google Test's own -// constructs. Do not use it in user tests, either directly or indirectly. -class TestResultAccessor { - public: - static void RecordProperty(TestResult* test_result, - const std::string& xml_element, - const TestProperty& property) { - test_result->RecordProperty(xml_element, property); - } - - static void ClearTestPartResults(TestResult* test_result) { - test_result->ClearTestPartResults(); - } - - static const std::vector& test_part_results( - const TestResult& test_result) { - return test_result.test_part_results(); - } -}; - -#if GTEST_CAN_STREAM_RESULTS_ - -// Streams test results to the given port on the given host machine. -class StreamingListener : public EmptyTestEventListener { - public: - // Abstract base class for writing strings to a socket. - class AbstractSocketWriter { - public: - virtual ~AbstractSocketWriter() {} - - // Sends a string to the socket. - virtual void Send(const std::string& message) = 0; - - // Closes the socket. - virtual void CloseConnection() {} - - // Sends a string and a newline to the socket. - void SendLn(const std::string& message) { Send(message + "\n"); } - }; - - // Concrete class for actually writing strings to a socket. - class SocketWriter : public AbstractSocketWriter { - public: - SocketWriter(const std::string& host, const std::string& port) - : sockfd_(-1), host_name_(host), port_num_(port) { - MakeConnection(); - } - - ~SocketWriter() override { - if (sockfd_ != -1) - CloseConnection(); - } - - // Sends a string to the socket. - void Send(const std::string& message) override { - GTEST_CHECK_(sockfd_ != -1) - << "Send() can be called only when there is a connection."; - - const auto len = static_cast(message.length()); - if (write(sockfd_, message.c_str(), len) != static_cast(len)) { - GTEST_LOG_(WARNING) - << "stream_result_to: failed to stream to " - << host_name_ << ":" << port_num_; - } - } - - private: - // Creates a client socket and connects to the server. - void MakeConnection(); - - // Closes the socket. - void CloseConnection() override { - GTEST_CHECK_(sockfd_ != -1) - << "CloseConnection() can be called only when there is a connection."; - - close(sockfd_); - sockfd_ = -1; - } - - int sockfd_; // socket file descriptor - const std::string host_name_; - const std::string port_num_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter); - }; // class SocketWriter - - // Escapes '=', '&', '%', and '\n' characters in str as "%xx". - static std::string UrlEncode(const char* str); - - StreamingListener(const std::string& host, const std::string& port) - : socket_writer_(new SocketWriter(host, port)) { - Start(); - } - - explicit StreamingListener(AbstractSocketWriter* socket_writer) - : socket_writer_(socket_writer) { Start(); } - - void OnTestProgramStart(const UnitTest& /* unit_test */) override { - SendLn("event=TestProgramStart"); - } - - void OnTestProgramEnd(const UnitTest& unit_test) override { - // Note that Google Test current only report elapsed time for each - // test iteration, not for the entire test program. - SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed())); - - // Notify the streaming server to stop. - socket_writer_->CloseConnection(); - } - - void OnTestIterationStart(const UnitTest& /* unit_test */, - int iteration) override { - SendLn("event=TestIterationStart&iteration=" + - StreamableToString(iteration)); - } - - void OnTestIterationEnd(const UnitTest& unit_test, - int /* iteration */) override { - SendLn("event=TestIterationEnd&passed=" + - FormatBool(unit_test.Passed()) + "&elapsed_time=" + - StreamableToString(unit_test.elapsed_time()) + "ms"); - } - - // Note that "event=TestCaseStart" is a wire format and has to remain - // "case" for compatibility - void OnTestCaseStart(const TestCase& test_case) override { - SendLn(std::string("event=TestCaseStart&name=") + test_case.name()); - } - - // Note that "event=TestCaseEnd" is a wire format and has to remain - // "case" for compatibility - void OnTestCaseEnd(const TestCase& test_case) override { - SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed()) + - "&elapsed_time=" + StreamableToString(test_case.elapsed_time()) + - "ms"); - } - - void OnTestStart(const TestInfo& test_info) override { - SendLn(std::string("event=TestStart&name=") + test_info.name()); - } - - void OnTestEnd(const TestInfo& test_info) override { - SendLn("event=TestEnd&passed=" + - FormatBool((test_info.result())->Passed()) + - "&elapsed_time=" + - StreamableToString((test_info.result())->elapsed_time()) + "ms"); - } - - void OnTestPartResult(const TestPartResult& test_part_result) override { - const char* file_name = test_part_result.file_name(); - if (file_name == nullptr) file_name = ""; - SendLn("event=TestPartResult&file=" + UrlEncode(file_name) + - "&line=" + StreamableToString(test_part_result.line_number()) + - "&message=" + UrlEncode(test_part_result.message())); - } - - private: - // Sends the given message and a newline to the socket. - void SendLn(const std::string& message) { socket_writer_->SendLn(message); } - - // Called at the start of streaming to notify the receiver what - // protocol we are using. - void Start() { SendLn("gtest_streaming_protocol_version=1.0"); } - - std::string FormatBool(bool value) { return value ? "1" : "0"; } - - const std::unique_ptr socket_writer_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener); -}; // class StreamingListener - -#endif // GTEST_CAN_STREAM_RESULTS_ - -} // namespace internal -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -#endif // GOOGLETEST_SRC_GTEST_INTERNAL_INL_H_ - -#if GTEST_OS_WINDOWS -# define vsnprintf _vsnprintf -#endif // GTEST_OS_WINDOWS - -#if GTEST_OS_MAC -#ifndef GTEST_OS_IOS -#include -#endif -#endif - -#if GTEST_HAS_ABSL -#include "absl/debugging/failure_signal_handler.h" -#include "absl/debugging/stacktrace.h" -#include "absl/debugging/symbolize.h" -#include "absl/strings/str_cat.h" -#endif // GTEST_HAS_ABSL - -namespace testing { - -using internal::CountIf; -using internal::ForEach; -using internal::GetElementOr; -using internal::Shuffle; - -// Constants. - -// A test whose test suite name or test name matches this filter is -// disabled and not run. -static const char kDisableTestFilter[] = "DISABLED_*:*/DISABLED_*"; - -// A test suite whose name matches this filter is considered a death -// test suite and will be run before test suites whose name doesn't -// match this filter. -static const char kDeathTestSuiteFilter[] = "*DeathTest:*DeathTest/*"; - -// A test filter that matches everything. -static const char kUniversalFilter[] = "*"; - -// The default output format. -static const char kDefaultOutputFormat[] = "xml"; -// The default output file. -static const char kDefaultOutputFile[] = "test_detail"; - -// The environment variable name for the test shard index. -static const char kTestShardIndex[] = "GTEST_SHARD_INDEX"; -// The environment variable name for the total number of test shards. -static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS"; -// The environment variable name for the test shard status file. -static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE"; - -namespace internal { - -// The text used in failure messages to indicate the start of the -// stack trace. -const char kStackTraceMarker[] = "\nStack trace:\n"; - -// g_help_flag is true if and only if the --help flag or an equivalent form -// is specified on the command line. -bool g_help_flag = false; - -// Utilty function to Open File for Writing -static FILE* OpenFileForWriting(const std::string& output_file) { - FILE* fileout = nullptr; - FilePath output_file_path(output_file); - FilePath output_dir(output_file_path.RemoveFileName()); - - if (output_dir.CreateDirectoriesRecursively()) { - fileout = posix::FOpen(output_file.c_str(), "w"); - } - if (fileout == nullptr) { - GTEST_LOG_(FATAL) << "Unable to open file \"" << output_file << "\""; - } - return fileout; -} - -} // namespace internal - -// Bazel passes in the argument to '--test_filter' via the TESTBRIDGE_TEST_ONLY -// environment variable. -static const char* GetDefaultFilter() { - const char* const testbridge_test_only = - internal::posix::GetEnv("TESTBRIDGE_TEST_ONLY"); - if (testbridge_test_only != nullptr) { - return testbridge_test_only; - } - return kUniversalFilter; -} - -// Bazel passes in the argument to '--test_runner_fail_fast' via the -// TESTBRIDGE_TEST_RUNNER_FAIL_FAST environment variable. -static bool GetDefaultFailFast() { - const char* const testbridge_test_runner_fail_fast = - internal::posix::GetEnv("TESTBRIDGE_TEST_RUNNER_FAIL_FAST"); - if (testbridge_test_runner_fail_fast != nullptr) { - return strcmp(testbridge_test_runner_fail_fast, "1") == 0; - } - return false; -} - -GTEST_DEFINE_bool_( - fail_fast, internal::BoolFromGTestEnv("fail_fast", GetDefaultFailFast()), - "True if and only if a test failure should stop further test execution."); - -GTEST_DEFINE_bool_( - also_run_disabled_tests, - internal::BoolFromGTestEnv("also_run_disabled_tests", false), - "Run disabled tests too, in addition to the tests normally being run."); - -GTEST_DEFINE_bool_( - break_on_failure, internal::BoolFromGTestEnv("break_on_failure", false), - "True if and only if a failed assertion should be a debugger " - "break-point."); - -GTEST_DEFINE_bool_(catch_exceptions, - internal::BoolFromGTestEnv("catch_exceptions", true), - "True if and only if " GTEST_NAME_ - " should catch exceptions and treat them as test failures."); - -GTEST_DEFINE_string_( - color, - internal::StringFromGTestEnv("color", "auto"), - "Whether to use colors in the output. Valid values: yes, no, " - "and auto. 'auto' means to use colors if the output is " - "being sent to a terminal and the TERM environment variable " - "is set to a terminal type that supports colors."); - -GTEST_DEFINE_string_( - filter, - internal::StringFromGTestEnv("filter", GetDefaultFilter()), - "A colon-separated list of glob (not regex) patterns " - "for filtering the tests to run, optionally followed by a " - "'-' and a : separated list of negative patterns (tests to " - "exclude). A test is run if it matches one of the positive " - "patterns and does not match any of the negative patterns."); - -GTEST_DEFINE_bool_( - install_failure_signal_handler, - internal::BoolFromGTestEnv("install_failure_signal_handler", false), - "If true and supported on the current platform, " GTEST_NAME_ " should " - "install a signal handler that dumps debugging information when fatal " - "signals are raised."); - -GTEST_DEFINE_bool_(list_tests, false, - "List all tests without running them."); - -// The net priority order after flag processing is thus: -// --gtest_output command line flag -// GTEST_OUTPUT environment variable -// XML_OUTPUT_FILE environment variable -// '' -GTEST_DEFINE_string_( - output, - internal::StringFromGTestEnv("output", - internal::OutputFlagAlsoCheckEnvVar().c_str()), - "A format (defaults to \"xml\" but can be specified to be \"json\"), " - "optionally followed by a colon and an output file name or directory. " - "A directory is indicated by a trailing pathname separator. " - "Examples: \"xml:filename.xml\", \"xml::directoryname/\". " - "If a directory is specified, output files will be created " - "within that directory, with file-names based on the test " - "executable's name and, if necessary, made unique by adding " - "digits."); - -GTEST_DEFINE_bool_( - brief, internal::BoolFromGTestEnv("brief", false), - "True if only test failures should be displayed in text output."); - -GTEST_DEFINE_bool_(print_time, internal::BoolFromGTestEnv("print_time", true), - "True if and only if " GTEST_NAME_ - " should display elapsed time in text output."); - -GTEST_DEFINE_bool_(print_utf8, internal::BoolFromGTestEnv("print_utf8", true), - "True if and only if " GTEST_NAME_ - " prints UTF8 characters as text."); - -GTEST_DEFINE_int32_( - random_seed, - internal::Int32FromGTestEnv("random_seed", 0), - "Random number seed to use when shuffling test orders. Must be in range " - "[1, 99999], or 0 to use a seed based on the current time."); - -GTEST_DEFINE_int32_( - repeat, - internal::Int32FromGTestEnv("repeat", 1), - "How many times to repeat each test. Specify a negative number " - "for repeating forever. Useful for shaking out flaky tests."); - -GTEST_DEFINE_bool_(show_internal_stack_frames, false, - "True if and only if " GTEST_NAME_ - " should include internal stack frames when " - "printing test failure stack traces."); - -GTEST_DEFINE_bool_(shuffle, internal::BoolFromGTestEnv("shuffle", false), - "True if and only if " GTEST_NAME_ - " should randomize tests' order on every run."); - -GTEST_DEFINE_int32_( - stack_trace_depth, - internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth), - "The maximum number of stack frames to print when an " - "assertion fails. The valid range is 0 through 100, inclusive."); - -GTEST_DEFINE_string_( - stream_result_to, - internal::StringFromGTestEnv("stream_result_to", ""), - "This flag specifies the host name and the port number on which to stream " - "test results. Example: \"localhost:555\". The flag is effective only on " - "Linux."); - -GTEST_DEFINE_bool_( - throw_on_failure, - internal::BoolFromGTestEnv("throw_on_failure", false), - "When this flag is specified, a failed assertion will throw an exception " - "if exceptions are enabled or exit the program with a non-zero code " - "otherwise. For use with an external test framework."); - -#if GTEST_USE_OWN_FLAGFILE_FLAG_ -GTEST_DEFINE_string_( - flagfile, - internal::StringFromGTestEnv("flagfile", ""), - "This flag specifies the flagfile to read command-line flags from."); -#endif // GTEST_USE_OWN_FLAGFILE_FLAG_ - -namespace internal { - -// Generates a random number from [0, range), using a Linear -// Congruential Generator (LCG). Crashes if 'range' is 0 or greater -// than kMaxRange. -uint32_t Random::Generate(uint32_t range) { - // These constants are the same as are used in glibc's rand(3). - // Use wider types than necessary to prevent unsigned overflow diagnostics. - state_ = static_cast(1103515245ULL*state_ + 12345U) % kMaxRange; - - GTEST_CHECK_(range > 0) - << "Cannot generate a number in the range [0, 0)."; - GTEST_CHECK_(range <= kMaxRange) - << "Generation of a number in [0, " << range << ") was requested, " - << "but this can only generate numbers in [0, " << kMaxRange << ")."; - - // Converting via modulus introduces a bit of downward bias, but - // it's simple, and a linear congruential generator isn't too good - // to begin with. - return state_ % range; -} - -// GTestIsInitialized() returns true if and only if the user has initialized -// Google Test. Useful for catching the user mistake of not initializing -// Google Test before calling RUN_ALL_TESTS(). -static bool GTestIsInitialized() { return GetArgvs().size() > 0; } - -// Iterates over a vector of TestSuites, keeping a running sum of the -// results of calling a given int-returning method on each. -// Returns the sum. -static int SumOverTestSuiteList(const std::vector& case_list, - int (TestSuite::*method)() const) { - int sum = 0; - for (size_t i = 0; i < case_list.size(); i++) { - sum += (case_list[i]->*method)(); - } - return sum; -} - -// Returns true if and only if the test suite passed. -static bool TestSuitePassed(const TestSuite* test_suite) { - return test_suite->should_run() && test_suite->Passed(); -} - -// Returns true if and only if the test suite failed. -static bool TestSuiteFailed(const TestSuite* test_suite) { - return test_suite->should_run() && test_suite->Failed(); -} - -// Returns true if and only if test_suite contains at least one test that -// should run. -static bool ShouldRunTestSuite(const TestSuite* test_suite) { - return test_suite->should_run(); -} - -// AssertHelper constructor. -AssertHelper::AssertHelper(TestPartResult::Type type, - const char* file, - int line, - const char* message) - : data_(new AssertHelperData(type, file, line, message)) { -} - -AssertHelper::~AssertHelper() { - delete data_; -} - -// Message assignment, for assertion streaming support. -void AssertHelper::operator=(const Message& message) const { - UnitTest::GetInstance()-> - AddTestPartResult(data_->type, data_->file, data_->line, - AppendUserMessage(data_->message, message), - UnitTest::GetInstance()->impl() - ->CurrentOsStackTraceExceptTop(1) - // Skips the stack frame for this function itself. - ); // NOLINT -} - -namespace { - -// When TEST_P is found without a matching INSTANTIATE_TEST_SUITE_P -// to creates test cases for it, a syntetic test case is -// inserted to report ether an error or a log message. -// -// This configuration bit will likely be removed at some point. -constexpr bool kErrorOnUninstantiatedParameterizedTest = true; -constexpr bool kErrorOnUninstantiatedTypeParameterizedTest = true; - -// A test that fails at a given file/line location with a given message. -class FailureTest : public Test { - public: - explicit FailureTest(const CodeLocation& loc, std::string error_message, - bool as_error) - : loc_(loc), - error_message_(std::move(error_message)), - as_error_(as_error) {} - - void TestBody() override { - if (as_error_) { - AssertHelper(TestPartResult::kNonFatalFailure, loc_.file.c_str(), - loc_.line, "") = Message() << error_message_; - } else { - std::cout << error_message_ << std::endl; - } - } - - private: - const CodeLocation loc_; - const std::string error_message_; - const bool as_error_; -}; - - -} // namespace - -std::set* GetIgnoredParameterizedTestSuites() { - return UnitTest::GetInstance()->impl()->ignored_parameterized_test_suites(); -} - -// Add a given test_suit to the list of them allow to go un-instantiated. -MarkAsIgnored::MarkAsIgnored(const char* test_suite) { - GetIgnoredParameterizedTestSuites()->insert(test_suite); -} - -// If this parameterized test suite has no instantiations (and that -// has not been marked as okay), emit a test case reporting that. -void InsertSyntheticTestCase(const std::string& name, CodeLocation location, - bool has_test_p) { - const auto& ignored = *GetIgnoredParameterizedTestSuites(); - if (ignored.find(name) != ignored.end()) return; - - const char kMissingInstantiation[] = // - " is defined via TEST_P, but never instantiated. None of the test cases " - "will run. Either no INSTANTIATE_TEST_SUITE_P is provided or the only " - "ones provided expand to nothing." - "\n\n" - "Ideally, TEST_P definitions should only ever be included as part of " - "binaries that intend to use them. (As opposed to, for example, being " - "placed in a library that may be linked in to get other utilities.)"; - - const char kMissingTestCase[] = // - " is instantiated via INSTANTIATE_TEST_SUITE_P, but no tests are " - "defined via TEST_P . No test cases will run." - "\n\n" - "Ideally, INSTANTIATE_TEST_SUITE_P should only ever be invoked from " - "code that always depend on code that provides TEST_P. Failing to do " - "so is often an indication of dead code, e.g. the last TEST_P was " - "removed but the rest got left behind."; - - std::string message = - "Parameterized test suite " + name + - (has_test_p ? kMissingInstantiation : kMissingTestCase) + - "\n\n" - "To suppress this error for this test suite, insert the following line " - "(in a non-header) in the namespace it is defined in:" - "\n\n" - "GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(" + name + ");"; - - std::string full_name = "UninstantiatedParameterizedTestSuite<" + name + ">"; - RegisterTest( // - "GoogleTestVerification", full_name.c_str(), - nullptr, // No type parameter. - nullptr, // No value parameter. - location.file.c_str(), location.line, [message, location] { - return new FailureTest(location, message, - kErrorOnUninstantiatedParameterizedTest); - }); -} - -void RegisterTypeParameterizedTestSuite(const char* test_suite_name, - CodeLocation code_location) { - GetUnitTestImpl()->type_parameterized_test_registry().RegisterTestSuite( - test_suite_name, code_location); -} - -void RegisterTypeParameterizedTestSuiteInstantiation(const char* case_name) { - GetUnitTestImpl() - ->type_parameterized_test_registry() - .RegisterInstantiation(case_name); -} - -void TypeParameterizedTestSuiteRegistry::RegisterTestSuite( - const char* test_suite_name, CodeLocation code_location) { - suites_.emplace(std::string(test_suite_name), - TypeParameterizedTestSuiteInfo(code_location)); -} - -void TypeParameterizedTestSuiteRegistry::RegisterInstantiation( - const char* test_suite_name) { - auto it = suites_.find(std::string(test_suite_name)); - if (it != suites_.end()) { - it->second.instantiated = true; - } else { - GTEST_LOG_(ERROR) << "Unknown type parameterized test suit '" - << test_suite_name << "'"; - } -} - -void TypeParameterizedTestSuiteRegistry::CheckForInstantiations() { - const auto& ignored = *GetIgnoredParameterizedTestSuites(); - for (const auto& testcase : suites_) { - if (testcase.second.instantiated) continue; - if (ignored.find(testcase.first) != ignored.end()) continue; - - std::string message = - "Type parameterized test suite " + testcase.first + - " is defined via REGISTER_TYPED_TEST_SUITE_P, but never instantiated " - "via INSTANTIATE_TYPED_TEST_SUITE_P. None of the test cases will run." - "\n\n" - "Ideally, TYPED_TEST_P definitions should only ever be included as " - "part of binaries that intend to use them. (As opposed to, for " - "example, being placed in a library that may be linked in to get other " - "utilities.)" - "\n\n" - "To suppress this error for this test suite, insert the following line " - "(in a non-header) in the namespace it is defined in:" - "\n\n" - "GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(" + - testcase.first + ");"; - - std::string full_name = - "UninstantiatedTypeParameterizedTestSuite<" + testcase.first + ">"; - RegisterTest( // - "GoogleTestVerification", full_name.c_str(), - nullptr, // No type parameter. - nullptr, // No value parameter. - testcase.second.code_location.file.c_str(), - testcase.second.code_location.line, [message, testcase] { - return new FailureTest(testcase.second.code_location, message, - kErrorOnUninstantiatedTypeParameterizedTest); - }); - } -} - -// A copy of all command line arguments. Set by InitGoogleTest(). -static ::std::vector g_argvs; - -::std::vector GetArgvs() { -#if defined(GTEST_CUSTOM_GET_ARGVS_) - // GTEST_CUSTOM_GET_ARGVS_() may return a container of std::string or - // ::string. This code converts it to the appropriate type. - const auto& custom = GTEST_CUSTOM_GET_ARGVS_(); - return ::std::vector(custom.begin(), custom.end()); -#else // defined(GTEST_CUSTOM_GET_ARGVS_) - return g_argvs; -#endif // defined(GTEST_CUSTOM_GET_ARGVS_) -} - -// Returns the current application's name, removing directory path if that -// is present. -FilePath GetCurrentExecutableName() { - FilePath result; - -#if GTEST_OS_WINDOWS || GTEST_OS_OS2 - result.Set(FilePath(GetArgvs()[0]).RemoveExtension("exe")); -#else - result.Set(FilePath(GetArgvs()[0])); -#endif // GTEST_OS_WINDOWS - - return result.RemoveDirectoryName(); -} - -// Functions for processing the gtest_output flag. - -// Returns the output format, or "" for normal printed output. -std::string UnitTestOptions::GetOutputFormat() { - const char* const gtest_output_flag = GTEST_FLAG(output).c_str(); - const char* const colon = strchr(gtest_output_flag, ':'); - return (colon == nullptr) - ? std::string(gtest_output_flag) - : std::string(gtest_output_flag, - static_cast(colon - gtest_output_flag)); -} - -// Returns the name of the requested output file, or the default if none -// was explicitly specified. -std::string UnitTestOptions::GetAbsolutePathToOutputFile() { - const char* const gtest_output_flag = GTEST_FLAG(output).c_str(); - - std::string format = GetOutputFormat(); - if (format.empty()) - format = std::string(kDefaultOutputFormat); - - const char* const colon = strchr(gtest_output_flag, ':'); - if (colon == nullptr) - return internal::FilePath::MakeFileName( - internal::FilePath( - UnitTest::GetInstance()->original_working_dir()), - internal::FilePath(kDefaultOutputFile), 0, - format.c_str()).string(); - - internal::FilePath output_name(colon + 1); - if (!output_name.IsAbsolutePath()) - output_name = internal::FilePath::ConcatPaths( - internal::FilePath(UnitTest::GetInstance()->original_working_dir()), - internal::FilePath(colon + 1)); - - if (!output_name.IsDirectory()) - return output_name.string(); - - internal::FilePath result(internal::FilePath::GenerateUniqueFileName( - output_name, internal::GetCurrentExecutableName(), - GetOutputFormat().c_str())); - return result.string(); -} - -// Returns true if and only if the wildcard pattern matches the string. Each -// pattern consists of regular characters, single-character wildcards (?), and -// multi-character wildcards (*). -// -// This function implements a linear-time string globbing algorithm based on -// https://research.swtch.com/glob. -static bool PatternMatchesString(const std::string& name_str, - const char* pattern, const char* pattern_end) { - const char* name = name_str.c_str(); - const char* const name_begin = name; - const char* const name_end = name + name_str.size(); - - const char* pattern_next = pattern; - const char* name_next = name; - - while (pattern < pattern_end || name < name_end) { - if (pattern < pattern_end) { - switch (*pattern) { - default: // Match an ordinary character. - if (name < name_end && *name == *pattern) { - ++pattern; - ++name; - continue; - } - break; - case '?': // Match any single character. - if (name < name_end) { - ++pattern; - ++name; - continue; - } - break; - case '*': - // Match zero or more characters. Start by skipping over the wildcard - // and matching zero characters from name. If that fails, restart and - // match one more character than the last attempt. - pattern_next = pattern; - name_next = name + 1; - ++pattern; - continue; - } - } - // Failed to match a character. Restart if possible. - if (name_begin < name_next && name_next <= name_end) { - pattern = pattern_next; - name = name_next; - continue; - } - return false; - } - return true; -} - -bool UnitTestOptions::MatchesFilter(const std::string& name_str, - const char* filter) { - // The filter is a list of patterns separated by colons (:). - const char* pattern = filter; - while (true) { - // Find the bounds of this pattern. - const char* const next_sep = strchr(pattern, ':'); - const char* const pattern_end = - next_sep != nullptr ? next_sep : pattern + strlen(pattern); - - // Check if this pattern matches name_str. - if (PatternMatchesString(name_str, pattern, pattern_end)) { - return true; - } - - // Give up on this pattern. However, if we found a pattern separator (:), - // advance to the next pattern (skipping over the separator) and restart. - if (next_sep == nullptr) { - return false; - } - pattern = next_sep + 1; - } - return true; -} - -// Returns true if and only if the user-specified filter matches the test -// suite name and the test name. -bool UnitTestOptions::FilterMatchesTest(const std::string& test_suite_name, - const std::string& test_name) { - const std::string& full_name = test_suite_name + "." + test_name.c_str(); - - // Split --gtest_filter at '-', if there is one, to separate into - // positive filter and negative filter portions - const char* const p = GTEST_FLAG(filter).c_str(); - const char* const dash = strchr(p, '-'); - std::string positive; - std::string negative; - if (dash == nullptr) { - positive = GTEST_FLAG(filter).c_str(); // Whole string is a positive filter - negative = ""; - } else { - positive = std::string(p, dash); // Everything up to the dash - negative = std::string(dash + 1); // Everything after the dash - if (positive.empty()) { - // Treat '-test1' as the same as '*-test1' - positive = kUniversalFilter; - } - } - - // A filter is a colon-separated list of patterns. It matches a - // test if any pattern in it matches the test. - return (MatchesFilter(full_name, positive.c_str()) && - !MatchesFilter(full_name, negative.c_str())); -} - -#if GTEST_HAS_SEH -// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the -// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise. -// This function is useful as an __except condition. -int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) { - // Google Test should handle a SEH exception if: - // 1. the user wants it to, AND - // 2. this is not a breakpoint exception, AND - // 3. this is not a C++ exception (VC++ implements them via SEH, - // apparently). - // - // SEH exception code for C++ exceptions. - // (see http://support.microsoft.com/kb/185294 for more information). - const DWORD kCxxExceptionCode = 0xe06d7363; - - bool should_handle = true; - - if (!GTEST_FLAG(catch_exceptions)) - should_handle = false; - else if (exception_code == EXCEPTION_BREAKPOINT) - should_handle = false; - else if (exception_code == kCxxExceptionCode) - should_handle = false; - - return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH; -} -#endif // GTEST_HAS_SEH - -} // namespace internal - -// The c'tor sets this object as the test part result reporter used by -// Google Test. The 'result' parameter specifies where to report the -// results. Intercepts only failures from the current thread. -ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter( - TestPartResultArray* result) - : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD), - result_(result) { - Init(); -} - -// The c'tor sets this object as the test part result reporter used by -// Google Test. The 'result' parameter specifies where to report the -// results. -ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter( - InterceptMode intercept_mode, TestPartResultArray* result) - : intercept_mode_(intercept_mode), - result_(result) { - Init(); -} - -void ScopedFakeTestPartResultReporter::Init() { - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - if (intercept_mode_ == INTERCEPT_ALL_THREADS) { - old_reporter_ = impl->GetGlobalTestPartResultReporter(); - impl->SetGlobalTestPartResultReporter(this); - } else { - old_reporter_ = impl->GetTestPartResultReporterForCurrentThread(); - impl->SetTestPartResultReporterForCurrentThread(this); - } -} - -// The d'tor restores the test part result reporter used by Google Test -// before. -ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() { - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - if (intercept_mode_ == INTERCEPT_ALL_THREADS) { - impl->SetGlobalTestPartResultReporter(old_reporter_); - } else { - impl->SetTestPartResultReporterForCurrentThread(old_reporter_); - } -} - -// Increments the test part result count and remembers the result. -// This method is from the TestPartResultReporterInterface interface. -void ScopedFakeTestPartResultReporter::ReportTestPartResult( - const TestPartResult& result) { - result_->Append(result); -} - -namespace internal { - -// Returns the type ID of ::testing::Test. We should always call this -// instead of GetTypeId< ::testing::Test>() to get the type ID of -// testing::Test. This is to work around a suspected linker bug when -// using Google Test as a framework on Mac OS X. The bug causes -// GetTypeId< ::testing::Test>() to return different values depending -// on whether the call is from the Google Test framework itself or -// from user test code. GetTestTypeId() is guaranteed to always -// return the same value, as it always calls GetTypeId<>() from the -// gtest.cc, which is within the Google Test framework. -TypeId GetTestTypeId() { - return GetTypeId(); -} - -// The value of GetTestTypeId() as seen from within the Google Test -// library. This is solely for testing GetTestTypeId(). -extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId(); - -// This predicate-formatter checks that 'results' contains a test part -// failure of the given type and that the failure message contains the -// given substring. -static AssertionResult HasOneFailure(const char* /* results_expr */, - const char* /* type_expr */, - const char* /* substr_expr */, - const TestPartResultArray& results, - TestPartResult::Type type, - const std::string& substr) { - const std::string expected(type == TestPartResult::kFatalFailure ? - "1 fatal failure" : - "1 non-fatal failure"); - Message msg; - if (results.size() != 1) { - msg << "Expected: " << expected << "\n" - << " Actual: " << results.size() << " failures"; - for (int i = 0; i < results.size(); i++) { - msg << "\n" << results.GetTestPartResult(i); - } - return AssertionFailure() << msg; - } - - const TestPartResult& r = results.GetTestPartResult(0); - if (r.type() != type) { - return AssertionFailure() << "Expected: " << expected << "\n" - << " Actual:\n" - << r; - } - - if (strstr(r.message(), substr.c_str()) == nullptr) { - return AssertionFailure() << "Expected: " << expected << " containing \"" - << substr << "\"\n" - << " Actual:\n" - << r; - } - - return AssertionSuccess(); -} - -// The constructor of SingleFailureChecker remembers where to look up -// test part results, what type of failure we expect, and what -// substring the failure message should contain. -SingleFailureChecker::SingleFailureChecker(const TestPartResultArray* results, - TestPartResult::Type type, - const std::string& substr) - : results_(results), type_(type), substr_(substr) {} - -// The destructor of SingleFailureChecker verifies that the given -// TestPartResultArray contains exactly one failure that has the given -// type and contains the given substring. If that's not the case, a -// non-fatal failure will be generated. -SingleFailureChecker::~SingleFailureChecker() { - EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_); -} - -DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter( - UnitTestImpl* unit_test) : unit_test_(unit_test) {} - -void DefaultGlobalTestPartResultReporter::ReportTestPartResult( - const TestPartResult& result) { - unit_test_->current_test_result()->AddTestPartResult(result); - unit_test_->listeners()->repeater()->OnTestPartResult(result); -} - -DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter( - UnitTestImpl* unit_test) : unit_test_(unit_test) {} - -void DefaultPerThreadTestPartResultReporter::ReportTestPartResult( - const TestPartResult& result) { - unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result); -} - -// Returns the global test part result reporter. -TestPartResultReporterInterface* -UnitTestImpl::GetGlobalTestPartResultReporter() { - internal::MutexLock lock(&global_test_part_result_reporter_mutex_); - return global_test_part_result_repoter_; -} - -// Sets the global test part result reporter. -void UnitTestImpl::SetGlobalTestPartResultReporter( - TestPartResultReporterInterface* reporter) { - internal::MutexLock lock(&global_test_part_result_reporter_mutex_); - global_test_part_result_repoter_ = reporter; -} - -// Returns the test part result reporter for the current thread. -TestPartResultReporterInterface* -UnitTestImpl::GetTestPartResultReporterForCurrentThread() { - return per_thread_test_part_result_reporter_.get(); -} - -// Sets the test part result reporter for the current thread. -void UnitTestImpl::SetTestPartResultReporterForCurrentThread( - TestPartResultReporterInterface* reporter) { - per_thread_test_part_result_reporter_.set(reporter); -} - -// Gets the number of successful test suites. -int UnitTestImpl::successful_test_suite_count() const { - return CountIf(test_suites_, TestSuitePassed); -} - -// Gets the number of failed test suites. -int UnitTestImpl::failed_test_suite_count() const { - return CountIf(test_suites_, TestSuiteFailed); -} - -// Gets the number of all test suites. -int UnitTestImpl::total_test_suite_count() const { - return static_cast(test_suites_.size()); -} - -// Gets the number of all test suites that contain at least one test -// that should run. -int UnitTestImpl::test_suite_to_run_count() const { - return CountIf(test_suites_, ShouldRunTestSuite); -} - -// Gets the number of successful tests. -int UnitTestImpl::successful_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::successful_test_count); -} - -// Gets the number of skipped tests. -int UnitTestImpl::skipped_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::skipped_test_count); -} - -// Gets the number of failed tests. -int UnitTestImpl::failed_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::failed_test_count); -} - -// Gets the number of disabled tests that will be reported in the XML report. -int UnitTestImpl::reportable_disabled_test_count() const { - return SumOverTestSuiteList(test_suites_, - &TestSuite::reportable_disabled_test_count); -} - -// Gets the number of disabled tests. -int UnitTestImpl::disabled_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::disabled_test_count); -} - -// Gets the number of tests to be printed in the XML report. -int UnitTestImpl::reportable_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::reportable_test_count); -} - -// Gets the number of all tests. -int UnitTestImpl::total_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::total_test_count); -} - -// Gets the number of tests that should run. -int UnitTestImpl::test_to_run_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::test_to_run_count); -} - -// Returns the current OS stack trace as an std::string. -// -// The maximum number of stack frames to be included is specified by -// the gtest_stack_trace_depth flag. The skip_count parameter -// specifies the number of top frames to be skipped, which doesn't -// count against the number of frames to be included. -// -// For example, if Foo() calls Bar(), which in turn calls -// CurrentOsStackTraceExceptTop(1), Foo() will be included in the -// trace but Bar() and CurrentOsStackTraceExceptTop() won't. -std::string UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) { - return os_stack_trace_getter()->CurrentStackTrace( - static_cast(GTEST_FLAG(stack_trace_depth)), - skip_count + 1 - // Skips the user-specified number of frames plus this function - // itself. - ); // NOLINT -} - -// A helper class for measuring elapsed times. -class Timer { - public: - Timer() : start_(std::chrono::steady_clock::now()) {} - - // Return time elapsed in milliseconds since the timer was created. - TimeInMillis Elapsed() { - return std::chrono::duration_cast( - std::chrono::steady_clock::now() - start_) - .count(); - } - - private: - std::chrono::steady_clock::time_point start_; -}; - -// Returns a timestamp as milliseconds since the epoch. Note this time may jump -// around subject to adjustments by the system, to measure elapsed time use -// Timer instead. -TimeInMillis GetTimeInMillis() { - return std::chrono::duration_cast( - std::chrono::system_clock::now() - - std::chrono::system_clock::from_time_t(0)) - .count(); -} - -// Utilities - -// class String. - -#if GTEST_OS_WINDOWS_MOBILE -// Creates a UTF-16 wide string from the given ANSI string, allocating -// memory using new. The caller is responsible for deleting the return -// value using delete[]. Returns the wide string, or NULL if the -// input is NULL. -LPCWSTR String::AnsiToUtf16(const char* ansi) { - if (!ansi) return nullptr; - const int length = strlen(ansi); - const int unicode_length = - MultiByteToWideChar(CP_ACP, 0, ansi, length, nullptr, 0); - WCHAR* unicode = new WCHAR[unicode_length + 1]; - MultiByteToWideChar(CP_ACP, 0, ansi, length, - unicode, unicode_length); - unicode[unicode_length] = 0; - return unicode; -} - -// Creates an ANSI string from the given wide string, allocating -// memory using new. The caller is responsible for deleting the return -// value using delete[]. Returns the ANSI string, or NULL if the -// input is NULL. -const char* String::Utf16ToAnsi(LPCWSTR utf16_str) { - if (!utf16_str) return nullptr; - const int ansi_length = WideCharToMultiByte(CP_ACP, 0, utf16_str, -1, nullptr, - 0, nullptr, nullptr); - char* ansi = new char[ansi_length + 1]; - WideCharToMultiByte(CP_ACP, 0, utf16_str, -1, ansi, ansi_length, nullptr, - nullptr); - ansi[ansi_length] = 0; - return ansi; -} - -#endif // GTEST_OS_WINDOWS_MOBILE - -// Compares two C strings. Returns true if and only if they have the same -// content. -// -// Unlike strcmp(), this function can handle NULL argument(s). A NULL -// C string is considered different to any non-NULL C string, -// including the empty string. -bool String::CStringEquals(const char * lhs, const char * rhs) { - if (lhs == nullptr) return rhs == nullptr; - - if (rhs == nullptr) return false; - - return strcmp(lhs, rhs) == 0; -} - -#if GTEST_HAS_STD_WSTRING - -// Converts an array of wide chars to a narrow string using the UTF-8 -// encoding, and streams the result to the given Message object. -static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length, - Message* msg) { - for (size_t i = 0; i != length; ) { // NOLINT - if (wstr[i] != L'\0') { - *msg << WideStringToUtf8(wstr + i, static_cast(length - i)); - while (i != length && wstr[i] != L'\0') - i++; - } else { - *msg << '\0'; - i++; - } - } -} - -#endif // GTEST_HAS_STD_WSTRING - -void SplitString(const ::std::string& str, char delimiter, - ::std::vector< ::std::string>* dest) { - ::std::vector< ::std::string> parsed; - ::std::string::size_type pos = 0; - while (::testing::internal::AlwaysTrue()) { - const ::std::string::size_type colon = str.find(delimiter, pos); - if (colon == ::std::string::npos) { - parsed.push_back(str.substr(pos)); - break; - } else { - parsed.push_back(str.substr(pos, colon - pos)); - pos = colon + 1; - } - } - dest->swap(parsed); -} - -} // namespace internal - -// Constructs an empty Message. -// We allocate the stringstream separately because otherwise each use of -// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's -// stack frame leading to huge stack frames in some cases; gcc does not reuse -// the stack space. -Message::Message() : ss_(new ::std::stringstream) { - // By default, we want there to be enough precision when printing - // a double to a Message. - *ss_ << std::setprecision(std::numeric_limits::digits10 + 2); -} - -// These two overloads allow streaming a wide C string to a Message -// using the UTF-8 encoding. -Message& Message::operator <<(const wchar_t* wide_c_str) { - return *this << internal::String::ShowWideCString(wide_c_str); -} -Message& Message::operator <<(wchar_t* wide_c_str) { - return *this << internal::String::ShowWideCString(wide_c_str); -} - -#if GTEST_HAS_STD_WSTRING -// Converts the given wide string to a narrow string using the UTF-8 -// encoding, and streams the result to this Message object. -Message& Message::operator <<(const ::std::wstring& wstr) { - internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this); - return *this; -} -#endif // GTEST_HAS_STD_WSTRING - -// Gets the text streamed to this object so far as an std::string. -// Each '\0' character in the buffer is replaced with "\\0". -std::string Message::GetString() const { - return internal::StringStreamToString(ss_.get()); -} - -// AssertionResult constructors. -// Used in EXPECT_TRUE/FALSE(assertion_result). -AssertionResult::AssertionResult(const AssertionResult& other) - : success_(other.success_), - message_(other.message_.get() != nullptr - ? new ::std::string(*other.message_) - : static_cast< ::std::string*>(nullptr)) {} - -// Swaps two AssertionResults. -void AssertionResult::swap(AssertionResult& other) { - using std::swap; - swap(success_, other.success_); - swap(message_, other.message_); -} - -// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE. -AssertionResult AssertionResult::operator!() const { - AssertionResult negation(!success_); - if (message_.get() != nullptr) negation << *message_; - return negation; -} - -// Makes a successful assertion result. -AssertionResult AssertionSuccess() { - return AssertionResult(true); -} - -// Makes a failed assertion result. -AssertionResult AssertionFailure() { - return AssertionResult(false); -} - -// Makes a failed assertion result with the given failure message. -// Deprecated; use AssertionFailure() << message. -AssertionResult AssertionFailure(const Message& message) { - return AssertionFailure() << message; -} - -namespace internal { - -namespace edit_distance { -std::vector CalculateOptimalEdits(const std::vector& left, - const std::vector& right) { - std::vector > costs( - left.size() + 1, std::vector(right.size() + 1)); - std::vector > best_move( - left.size() + 1, std::vector(right.size() + 1)); - - // Populate for empty right. - for (size_t l_i = 0; l_i < costs.size(); ++l_i) { - costs[l_i][0] = static_cast(l_i); - best_move[l_i][0] = kRemove; - } - // Populate for empty left. - for (size_t r_i = 1; r_i < costs[0].size(); ++r_i) { - costs[0][r_i] = static_cast(r_i); - best_move[0][r_i] = kAdd; - } - - for (size_t l_i = 0; l_i < left.size(); ++l_i) { - for (size_t r_i = 0; r_i < right.size(); ++r_i) { - if (left[l_i] == right[r_i]) { - // Found a match. Consume it. - costs[l_i + 1][r_i + 1] = costs[l_i][r_i]; - best_move[l_i + 1][r_i + 1] = kMatch; - continue; - } - - const double add = costs[l_i + 1][r_i]; - const double remove = costs[l_i][r_i + 1]; - const double replace = costs[l_i][r_i]; - if (add < remove && add < replace) { - costs[l_i + 1][r_i + 1] = add + 1; - best_move[l_i + 1][r_i + 1] = kAdd; - } else if (remove < add && remove < replace) { - costs[l_i + 1][r_i + 1] = remove + 1; - best_move[l_i + 1][r_i + 1] = kRemove; - } else { - // We make replace a little more expensive than add/remove to lower - // their priority. - costs[l_i + 1][r_i + 1] = replace + 1.00001; - best_move[l_i + 1][r_i + 1] = kReplace; - } - } - } - - // Reconstruct the best path. We do it in reverse order. - std::vector best_path; - for (size_t l_i = left.size(), r_i = right.size(); l_i > 0 || r_i > 0;) { - EditType move = best_move[l_i][r_i]; - best_path.push_back(move); - l_i -= move != kAdd; - r_i -= move != kRemove; - } - std::reverse(best_path.begin(), best_path.end()); - return best_path; -} - -namespace { - -// Helper class to convert string into ids with deduplication. -class InternalStrings { - public: - size_t GetId(const std::string& str) { - IdMap::iterator it = ids_.find(str); - if (it != ids_.end()) return it->second; - size_t id = ids_.size(); - return ids_[str] = id; - } - - private: - typedef std::map IdMap; - IdMap ids_; -}; - -} // namespace - -std::vector CalculateOptimalEdits( - const std::vector& left, - const std::vector& right) { - std::vector left_ids, right_ids; - { - InternalStrings intern_table; - for (size_t i = 0; i < left.size(); ++i) { - left_ids.push_back(intern_table.GetId(left[i])); - } - for (size_t i = 0; i < right.size(); ++i) { - right_ids.push_back(intern_table.GetId(right[i])); - } - } - return CalculateOptimalEdits(left_ids, right_ids); -} - -namespace { - -// Helper class that holds the state for one hunk and prints it out to the -// stream. -// It reorders adds/removes when possible to group all removes before all -// adds. It also adds the hunk header before printint into the stream. -class Hunk { - public: - Hunk(size_t left_start, size_t right_start) - : left_start_(left_start), - right_start_(right_start), - adds_(), - removes_(), - common_() {} - - void PushLine(char edit, const char* line) { - switch (edit) { - case ' ': - ++common_; - FlushEdits(); - hunk_.push_back(std::make_pair(' ', line)); - break; - case '-': - ++removes_; - hunk_removes_.push_back(std::make_pair('-', line)); - break; - case '+': - ++adds_; - hunk_adds_.push_back(std::make_pair('+', line)); - break; - } - } - - void PrintTo(std::ostream* os) { - PrintHeader(os); - FlushEdits(); - for (std::list >::const_iterator it = - hunk_.begin(); - it != hunk_.end(); ++it) { - *os << it->first << it->second << "\n"; - } - } - - bool has_edits() const { return adds_ || removes_; } - - private: - void FlushEdits() { - hunk_.splice(hunk_.end(), hunk_removes_); - hunk_.splice(hunk_.end(), hunk_adds_); - } - - // Print a unified diff header for one hunk. - // The format is - // "@@ -, +, @@" - // where the left/right parts are omitted if unnecessary. - void PrintHeader(std::ostream* ss) const { - *ss << "@@ "; - if (removes_) { - *ss << "-" << left_start_ << "," << (removes_ + common_); - } - if (removes_ && adds_) { - *ss << " "; - } - if (adds_) { - *ss << "+" << right_start_ << "," << (adds_ + common_); - } - *ss << " @@\n"; - } - - size_t left_start_, right_start_; - size_t adds_, removes_, common_; - std::list > hunk_, hunk_adds_, hunk_removes_; -}; - -} // namespace - -// Create a list of diff hunks in Unified diff format. -// Each hunk has a header generated by PrintHeader above plus a body with -// lines prefixed with ' ' for no change, '-' for deletion and '+' for -// addition. -// 'context' represents the desired unchanged prefix/suffix around the diff. -// If two hunks are close enough that their contexts overlap, then they are -// joined into one hunk. -std::string CreateUnifiedDiff(const std::vector& left, - const std::vector& right, - size_t context) { - const std::vector edits = CalculateOptimalEdits(left, right); - - size_t l_i = 0, r_i = 0, edit_i = 0; - std::stringstream ss; - while (edit_i < edits.size()) { - // Find first edit. - while (edit_i < edits.size() && edits[edit_i] == kMatch) { - ++l_i; - ++r_i; - ++edit_i; - } - - // Find the first line to include in the hunk. - const size_t prefix_context = std::min(l_i, context); - Hunk hunk(l_i - prefix_context + 1, r_i - prefix_context + 1); - for (size_t i = prefix_context; i > 0; --i) { - hunk.PushLine(' ', left[l_i - i].c_str()); - } - - // Iterate the edits until we found enough suffix for the hunk or the input - // is over. - size_t n_suffix = 0; - for (; edit_i < edits.size(); ++edit_i) { - if (n_suffix >= context) { - // Continue only if the next hunk is very close. - auto it = edits.begin() + static_cast(edit_i); - while (it != edits.end() && *it == kMatch) ++it; - if (it == edits.end() || - static_cast(it - edits.begin()) - edit_i >= context) { - // There is no next edit or it is too far away. - break; - } - } - - EditType edit = edits[edit_i]; - // Reset count when a non match is found. - n_suffix = edit == kMatch ? n_suffix + 1 : 0; - - if (edit == kMatch || edit == kRemove || edit == kReplace) { - hunk.PushLine(edit == kMatch ? ' ' : '-', left[l_i].c_str()); - } - if (edit == kAdd || edit == kReplace) { - hunk.PushLine('+', right[r_i].c_str()); - } - - // Advance indices, depending on edit type. - l_i += edit != kAdd; - r_i += edit != kRemove; - } - - if (!hunk.has_edits()) { - // We are done. We don't want this hunk. - break; - } - - hunk.PrintTo(&ss); - } - return ss.str(); -} - -} // namespace edit_distance - -namespace { - -// The string representation of the values received in EqFailure() are already -// escaped. Split them on escaped '\n' boundaries. Leave all other escaped -// characters the same. -std::vector SplitEscapedString(const std::string& str) { - std::vector lines; - size_t start = 0, end = str.size(); - if (end > 2 && str[0] == '"' && str[end - 1] == '"') { - ++start; - --end; - } - bool escaped = false; - for (size_t i = start; i + 1 < end; ++i) { - if (escaped) { - escaped = false; - if (str[i] == 'n') { - lines.push_back(str.substr(start, i - start - 1)); - start = i + 1; - } - } else { - escaped = str[i] == '\\'; - } - } - lines.push_back(str.substr(start, end - start)); - return lines; -} - -} // namespace - -// Constructs and returns the message for an equality assertion -// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure. -// -// The first four parameters are the expressions used in the assertion -// and their values, as strings. For example, for ASSERT_EQ(foo, bar) -// where foo is 5 and bar is 6, we have: -// -// lhs_expression: "foo" -// rhs_expression: "bar" -// lhs_value: "5" -// rhs_value: "6" -// -// The ignoring_case parameter is true if and only if the assertion is a -// *_STRCASEEQ*. When it's true, the string "Ignoring case" will -// be inserted into the message. -AssertionResult EqFailure(const char* lhs_expression, - const char* rhs_expression, - const std::string& lhs_value, - const std::string& rhs_value, - bool ignoring_case) { - Message msg; - msg << "Expected equality of these values:"; - msg << "\n " << lhs_expression; - if (lhs_value != lhs_expression) { - msg << "\n Which is: " << lhs_value; - } - msg << "\n " << rhs_expression; - if (rhs_value != rhs_expression) { - msg << "\n Which is: " << rhs_value; - } - - if (ignoring_case) { - msg << "\nIgnoring case"; - } - - if (!lhs_value.empty() && !rhs_value.empty()) { - const std::vector lhs_lines = - SplitEscapedString(lhs_value); - const std::vector rhs_lines = - SplitEscapedString(rhs_value); - if (lhs_lines.size() > 1 || rhs_lines.size() > 1) { - msg << "\nWith diff:\n" - << edit_distance::CreateUnifiedDiff(lhs_lines, rhs_lines); - } - } - - return AssertionFailure() << msg; -} - -// Constructs a failure message for Boolean assertions such as EXPECT_TRUE. -std::string GetBoolAssertionFailureMessage( - const AssertionResult& assertion_result, - const char* expression_text, - const char* actual_predicate_value, - const char* expected_predicate_value) { - const char* actual_message = assertion_result.message(); - Message msg; - msg << "Value of: " << expression_text - << "\n Actual: " << actual_predicate_value; - if (actual_message[0] != '\0') - msg << " (" << actual_message << ")"; - msg << "\nExpected: " << expected_predicate_value; - return msg.GetString(); -} - -// Helper function for implementing ASSERT_NEAR. -AssertionResult DoubleNearPredFormat(const char* expr1, - const char* expr2, - const char* abs_error_expr, - double val1, - double val2, - double abs_error) { - const double diff = fabs(val1 - val2); - if (diff <= abs_error) return AssertionSuccess(); - - // Find the value which is closest to zero. - const double min_abs = std::min(fabs(val1), fabs(val2)); - // Find the distance to the next double from that value. - const double epsilon = - nextafter(min_abs, std::numeric_limits::infinity()) - min_abs; - // Detect the case where abs_error is so small that EXPECT_NEAR is - // effectively the same as EXPECT_EQUAL, and give an informative error - // message so that the situation can be more easily understood without - // requiring exotic floating-point knowledge. - // Don't do an epsilon check if abs_error is zero because that implies - // that an equality check was actually intended. - if (!(std::isnan)(val1) && !(std::isnan)(val2) && abs_error > 0 && - abs_error < epsilon) { - return AssertionFailure() - << "The difference between " << expr1 << " and " << expr2 << " is " - << diff << ", where\n" - << expr1 << " evaluates to " << val1 << ",\n" - << expr2 << " evaluates to " << val2 << ".\nThe abs_error parameter " - << abs_error_expr << " evaluates to " << abs_error - << " which is smaller than the minimum distance between doubles for " - "numbers of this magnitude which is " - << epsilon - << ", thus making this EXPECT_NEAR check equivalent to " - "EXPECT_EQUAL. Consider using EXPECT_DOUBLE_EQ instead."; - } - return AssertionFailure() - << "The difference between " << expr1 << " and " << expr2 - << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n" - << expr1 << " evaluates to " << val1 << ",\n" - << expr2 << " evaluates to " << val2 << ", and\n" - << abs_error_expr << " evaluates to " << abs_error << "."; -} - - -// Helper template for implementing FloatLE() and DoubleLE(). -template -AssertionResult FloatingPointLE(const char* expr1, - const char* expr2, - RawType val1, - RawType val2) { - // Returns success if val1 is less than val2, - if (val1 < val2) { - return AssertionSuccess(); - } - - // or if val1 is almost equal to val2. - const FloatingPoint lhs(val1), rhs(val2); - if (lhs.AlmostEquals(rhs)) { - return AssertionSuccess(); - } - - // Note that the above two checks will both fail if either val1 or - // val2 is NaN, as the IEEE floating-point standard requires that - // any predicate involving a NaN must return false. - - ::std::stringstream val1_ss; - val1_ss << std::setprecision(std::numeric_limits::digits10 + 2) - << val1; - - ::std::stringstream val2_ss; - val2_ss << std::setprecision(std::numeric_limits::digits10 + 2) - << val2; - - return AssertionFailure() - << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n" - << " Actual: " << StringStreamToString(&val1_ss) << " vs " - << StringStreamToString(&val2_ss); -} - -} // namespace internal - -// Asserts that val1 is less than, or almost equal to, val2. Fails -// otherwise. In particular, it fails if either val1 or val2 is NaN. -AssertionResult FloatLE(const char* expr1, const char* expr2, - float val1, float val2) { - return internal::FloatingPointLE(expr1, expr2, val1, val2); -} - -// Asserts that val1 is less than, or almost equal to, val2. Fails -// otherwise. In particular, it fails if either val1 or val2 is NaN. -AssertionResult DoubleLE(const char* expr1, const char* expr2, - double val1, double val2) { - return internal::FloatingPointLE(expr1, expr2, val1, val2); -} - -namespace internal { - -// The helper function for {ASSERT|EXPECT}_STREQ. -AssertionResult CmpHelperSTREQ(const char* lhs_expression, - const char* rhs_expression, - const char* lhs, - const char* rhs) { - if (String::CStringEquals(lhs, rhs)) { - return AssertionSuccess(); - } - - return EqFailure(lhs_expression, - rhs_expression, - PrintToString(lhs), - PrintToString(rhs), - false); -} - -// The helper function for {ASSERT|EXPECT}_STRCASEEQ. -AssertionResult CmpHelperSTRCASEEQ(const char* lhs_expression, - const char* rhs_expression, - const char* lhs, - const char* rhs) { - if (String::CaseInsensitiveCStringEquals(lhs, rhs)) { - return AssertionSuccess(); - } - - return EqFailure(lhs_expression, - rhs_expression, - PrintToString(lhs), - PrintToString(rhs), - true); -} - -// The helper function for {ASSERT|EXPECT}_STRNE. -AssertionResult CmpHelperSTRNE(const char* s1_expression, - const char* s2_expression, - const char* s1, - const char* s2) { - if (!String::CStringEquals(s1, s2)) { - return AssertionSuccess(); - } else { - return AssertionFailure() << "Expected: (" << s1_expression << ") != (" - << s2_expression << "), actual: \"" - << s1 << "\" vs \"" << s2 << "\""; - } -} - -// The helper function for {ASSERT|EXPECT}_STRCASENE. -AssertionResult CmpHelperSTRCASENE(const char* s1_expression, - const char* s2_expression, - const char* s1, - const char* s2) { - if (!String::CaseInsensitiveCStringEquals(s1, s2)) { - return AssertionSuccess(); - } else { - return AssertionFailure() - << "Expected: (" << s1_expression << ") != (" - << s2_expression << ") (ignoring case), actual: \"" - << s1 << "\" vs \"" << s2 << "\""; - } -} - -} // namespace internal - -namespace { - -// Helper functions for implementing IsSubString() and IsNotSubstring(). - -// This group of overloaded functions return true if and only if needle -// is a substring of haystack. NULL is considered a substring of -// itself only. - -bool IsSubstringPred(const char* needle, const char* haystack) { - if (needle == nullptr || haystack == nullptr) return needle == haystack; - - return strstr(haystack, needle) != nullptr; -} - -bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) { - if (needle == nullptr || haystack == nullptr) return needle == haystack; - - return wcsstr(haystack, needle) != nullptr; -} - -// StringType here can be either ::std::string or ::std::wstring. -template -bool IsSubstringPred(const StringType& needle, - const StringType& haystack) { - return haystack.find(needle) != StringType::npos; -} - -// This function implements either IsSubstring() or IsNotSubstring(), -// depending on the value of the expected_to_be_substring parameter. -// StringType here can be const char*, const wchar_t*, ::std::string, -// or ::std::wstring. -template -AssertionResult IsSubstringImpl( - bool expected_to_be_substring, - const char* needle_expr, const char* haystack_expr, - const StringType& needle, const StringType& haystack) { - if (IsSubstringPred(needle, haystack) == expected_to_be_substring) - return AssertionSuccess(); - - const bool is_wide_string = sizeof(needle[0]) > 1; - const char* const begin_string_quote = is_wide_string ? "L\"" : "\""; - return AssertionFailure() - << "Value of: " << needle_expr << "\n" - << " Actual: " << begin_string_quote << needle << "\"\n" - << "Expected: " << (expected_to_be_substring ? "" : "not ") - << "a substring of " << haystack_expr << "\n" - << "Which is: " << begin_string_quote << haystack << "\""; -} - -} // namespace - -// IsSubstring() and IsNotSubstring() check whether needle is a -// substring of haystack (NULL is considered a substring of itself -// only), and return an appropriate error message when they fail. - -AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const char* needle, const char* haystack) { - return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const wchar_t* needle, const wchar_t* haystack) { - return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const char* needle, const char* haystack) { - return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const wchar_t* needle, const wchar_t* haystack) { - return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::string& needle, const ::std::string& haystack) { - return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::string& needle, const ::std::string& haystack) { - return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); -} - -#if GTEST_HAS_STD_WSTRING -AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::wstring& needle, const ::std::wstring& haystack) { - return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::wstring& needle, const ::std::wstring& haystack) { - return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); -} -#endif // GTEST_HAS_STD_WSTRING - -namespace internal { - -#if GTEST_OS_WINDOWS - -namespace { - -// Helper function for IsHRESULT{SuccessFailure} predicates -AssertionResult HRESULTFailureHelper(const char* expr, - const char* expected, - long hr) { // NOLINT -# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_TV_TITLE - - // Windows CE doesn't support FormatMessage. - const char error_text[] = ""; - -# else - - // Looks up the human-readable system message for the HRESULT code - // and since we're not passing any params to FormatMessage, we don't - // want inserts expanded. - const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS; - const DWORD kBufSize = 4096; - // Gets the system's human readable message string for this HRESULT. - char error_text[kBufSize] = { '\0' }; - DWORD message_length = ::FormatMessageA(kFlags, - 0, // no source, we're asking system - static_cast(hr), // the error - 0, // no line width restrictions - error_text, // output buffer - kBufSize, // buf size - nullptr); // no arguments for inserts - // Trims tailing white space (FormatMessage leaves a trailing CR-LF) - for (; message_length && IsSpace(error_text[message_length - 1]); - --message_length) { - error_text[message_length - 1] = '\0'; - } - -# endif // GTEST_OS_WINDOWS_MOBILE - - const std::string error_hex("0x" + String::FormatHexInt(hr)); - return ::testing::AssertionFailure() - << "Expected: " << expr << " " << expected << ".\n" - << " Actual: " << error_hex << " " << error_text << "\n"; -} - -} // namespace - -AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT - if (SUCCEEDED(hr)) { - return AssertionSuccess(); - } - return HRESULTFailureHelper(expr, "succeeds", hr); -} - -AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT - if (FAILED(hr)) { - return AssertionSuccess(); - } - return HRESULTFailureHelper(expr, "fails", hr); -} - -#endif // GTEST_OS_WINDOWS - -// Utility functions for encoding Unicode text (wide strings) in -// UTF-8. - -// A Unicode code-point can have up to 21 bits, and is encoded in UTF-8 -// like this: -// -// Code-point length Encoding -// 0 - 7 bits 0xxxxxxx -// 8 - 11 bits 110xxxxx 10xxxxxx -// 12 - 16 bits 1110xxxx 10xxxxxx 10xxxxxx -// 17 - 21 bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - -// The maximum code-point a one-byte UTF-8 sequence can represent. -constexpr uint32_t kMaxCodePoint1 = (static_cast(1) << 7) - 1; - -// The maximum code-point a two-byte UTF-8 sequence can represent. -constexpr uint32_t kMaxCodePoint2 = (static_cast(1) << (5 + 6)) - 1; - -// The maximum code-point a three-byte UTF-8 sequence can represent. -constexpr uint32_t kMaxCodePoint3 = (static_cast(1) << (4 + 2*6)) - 1; - -// The maximum code-point a four-byte UTF-8 sequence can represent. -constexpr uint32_t kMaxCodePoint4 = (static_cast(1) << (3 + 3*6)) - 1; - -// Chops off the n lowest bits from a bit pattern. Returns the n -// lowest bits. As a side effect, the original bit pattern will be -// shifted to the right by n bits. -inline uint32_t ChopLowBits(uint32_t* bits, int n) { - const uint32_t low_bits = *bits & ((static_cast(1) << n) - 1); - *bits >>= n; - return low_bits; -} - -// Converts a Unicode code point to a narrow string in UTF-8 encoding. -// code_point parameter is of type uint32_t because wchar_t may not be -// wide enough to contain a code point. -// If the code_point is not a valid Unicode code point -// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted -// to "(Invalid Unicode 0xXXXXXXXX)". -std::string CodePointToUtf8(uint32_t code_point) { - if (code_point > kMaxCodePoint4) { - return "(Invalid Unicode 0x" + String::FormatHexUInt32(code_point) + ")"; - } - - char str[5]; // Big enough for the largest valid code point. - if (code_point <= kMaxCodePoint1) { - str[1] = '\0'; - str[0] = static_cast(code_point); // 0xxxxxxx - } else if (code_point <= kMaxCodePoint2) { - str[2] = '\0'; - str[1] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[0] = static_cast(0xC0 | code_point); // 110xxxxx - } else if (code_point <= kMaxCodePoint3) { - str[3] = '\0'; - str[2] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[1] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[0] = static_cast(0xE0 | code_point); // 1110xxxx - } else { // code_point <= kMaxCodePoint4 - str[4] = '\0'; - str[3] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[2] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[1] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[0] = static_cast(0xF0 | code_point); // 11110xxx - } - return str; -} - -// The following two functions only make sense if the system -// uses UTF-16 for wide string encoding. All supported systems -// with 16 bit wchar_t (Windows, Cygwin) do use UTF-16. - -// Determines if the arguments constitute UTF-16 surrogate pair -// and thus should be combined into a single Unicode code point -// using CreateCodePointFromUtf16SurrogatePair. -inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) { - return sizeof(wchar_t) == 2 && - (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00; -} - -// Creates a Unicode code point from UTF16 surrogate pair. -inline uint32_t CreateCodePointFromUtf16SurrogatePair(wchar_t first, - wchar_t second) { - const auto first_u = static_cast(first); - const auto second_u = static_cast(second); - const uint32_t mask = (1 << 10) - 1; - return (sizeof(wchar_t) == 2) - ? (((first_u & mask) << 10) | (second_u & mask)) + 0x10000 - : - // This function should not be called when the condition is - // false, but we provide a sensible default in case it is. - first_u; -} - -// Converts a wide string to a narrow string in UTF-8 encoding. -// The wide string is assumed to have the following encoding: -// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin) -// UTF-32 if sizeof(wchar_t) == 4 (on Linux) -// Parameter str points to a null-terminated wide string. -// Parameter num_chars may additionally limit the number -// of wchar_t characters processed. -1 is used when the entire string -// should be processed. -// If the string contains code points that are not valid Unicode code points -// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output -// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding -// and contains invalid UTF-16 surrogate pairs, values in those pairs -// will be encoded as individual Unicode characters from Basic Normal Plane. -std::string WideStringToUtf8(const wchar_t* str, int num_chars) { - if (num_chars == -1) - num_chars = static_cast(wcslen(str)); - - ::std::stringstream stream; - for (int i = 0; i < num_chars; ++i) { - uint32_t unicode_code_point; - - if (str[i] == L'\0') { - break; - } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) { - unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i], - str[i + 1]); - i++; - } else { - unicode_code_point = static_cast(str[i]); - } - - stream << CodePointToUtf8(unicode_code_point); - } - return StringStreamToString(&stream); -} - -// Converts a wide C string to an std::string using the UTF-8 encoding. -// NULL will be converted to "(null)". -std::string String::ShowWideCString(const wchar_t * wide_c_str) { - if (wide_c_str == nullptr) return "(null)"; - - return internal::WideStringToUtf8(wide_c_str, -1); -} - -// Compares two wide C strings. Returns true if and only if they have the -// same content. -// -// Unlike wcscmp(), this function can handle NULL argument(s). A NULL -// C string is considered different to any non-NULL C string, -// including the empty string. -bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) { - if (lhs == nullptr) return rhs == nullptr; - - if (rhs == nullptr) return false; - - return wcscmp(lhs, rhs) == 0; -} - -// Helper function for *_STREQ on wide strings. -AssertionResult CmpHelperSTREQ(const char* lhs_expression, - const char* rhs_expression, - const wchar_t* lhs, - const wchar_t* rhs) { - if (String::WideCStringEquals(lhs, rhs)) { - return AssertionSuccess(); - } - - return EqFailure(lhs_expression, - rhs_expression, - PrintToString(lhs), - PrintToString(rhs), - false); -} - -// Helper function for *_STRNE on wide strings. -AssertionResult CmpHelperSTRNE(const char* s1_expression, - const char* s2_expression, - const wchar_t* s1, - const wchar_t* s2) { - if (!String::WideCStringEquals(s1, s2)) { - return AssertionSuccess(); - } - - return AssertionFailure() << "Expected: (" << s1_expression << ") != (" - << s2_expression << "), actual: " - << PrintToString(s1) - << " vs " << PrintToString(s2); -} - -// Compares two C strings, ignoring case. Returns true if and only if they have -// the same content. -// -// Unlike strcasecmp(), this function can handle NULL argument(s). A -// NULL C string is considered different to any non-NULL C string, -// including the empty string. -bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) { - if (lhs == nullptr) return rhs == nullptr; - if (rhs == nullptr) return false; - return posix::StrCaseCmp(lhs, rhs) == 0; -} - -// Compares two wide C strings, ignoring case. Returns true if and only if they -// have the same content. -// -// Unlike wcscasecmp(), this function can handle NULL argument(s). -// A NULL C string is considered different to any non-NULL wide C string, -// including the empty string. -// NB: The implementations on different platforms slightly differ. -// On windows, this method uses _wcsicmp which compares according to LC_CTYPE -// environment variable. On GNU platform this method uses wcscasecmp -// which compares according to LC_CTYPE category of the current locale. -// On MacOS X, it uses towlower, which also uses LC_CTYPE category of the -// current locale. -bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs, - const wchar_t* rhs) { - if (lhs == nullptr) return rhs == nullptr; - - if (rhs == nullptr) return false; - -#if GTEST_OS_WINDOWS - return _wcsicmp(lhs, rhs) == 0; -#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID - return wcscasecmp(lhs, rhs) == 0; -#else - // Android, Mac OS X and Cygwin don't define wcscasecmp. - // Other unknown OSes may not define it either. - wint_t left, right; - do { - left = towlower(static_cast(*lhs++)); - right = towlower(static_cast(*rhs++)); - } while (left && left == right); - return left == right; -#endif // OS selector -} - -// Returns true if and only if str ends with the given suffix, ignoring case. -// Any string is considered to end with an empty suffix. -bool String::EndsWithCaseInsensitive( - const std::string& str, const std::string& suffix) { - const size_t str_len = str.length(); - const size_t suffix_len = suffix.length(); - return (str_len >= suffix_len) && - CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len, - suffix.c_str()); -} - -// Formats an int value as "%02d". -std::string String::FormatIntWidth2(int value) { - return FormatIntWidthN(value, 2); -} - -// Formats an int value to given width with leading zeros. -std::string String::FormatIntWidthN(int value, int width) { - std::stringstream ss; - ss << std::setfill('0') << std::setw(width) << value; - return ss.str(); -} - -// Formats an int value as "%X". -std::string String::FormatHexUInt32(uint32_t value) { - std::stringstream ss; - ss << std::hex << std::uppercase << value; - return ss.str(); -} - -// Formats an int value as "%X". -std::string String::FormatHexInt(int value) { - return FormatHexUInt32(static_cast(value)); -} - -// Formats a byte as "%02X". -std::string String::FormatByte(unsigned char value) { - std::stringstream ss; - ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase - << static_cast(value); - return ss.str(); -} - -// Converts the buffer in a stringstream to an std::string, converting NUL -// bytes to "\\0" along the way. -std::string StringStreamToString(::std::stringstream* ss) { - const ::std::string& str = ss->str(); - const char* const start = str.c_str(); - const char* const end = start + str.length(); - - std::string result; - result.reserve(static_cast(2 * (end - start))); - for (const char* ch = start; ch != end; ++ch) { - if (*ch == '\0') { - result += "\\0"; // Replaces NUL with "\\0"; - } else { - result += *ch; - } - } - - return result; -} - -// Appends the user-supplied message to the Google-Test-generated message. -std::string AppendUserMessage(const std::string& gtest_msg, - const Message& user_msg) { - // Appends the user message if it's non-empty. - const std::string user_msg_string = user_msg.GetString(); - if (user_msg_string.empty()) { - return gtest_msg; - } - if (gtest_msg.empty()) { - return user_msg_string; - } - return gtest_msg + "\n" + user_msg_string; -} - -} // namespace internal - -// class TestResult - -// Creates an empty TestResult. -TestResult::TestResult() - : death_test_count_(0), start_timestamp_(0), elapsed_time_(0) {} - -// D'tor. -TestResult::~TestResult() { -} - -// Returns the i-th test part result among all the results. i can -// range from 0 to total_part_count() - 1. If i is not in that range, -// aborts the program. -const TestPartResult& TestResult::GetTestPartResult(int i) const { - if (i < 0 || i >= total_part_count()) - internal::posix::Abort(); - return test_part_results_.at(static_cast(i)); -} - -// Returns the i-th test property. i can range from 0 to -// test_property_count() - 1. If i is not in that range, aborts the -// program. -const TestProperty& TestResult::GetTestProperty(int i) const { - if (i < 0 || i >= test_property_count()) - internal::posix::Abort(); - return test_properties_.at(static_cast(i)); -} - -// Clears the test part results. -void TestResult::ClearTestPartResults() { - test_part_results_.clear(); -} - -// Adds a test part result to the list. -void TestResult::AddTestPartResult(const TestPartResult& test_part_result) { - test_part_results_.push_back(test_part_result); -} - -// Adds a test property to the list. If a property with the same key as the -// supplied property is already represented, the value of this test_property -// replaces the old value for that key. -void TestResult::RecordProperty(const std::string& xml_element, - const TestProperty& test_property) { - if (!ValidateTestProperty(xml_element, test_property)) { - return; - } - internal::MutexLock lock(&test_properties_mutex_); - const std::vector::iterator property_with_matching_key = - std::find_if(test_properties_.begin(), test_properties_.end(), - internal::TestPropertyKeyIs(test_property.key())); - if (property_with_matching_key == test_properties_.end()) { - test_properties_.push_back(test_property); - return; - } - property_with_matching_key->SetValue(test_property.value()); -} - -// The list of reserved attributes used in the element of XML -// output. -static const char* const kReservedTestSuitesAttributes[] = { - "disabled", - "errors", - "failures", - "name", - "random_seed", - "tests", - "time", - "timestamp" -}; - -// The list of reserved attributes used in the element of XML -// output. -static const char* const kReservedTestSuiteAttributes[] = { - "disabled", "errors", "failures", "name", - "tests", "time", "timestamp", "skipped"}; - -// The list of reserved attributes used in the element of XML output. -static const char* const kReservedTestCaseAttributes[] = { - "classname", "name", "status", "time", "type_param", - "value_param", "file", "line"}; - -// Use a slightly different set for allowed output to ensure existing tests can -// still RecordProperty("result") or "RecordProperty(timestamp") -static const char* const kReservedOutputTestCaseAttributes[] = { - "classname", "name", "status", "time", "type_param", - "value_param", "file", "line", "result", "timestamp"}; - -template -std::vector ArrayAsVector(const char* const (&array)[kSize]) { - return std::vector(array, array + kSize); -} - -static std::vector GetReservedAttributesForElement( - const std::string& xml_element) { - if (xml_element == "testsuites") { - return ArrayAsVector(kReservedTestSuitesAttributes); - } else if (xml_element == "testsuite") { - return ArrayAsVector(kReservedTestSuiteAttributes); - } else if (xml_element == "testcase") { - return ArrayAsVector(kReservedTestCaseAttributes); - } else { - GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element; - } - // This code is unreachable but some compilers may not realizes that. - return std::vector(); -} - -// TODO(jdesprez): Merge the two getReserved attributes once skip is improved -static std::vector GetReservedOutputAttributesForElement( - const std::string& xml_element) { - if (xml_element == "testsuites") { - return ArrayAsVector(kReservedTestSuitesAttributes); - } else if (xml_element == "testsuite") { - return ArrayAsVector(kReservedTestSuiteAttributes); - } else if (xml_element == "testcase") { - return ArrayAsVector(kReservedOutputTestCaseAttributes); - } else { - GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element; - } - // This code is unreachable but some compilers may not realizes that. - return std::vector(); -} - -static std::string FormatWordList(const std::vector& words) { - Message word_list; - for (size_t i = 0; i < words.size(); ++i) { - if (i > 0 && words.size() > 2) { - word_list << ", "; - } - if (i == words.size() - 1) { - word_list << "and "; - } - word_list << "'" << words[i] << "'"; - } - return word_list.GetString(); -} - -static bool ValidateTestPropertyName( - const std::string& property_name, - const std::vector& reserved_names) { - if (std::find(reserved_names.begin(), reserved_names.end(), property_name) != - reserved_names.end()) { - ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name - << " (" << FormatWordList(reserved_names) - << " are reserved by " << GTEST_NAME_ << ")"; - return false; - } - return true; -} - -// Adds a failure if the key is a reserved attribute of the element named -// xml_element. Returns true if the property is valid. -bool TestResult::ValidateTestProperty(const std::string& xml_element, - const TestProperty& test_property) { - return ValidateTestPropertyName(test_property.key(), - GetReservedAttributesForElement(xml_element)); -} - -// Clears the object. -void TestResult::Clear() { - test_part_results_.clear(); - test_properties_.clear(); - death_test_count_ = 0; - elapsed_time_ = 0; -} - -// Returns true off the test part was skipped. -static bool TestPartSkipped(const TestPartResult& result) { - return result.skipped(); -} - -// Returns true if and only if the test was skipped. -bool TestResult::Skipped() const { - return !Failed() && CountIf(test_part_results_, TestPartSkipped) > 0; -} - -// Returns true if and only if the test failed. -bool TestResult::Failed() const { - for (int i = 0; i < total_part_count(); ++i) { - if (GetTestPartResult(i).failed()) - return true; - } - return false; -} - -// Returns true if and only if the test part fatally failed. -static bool TestPartFatallyFailed(const TestPartResult& result) { - return result.fatally_failed(); -} - -// Returns true if and only if the test fatally failed. -bool TestResult::HasFatalFailure() const { - return CountIf(test_part_results_, TestPartFatallyFailed) > 0; -} - -// Returns true if and only if the test part non-fatally failed. -static bool TestPartNonfatallyFailed(const TestPartResult& result) { - return result.nonfatally_failed(); -} - -// Returns true if and only if the test has a non-fatal failure. -bool TestResult::HasNonfatalFailure() const { - return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0; -} - -// Gets the number of all test parts. This is the sum of the number -// of successful test parts and the number of failed test parts. -int TestResult::total_part_count() const { - return static_cast(test_part_results_.size()); -} - -// Returns the number of the test properties. -int TestResult::test_property_count() const { - return static_cast(test_properties_.size()); -} - -// class Test - -// Creates a Test object. - -// The c'tor saves the states of all flags. -Test::Test() - : gtest_flag_saver_(new GTEST_FLAG_SAVER_) { -} - -// The d'tor restores the states of all flags. The actual work is -// done by the d'tor of the gtest_flag_saver_ field, and thus not -// visible here. -Test::~Test() { -} - -// Sets up the test fixture. -// -// A sub-class may override this. -void Test::SetUp() { -} - -// Tears down the test fixture. -// -// A sub-class may override this. -void Test::TearDown() { -} - -// Allows user supplied key value pairs to be recorded for later output. -void Test::RecordProperty(const std::string& key, const std::string& value) { - UnitTest::GetInstance()->RecordProperty(key, value); -} - -// Allows user supplied key value pairs to be recorded for later output. -void Test::RecordProperty(const std::string& key, int value) { - Message value_message; - value_message << value; - RecordProperty(key, value_message.GetString().c_str()); -} - -namespace internal { - -void ReportFailureInUnknownLocation(TestPartResult::Type result_type, - const std::string& message) { - // This function is a friend of UnitTest and as such has access to - // AddTestPartResult. - UnitTest::GetInstance()->AddTestPartResult( - result_type, - nullptr, // No info about the source file where the exception occurred. - -1, // We have no info on which line caused the exception. - message, - ""); // No stack trace, either. -} - -} // namespace internal - -// Google Test requires all tests in the same test suite to use the same test -// fixture class. This function checks if the current test has the -// same fixture class as the first test in the current test suite. If -// yes, it returns true; otherwise it generates a Google Test failure and -// returns false. -bool Test::HasSameFixtureClass() { - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - const TestSuite* const test_suite = impl->current_test_suite(); - - // Info about the first test in the current test suite. - const TestInfo* const first_test_info = test_suite->test_info_list()[0]; - const internal::TypeId first_fixture_id = first_test_info->fixture_class_id_; - const char* const first_test_name = first_test_info->name(); - - // Info about the current test. - const TestInfo* const this_test_info = impl->current_test_info(); - const internal::TypeId this_fixture_id = this_test_info->fixture_class_id_; - const char* const this_test_name = this_test_info->name(); - - if (this_fixture_id != first_fixture_id) { - // Is the first test defined using TEST? - const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId(); - // Is this test defined using TEST? - const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId(); - - if (first_is_TEST || this_is_TEST) { - // Both TEST and TEST_F appear in same test suite, which is incorrect. - // Tell the user how to fix this. - - // Gets the name of the TEST and the name of the TEST_F. Note - // that first_is_TEST and this_is_TEST cannot both be true, as - // the fixture IDs are different for the two tests. - const char* const TEST_name = - first_is_TEST ? first_test_name : this_test_name; - const char* const TEST_F_name = - first_is_TEST ? this_test_name : first_test_name; - - ADD_FAILURE() - << "All tests in the same test suite must use the same test fixture\n" - << "class, so mixing TEST_F and TEST in the same test suite is\n" - << "illegal. In test suite " << this_test_info->test_suite_name() - << ",\n" - << "test " << TEST_F_name << " is defined using TEST_F but\n" - << "test " << TEST_name << " is defined using TEST. You probably\n" - << "want to change the TEST to TEST_F or move it to another test\n" - << "case."; - } else { - // Two fixture classes with the same name appear in two different - // namespaces, which is not allowed. Tell the user how to fix this. - ADD_FAILURE() - << "All tests in the same test suite must use the same test fixture\n" - << "class. However, in test suite " - << this_test_info->test_suite_name() << ",\n" - << "you defined test " << first_test_name << " and test " - << this_test_name << "\n" - << "using two different test fixture classes. This can happen if\n" - << "the two classes are from different namespaces or translation\n" - << "units and have the same name. You should probably rename one\n" - << "of the classes to put the tests into different test suites."; - } - return false; - } - - return true; -} - -#if GTEST_HAS_SEH - -// Adds an "exception thrown" fatal failure to the current test. This -// function returns its result via an output parameter pointer because VC++ -// prohibits creation of objects with destructors on stack in functions -// using __try (see error C2712). -static std::string* FormatSehExceptionMessage(DWORD exception_code, - const char* location) { - Message message; - message << "SEH exception with code 0x" << std::setbase(16) << - exception_code << std::setbase(10) << " thrown in " << location << "."; - - return new std::string(message.GetString()); -} - -#endif // GTEST_HAS_SEH - -namespace internal { - -#if GTEST_HAS_EXCEPTIONS - -// Adds an "exception thrown" fatal failure to the current test. -static std::string FormatCxxExceptionMessage(const char* description, - const char* location) { - Message message; - if (description != nullptr) { - message << "C++ exception with description \"" << description << "\""; - } else { - message << "Unknown C++ exception"; - } - message << " thrown in " << location << "."; - - return message.GetString(); -} - -static std::string PrintTestPartResultToString( - const TestPartResult& test_part_result); - -GoogleTestFailureException::GoogleTestFailureException( - const TestPartResult& failure) - : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {} - -#endif // GTEST_HAS_EXCEPTIONS - -// We put these helper functions in the internal namespace as IBM's xlC -// compiler rejects the code if they were declared static. - -// Runs the given method and handles SEH exceptions it throws, when -// SEH is supported; returns the 0-value for type Result in case of an -// SEH exception. (Microsoft compilers cannot handle SEH and C++ -// exceptions in the same function. Therefore, we provide a separate -// wrapper function for handling SEH exceptions.) -template -Result HandleSehExceptionsInMethodIfSupported( - T* object, Result (T::*method)(), const char* location) { -#if GTEST_HAS_SEH - __try { - return (object->*method)(); - } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT - GetExceptionCode())) { - // We create the exception message on the heap because VC++ prohibits - // creation of objects with destructors on stack in functions using __try - // (see error C2712). - std::string* exception_message = FormatSehExceptionMessage( - GetExceptionCode(), location); - internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure, - *exception_message); - delete exception_message; - return static_cast(0); - } -#else - (void)location; - return (object->*method)(); -#endif // GTEST_HAS_SEH -} - -// Runs the given method and catches and reports C++ and/or SEH-style -// exceptions, if they are supported; returns the 0-value for type -// Result in case of an SEH exception. -template -Result HandleExceptionsInMethodIfSupported( - T* object, Result (T::*method)(), const char* location) { - // NOTE: The user code can affect the way in which Google Test handles - // exceptions by setting GTEST_FLAG(catch_exceptions), but only before - // RUN_ALL_TESTS() starts. It is technically possible to check the flag - // after the exception is caught and either report or re-throw the - // exception based on the flag's value: - // - // try { - // // Perform the test method. - // } catch (...) { - // if (GTEST_FLAG(catch_exceptions)) - // // Report the exception as failure. - // else - // throw; // Re-throws the original exception. - // } - // - // However, the purpose of this flag is to allow the program to drop into - // the debugger when the exception is thrown. On most platforms, once the - // control enters the catch block, the exception origin information is - // lost and the debugger will stop the program at the point of the - // re-throw in this function -- instead of at the point of the original - // throw statement in the code under test. For this reason, we perform - // the check early, sacrificing the ability to affect Google Test's - // exception handling in the method where the exception is thrown. - if (internal::GetUnitTestImpl()->catch_exceptions()) { -#if GTEST_HAS_EXCEPTIONS - try { - return HandleSehExceptionsInMethodIfSupported(object, method, location); - } catch (const AssertionException&) { // NOLINT - // This failure was reported already. - } catch (const internal::GoogleTestFailureException&) { // NOLINT - // This exception type can only be thrown by a failed Google - // Test assertion with the intention of letting another testing - // framework catch it. Therefore we just re-throw it. - throw; - } catch (const std::exception& e) { // NOLINT - internal::ReportFailureInUnknownLocation( - TestPartResult::kFatalFailure, - FormatCxxExceptionMessage(e.what(), location)); - } catch (...) { // NOLINT - internal::ReportFailureInUnknownLocation( - TestPartResult::kFatalFailure, - FormatCxxExceptionMessage(nullptr, location)); - } - return static_cast(0); -#else - return HandleSehExceptionsInMethodIfSupported(object, method, location); -#endif // GTEST_HAS_EXCEPTIONS - } else { - return (object->*method)(); - } -} - -} // namespace internal - -// Runs the test and updates the test result. -void Test::Run() { - if (!HasSameFixtureClass()) return; - - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()"); - // We will run the test only if SetUp() was successful and didn't call - // GTEST_SKIP(). - if (!HasFatalFailure() && !IsSkipped()) { - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - this, &Test::TestBody, "the test body"); - } - - // However, we want to clean up as much as possible. Hence we will - // always call TearDown(), even if SetUp() or the test body has - // failed. - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - this, &Test::TearDown, "TearDown()"); -} - -// Returns true if and only if the current test has a fatal failure. -bool Test::HasFatalFailure() { - return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure(); -} - -// Returns true if and only if the current test has a non-fatal failure. -bool Test::HasNonfatalFailure() { - return internal::GetUnitTestImpl()->current_test_result()-> - HasNonfatalFailure(); -} - -// Returns true if and only if the current test was skipped. -bool Test::IsSkipped() { - return internal::GetUnitTestImpl()->current_test_result()->Skipped(); -} - -// class TestInfo - -// Constructs a TestInfo object. It assumes ownership of the test factory -// object. -TestInfo::TestInfo(const std::string& a_test_suite_name, - const std::string& a_name, const char* a_type_param, - const char* a_value_param, - internal::CodeLocation a_code_location, - internal::TypeId fixture_class_id, - internal::TestFactoryBase* factory) - : test_suite_name_(a_test_suite_name), - name_(a_name), - type_param_(a_type_param ? new std::string(a_type_param) : nullptr), - value_param_(a_value_param ? new std::string(a_value_param) : nullptr), - location_(a_code_location), - fixture_class_id_(fixture_class_id), - should_run_(false), - is_disabled_(false), - matches_filter_(false), - is_in_another_shard_(false), - factory_(factory), - result_() {} - -// Destructs a TestInfo object. -TestInfo::~TestInfo() { delete factory_; } - -namespace internal { - -// Creates a new TestInfo object and registers it with Google Test; -// returns the created object. -// -// Arguments: -// -// test_suite_name: name of the test suite -// name: name of the test -// type_param: the name of the test's type parameter, or NULL if -// this is not a typed or a type-parameterized test. -// value_param: text representation of the test's value parameter, -// or NULL if this is not a value-parameterized test. -// code_location: code location where the test is defined -// fixture_class_id: ID of the test fixture class -// set_up_tc: pointer to the function that sets up the test suite -// tear_down_tc: pointer to the function that tears down the test suite -// factory: pointer to the factory that creates a test object. -// The newly created TestInfo instance will assume -// ownership of the factory object. -TestInfo* MakeAndRegisterTestInfo( - const char* test_suite_name, const char* name, const char* type_param, - const char* value_param, CodeLocation code_location, - TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, - TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory) { - TestInfo* const test_info = - new TestInfo(test_suite_name, name, type_param, value_param, - code_location, fixture_class_id, factory); - GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info); - return test_info; -} - -void ReportInvalidTestSuiteType(const char* test_suite_name, - CodeLocation code_location) { - Message errors; - errors - << "Attempted redefinition of test suite " << test_suite_name << ".\n" - << "All tests in the same test suite must use the same test fixture\n" - << "class. However, in test suite " << test_suite_name << ", you tried\n" - << "to define a test using a fixture class different from the one\n" - << "used earlier. This can happen if the two fixture classes are\n" - << "from different namespaces and have the same name. You should\n" - << "probably rename one of the classes to put the tests into different\n" - << "test suites."; - - GTEST_LOG_(ERROR) << FormatFileLocation(code_location.file.c_str(), - code_location.line) - << " " << errors.GetString(); -} -} // namespace internal - -namespace { - -// A predicate that checks the test name of a TestInfo against a known -// value. -// -// This is used for implementation of the TestSuite class only. We put -// it in the anonymous namespace to prevent polluting the outer -// namespace. -// -// TestNameIs is copyable. -class TestNameIs { - public: - // Constructor. - // - // TestNameIs has NO default constructor. - explicit TestNameIs(const char* name) - : name_(name) {} - - // Returns true if and only if the test name of test_info matches name_. - bool operator()(const TestInfo * test_info) const { - return test_info && test_info->name() == name_; - } - - private: - std::string name_; -}; - -} // namespace - -namespace internal { - -// This method expands all parameterized tests registered with macros TEST_P -// and INSTANTIATE_TEST_SUITE_P into regular tests and registers those. -// This will be done just once during the program runtime. -void UnitTestImpl::RegisterParameterizedTests() { - if (!parameterized_tests_registered_) { - parameterized_test_registry_.RegisterTests(); - type_parameterized_test_registry_.CheckForInstantiations(); - parameterized_tests_registered_ = true; - } -} - -} // namespace internal - -// Creates the test object, runs it, records its result, and then -// deletes it. -void TestInfo::Run() { - if (!should_run_) return; - - // Tells UnitTest where to store test result. - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - impl->set_current_test_info(this); - - TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater(); - - // Notifies the unit test event listeners that a test is about to start. - repeater->OnTestStart(*this); - - result_.set_start_timestamp(internal::GetTimeInMillis()); - internal::Timer timer; - - impl->os_stack_trace_getter()->UponLeavingGTest(); - - // Creates the test object. - Test* const test = internal::HandleExceptionsInMethodIfSupported( - factory_, &internal::TestFactoryBase::CreateTest, - "the test fixture's constructor"); - - // Runs the test if the constructor didn't generate a fatal failure or invoke - // GTEST_SKIP(). - // Note that the object will not be null - if (!Test::HasFatalFailure() && !Test::IsSkipped()) { - // This doesn't throw as all user code that can throw are wrapped into - // exception handling code. - test->Run(); - } - - if (test != nullptr) { - // Deletes the test object. - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - test, &Test::DeleteSelf_, "the test fixture's destructor"); - } - - result_.set_elapsed_time(timer.Elapsed()); - - // Notifies the unit test event listener that a test has just finished. - repeater->OnTestEnd(*this); - - // Tells UnitTest to stop associating assertion results to this - // test. - impl->set_current_test_info(nullptr); -} - -// Skip and records a skipped test result for this object. -void TestInfo::Skip() { - if (!should_run_) return; - - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - impl->set_current_test_info(this); - - TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater(); - - // Notifies the unit test event listeners that a test is about to start. - repeater->OnTestStart(*this); - - const TestPartResult test_part_result = - TestPartResult(TestPartResult::kSkip, this->file(), this->line(), ""); - impl->GetTestPartResultReporterForCurrentThread()->ReportTestPartResult( - test_part_result); - - // Notifies the unit test event listener that a test has just finished. - repeater->OnTestEnd(*this); - impl->set_current_test_info(nullptr); -} - -// class TestSuite - -// Gets the number of successful tests in this test suite. -int TestSuite::successful_test_count() const { - return CountIf(test_info_list_, TestPassed); -} - -// Gets the number of successful tests in this test suite. -int TestSuite::skipped_test_count() const { - return CountIf(test_info_list_, TestSkipped); -} - -// Gets the number of failed tests in this test suite. -int TestSuite::failed_test_count() const { - return CountIf(test_info_list_, TestFailed); -} - -// Gets the number of disabled tests that will be reported in the XML report. -int TestSuite::reportable_disabled_test_count() const { - return CountIf(test_info_list_, TestReportableDisabled); -} - -// Gets the number of disabled tests in this test suite. -int TestSuite::disabled_test_count() const { - return CountIf(test_info_list_, TestDisabled); -} - -// Gets the number of tests to be printed in the XML report. -int TestSuite::reportable_test_count() const { - return CountIf(test_info_list_, TestReportable); -} - -// Get the number of tests in this test suite that should run. -int TestSuite::test_to_run_count() const { - return CountIf(test_info_list_, ShouldRunTest); -} - -// Gets the number of all tests. -int TestSuite::total_test_count() const { - return static_cast(test_info_list_.size()); -} - -// Creates a TestSuite with the given name. -// -// Arguments: -// -// a_name: name of the test suite -// a_type_param: the name of the test suite's type parameter, or NULL if -// this is not a typed or a type-parameterized test suite. -// set_up_tc: pointer to the function that sets up the test suite -// tear_down_tc: pointer to the function that tears down the test suite -TestSuite::TestSuite(const char* a_name, const char* a_type_param, - internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc) - : name_(a_name), - type_param_(a_type_param ? new std::string(a_type_param) : nullptr), - set_up_tc_(set_up_tc), - tear_down_tc_(tear_down_tc), - should_run_(false), - start_timestamp_(0), - elapsed_time_(0) {} - -// Destructor of TestSuite. -TestSuite::~TestSuite() { - // Deletes every Test in the collection. - ForEach(test_info_list_, internal::Delete); -} - -// Returns the i-th test among all the tests. i can range from 0 to -// total_test_count() - 1. If i is not in that range, returns NULL. -const TestInfo* TestSuite::GetTestInfo(int i) const { - const int index = GetElementOr(test_indices_, i, -1); - return index < 0 ? nullptr : test_info_list_[static_cast(index)]; -} - -// Returns the i-th test among all the tests. i can range from 0 to -// total_test_count() - 1. If i is not in that range, returns NULL. -TestInfo* TestSuite::GetMutableTestInfo(int i) { - const int index = GetElementOr(test_indices_, i, -1); - return index < 0 ? nullptr : test_info_list_[static_cast(index)]; -} - -// Adds a test to this test suite. Will delete the test upon -// destruction of the TestSuite object. -void TestSuite::AddTestInfo(TestInfo* test_info) { - test_info_list_.push_back(test_info); - test_indices_.push_back(static_cast(test_indices_.size())); -} - -// Runs every test in this TestSuite. -void TestSuite::Run() { - if (!should_run_) return; - - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - impl->set_current_test_suite(this); - - TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater(); - - // Call both legacy and the new API - repeater->OnTestSuiteStart(*this); -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - repeater->OnTestCaseStart(*this); -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - this, &TestSuite::RunSetUpTestSuite, "SetUpTestSuite()"); - - start_timestamp_ = internal::GetTimeInMillis(); - internal::Timer timer; - for (int i = 0; i < total_test_count(); i++) { - GetMutableTestInfo(i)->Run(); - if (GTEST_FLAG(fail_fast) && GetMutableTestInfo(i)->result()->Failed()) { - for (int j = i + 1; j < total_test_count(); j++) { - GetMutableTestInfo(j)->Skip(); - } - break; - } - } - elapsed_time_ = timer.Elapsed(); - - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - this, &TestSuite::RunTearDownTestSuite, "TearDownTestSuite()"); - - // Call both legacy and the new API - repeater->OnTestSuiteEnd(*this); -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - repeater->OnTestCaseEnd(*this); -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - impl->set_current_test_suite(nullptr); -} - -// Skips all tests under this TestSuite. -void TestSuite::Skip() { - if (!should_run_) return; - - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - impl->set_current_test_suite(this); - - TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater(); - - // Call both legacy and the new API - repeater->OnTestSuiteStart(*this); -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - repeater->OnTestCaseStart(*this); -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - for (int i = 0; i < total_test_count(); i++) { - GetMutableTestInfo(i)->Skip(); - } - - // Call both legacy and the new API - repeater->OnTestSuiteEnd(*this); - // Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - repeater->OnTestCaseEnd(*this); -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - impl->set_current_test_suite(nullptr); -} - -// Clears the results of all tests in this test suite. -void TestSuite::ClearResult() { - ad_hoc_test_result_.Clear(); - ForEach(test_info_list_, TestInfo::ClearTestResult); -} - -// Shuffles the tests in this test suite. -void TestSuite::ShuffleTests(internal::Random* random) { - Shuffle(random, &test_indices_); -} - -// Restores the test order to before the first shuffle. -void TestSuite::UnshuffleTests() { - for (size_t i = 0; i < test_indices_.size(); i++) { - test_indices_[i] = static_cast(i); - } -} - -// Formats a countable noun. Depending on its quantity, either the -// singular form or the plural form is used. e.g. -// -// FormatCountableNoun(1, "formula", "formuli") returns "1 formula". -// FormatCountableNoun(5, "book", "books") returns "5 books". -static std::string FormatCountableNoun(int count, - const char * singular_form, - const char * plural_form) { - return internal::StreamableToString(count) + " " + - (count == 1 ? singular_form : plural_form); -} - -// Formats the count of tests. -static std::string FormatTestCount(int test_count) { - return FormatCountableNoun(test_count, "test", "tests"); -} - -// Formats the count of test suites. -static std::string FormatTestSuiteCount(int test_suite_count) { - return FormatCountableNoun(test_suite_count, "test suite", "test suites"); -} - -// Converts a TestPartResult::Type enum to human-friendly string -// representation. Both kNonFatalFailure and kFatalFailure are translated -// to "Failure", as the user usually doesn't care about the difference -// between the two when viewing the test result. -static const char * TestPartResultTypeToString(TestPartResult::Type type) { - switch (type) { - case TestPartResult::kSkip: - return "Skipped\n"; - case TestPartResult::kSuccess: - return "Success"; - - case TestPartResult::kNonFatalFailure: - case TestPartResult::kFatalFailure: -#ifdef _MSC_VER - return "error: "; -#else - return "Failure\n"; -#endif - default: - return "Unknown result type"; - } -} - -namespace internal { -namespace { -enum class GTestColor { kDefault, kRed, kGreen, kYellow }; -} // namespace - -// Prints a TestPartResult to an std::string. -static std::string PrintTestPartResultToString( - const TestPartResult& test_part_result) { - return (Message() - << internal::FormatFileLocation(test_part_result.file_name(), - test_part_result.line_number()) - << " " << TestPartResultTypeToString(test_part_result.type()) - << test_part_result.message()).GetString(); -} - -// Prints a TestPartResult. -static void PrintTestPartResult(const TestPartResult& test_part_result) { - const std::string& result = - PrintTestPartResultToString(test_part_result); - printf("%s\n", result.c_str()); - fflush(stdout); - // If the test program runs in Visual Studio or a debugger, the - // following statements add the test part result message to the Output - // window such that the user can double-click on it to jump to the - // corresponding source code location; otherwise they do nothing. -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE - // We don't call OutputDebugString*() on Windows Mobile, as printing - // to stdout is done by OutputDebugString() there already - we don't - // want the same message printed twice. - ::OutputDebugStringA(result.c_str()); - ::OutputDebugStringA("\n"); -#endif -} - -// class PrettyUnitTestResultPrinter -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \ - !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW - -// Returns the character attribute for the given color. -static WORD GetColorAttribute(GTestColor color) { - switch (color) { - case GTestColor::kRed: - return FOREGROUND_RED; - case GTestColor::kGreen: - return FOREGROUND_GREEN; - case GTestColor::kYellow: - return FOREGROUND_RED | FOREGROUND_GREEN; - default: return 0; - } -} - -static int GetBitOffset(WORD color_mask) { - if (color_mask == 0) return 0; - - int bitOffset = 0; - while ((color_mask & 1) == 0) { - color_mask >>= 1; - ++bitOffset; - } - return bitOffset; -} - -static WORD GetNewColor(GTestColor color, WORD old_color_attrs) { - // Let's reuse the BG - static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | - BACKGROUND_RED | BACKGROUND_INTENSITY; - static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | - FOREGROUND_RED | FOREGROUND_INTENSITY; - const WORD existing_bg = old_color_attrs & background_mask; - - WORD new_color = - GetColorAttribute(color) | existing_bg | FOREGROUND_INTENSITY; - static const int bg_bitOffset = GetBitOffset(background_mask); - static const int fg_bitOffset = GetBitOffset(foreground_mask); - - if (((new_color & background_mask) >> bg_bitOffset) == - ((new_color & foreground_mask) >> fg_bitOffset)) { - new_color ^= FOREGROUND_INTENSITY; // invert intensity - } - return new_color; -} - -#else - -// Returns the ANSI color code for the given color. GTestColor::kDefault is -// an invalid input. -static const char* GetAnsiColorCode(GTestColor color) { - switch (color) { - case GTestColor::kRed: - return "1"; - case GTestColor::kGreen: - return "2"; - case GTestColor::kYellow: - return "3"; - default: - return nullptr; - } -} - -#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE - -// Returns true if and only if Google Test should use colors in the output. -bool ShouldUseColor(bool stdout_is_tty) { - const char* const gtest_color = GTEST_FLAG(color).c_str(); - - if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) { -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW - // On Windows the TERM variable is usually not set, but the - // console there does support colors. - return stdout_is_tty; -#else - // On non-Windows platforms, we rely on the TERM variable. - const char* const term = posix::GetEnv("TERM"); - const bool term_supports_color = - String::CStringEquals(term, "xterm") || - String::CStringEquals(term, "xterm-color") || - String::CStringEquals(term, "xterm-256color") || - String::CStringEquals(term, "screen") || - String::CStringEquals(term, "screen-256color") || - String::CStringEquals(term, "tmux") || - String::CStringEquals(term, "tmux-256color") || - String::CStringEquals(term, "rxvt-unicode") || - String::CStringEquals(term, "rxvt-unicode-256color") || - String::CStringEquals(term, "linux") || - String::CStringEquals(term, "cygwin"); - return stdout_is_tty && term_supports_color; -#endif // GTEST_OS_WINDOWS - } - - return String::CaseInsensitiveCStringEquals(gtest_color, "yes") || - String::CaseInsensitiveCStringEquals(gtest_color, "true") || - String::CaseInsensitiveCStringEquals(gtest_color, "t") || - String::CStringEquals(gtest_color, "1"); - // We take "yes", "true", "t", and "1" as meaning "yes". If the - // value is neither one of these nor "auto", we treat it as "no" to - // be conservative. -} - -// Helpers for printing colored strings to stdout. Note that on Windows, we -// cannot simply emit special characters and have the terminal change colors. -// This routine must actually emit the characters rather than return a string -// that would be colored when printed, as can be done on Linux. - -GTEST_ATTRIBUTE_PRINTF_(2, 3) -static void ColoredPrintf(GTestColor color, const char *fmt, ...) { - va_list args; - va_start(args, fmt); - -#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS || GTEST_OS_IOS || \ - GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT || defined(ESP_PLATFORM) - const bool use_color = AlwaysFalse(); -#else - static const bool in_color_mode = - ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0); - const bool use_color = in_color_mode && (color != GTestColor::kDefault); -#endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS - - if (!use_color) { - vprintf(fmt, args); - va_end(args); - return; - } - -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \ - !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW - const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); - - // Gets the current text color. - CONSOLE_SCREEN_BUFFER_INFO buffer_info; - GetConsoleScreenBufferInfo(stdout_handle, &buffer_info); - const WORD old_color_attrs = buffer_info.wAttributes; - const WORD new_color = GetNewColor(color, old_color_attrs); - - // We need to flush the stream buffers into the console before each - // SetConsoleTextAttribute call lest it affect the text that is already - // printed but has not yet reached the console. - fflush(stdout); - SetConsoleTextAttribute(stdout_handle, new_color); - - vprintf(fmt, args); - - fflush(stdout); - // Restores the text color. - SetConsoleTextAttribute(stdout_handle, old_color_attrs); -#else - printf("\033[0;3%sm", GetAnsiColorCode(color)); - vprintf(fmt, args); - printf("\033[m"); // Resets the terminal to default. -#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE - va_end(args); -} - -// Text printed in Google Test's text output and --gtest_list_tests -// output to label the type parameter and value parameter for a test. -static const char kTypeParamLabel[] = "TypeParam"; -static const char kValueParamLabel[] = "GetParam()"; - -static void PrintFullTestCommentIfPresent(const TestInfo& test_info) { - const char* const type_param = test_info.type_param(); - const char* const value_param = test_info.value_param(); - - if (type_param != nullptr || value_param != nullptr) { - printf(", where "); - if (type_param != nullptr) { - printf("%s = %s", kTypeParamLabel, type_param); - if (value_param != nullptr) printf(" and "); - } - if (value_param != nullptr) { - printf("%s = %s", kValueParamLabel, value_param); - } - } -} - -// This class implements the TestEventListener interface. -// -// Class PrettyUnitTestResultPrinter is copyable. -class PrettyUnitTestResultPrinter : public TestEventListener { - public: - PrettyUnitTestResultPrinter() {} - static void PrintTestName(const char* test_suite, const char* test) { - printf("%s.%s", test_suite, test); - } - - // The following methods override what's in the TestEventListener class. - void OnTestProgramStart(const UnitTest& /*unit_test*/) override {} - void OnTestIterationStart(const UnitTest& unit_test, int iteration) override; - void OnEnvironmentsSetUpStart(const UnitTest& unit_test) override; - void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {} -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseStart(const TestCase& test_case) override; -#else - void OnTestSuiteStart(const TestSuite& test_suite) override; -#endif // OnTestCaseStart - - void OnTestStart(const TestInfo& test_info) override; - - void OnTestPartResult(const TestPartResult& result) override; - void OnTestEnd(const TestInfo& test_info) override; -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseEnd(const TestCase& test_case) override; -#else - void OnTestSuiteEnd(const TestSuite& test_suite) override; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - void OnEnvironmentsTearDownStart(const UnitTest& unit_test) override; - void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {} - void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override; - void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {} - - private: - static void PrintFailedTests(const UnitTest& unit_test); - static void PrintFailedTestSuites(const UnitTest& unit_test); - static void PrintSkippedTests(const UnitTest& unit_test); -}; - - // Fired before each iteration of tests starts. -void PrettyUnitTestResultPrinter::OnTestIterationStart( - const UnitTest& unit_test, int iteration) { - if (GTEST_FLAG(repeat) != 1) - printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1); - - const char* const filter = GTEST_FLAG(filter).c_str(); - - // Prints the filter if it's not *. This reminds the user that some - // tests may be skipped. - if (!String::CStringEquals(filter, kUniversalFilter)) { - ColoredPrintf(GTestColor::kYellow, "Note: %s filter = %s\n", GTEST_NAME_, - filter); - } - - if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) { - const int32_t shard_index = Int32FromEnvOrDie(kTestShardIndex, -1); - ColoredPrintf(GTestColor::kYellow, "Note: This is test shard %d of %s.\n", - static_cast(shard_index) + 1, - internal::posix::GetEnv(kTestTotalShards)); - } - - if (GTEST_FLAG(shuffle)) { - ColoredPrintf(GTestColor::kYellow, - "Note: Randomizing tests' orders with a seed of %d .\n", - unit_test.random_seed()); - } - - ColoredPrintf(GTestColor::kGreen, "[==========] "); - printf("Running %s from %s.\n", - FormatTestCount(unit_test.test_to_run_count()).c_str(), - FormatTestSuiteCount(unit_test.test_suite_to_run_count()).c_str()); - fflush(stdout); -} - -void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart( - const UnitTest& /*unit_test*/) { - ColoredPrintf(GTestColor::kGreen, "[----------] "); - printf("Global test environment set-up.\n"); - fflush(stdout); -} - -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) { - const std::string counts = - FormatCountableNoun(test_case.test_to_run_count(), "test", "tests"); - ColoredPrintf(GTestColor::kGreen, "[----------] "); - printf("%s from %s", counts.c_str(), test_case.name()); - if (test_case.type_param() == nullptr) { - printf("\n"); - } else { - printf(", where %s = %s\n", kTypeParamLabel, test_case.type_param()); - } - fflush(stdout); -} -#else -void PrettyUnitTestResultPrinter::OnTestSuiteStart( - const TestSuite& test_suite) { - const std::string counts = - FormatCountableNoun(test_suite.test_to_run_count(), "test", "tests"); - ColoredPrintf(GTestColor::kGreen, "[----------] "); - printf("%s from %s", counts.c_str(), test_suite.name()); - if (test_suite.type_param() == nullptr) { - printf("\n"); - } else { - printf(", where %s = %s\n", kTypeParamLabel, test_suite.type_param()); - } - fflush(stdout); -} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) { - ColoredPrintf(GTestColor::kGreen, "[ RUN ] "); - PrintTestName(test_info.test_suite_name(), test_info.name()); - printf("\n"); - fflush(stdout); -} - -// Called after an assertion failure. -void PrettyUnitTestResultPrinter::OnTestPartResult( - const TestPartResult& result) { - switch (result.type()) { - // If the test part succeeded, we don't need to do anything. - case TestPartResult::kSuccess: - return; - default: - // Print failure message from the assertion - // (e.g. expected this and got that). - PrintTestPartResult(result); - fflush(stdout); - } -} - -void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) { - if (test_info.result()->Passed()) { - ColoredPrintf(GTestColor::kGreen, "[ OK ] "); - } else if (test_info.result()->Skipped()) { - ColoredPrintf(GTestColor::kGreen, "[ SKIPPED ] "); - } else { - ColoredPrintf(GTestColor::kRed, "[ FAILED ] "); - } - PrintTestName(test_info.test_suite_name(), test_info.name()); - if (test_info.result()->Failed()) - PrintFullTestCommentIfPresent(test_info); - - if (GTEST_FLAG(print_time)) { - printf(" (%s ms)\n", internal::StreamableToString( - test_info.result()->elapsed_time()).c_str()); - } else { - printf("\n"); - } - fflush(stdout); -} - -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) { - if (!GTEST_FLAG(print_time)) return; - - const std::string counts = - FormatCountableNoun(test_case.test_to_run_count(), "test", "tests"); - ColoredPrintf(GTestColor::kGreen, "[----------] "); - printf("%s from %s (%s ms total)\n\n", counts.c_str(), test_case.name(), - internal::StreamableToString(test_case.elapsed_time()).c_str()); - fflush(stdout); -} -#else -void PrettyUnitTestResultPrinter::OnTestSuiteEnd(const TestSuite& test_suite) { - if (!GTEST_FLAG(print_time)) return; - - const std::string counts = - FormatCountableNoun(test_suite.test_to_run_count(), "test", "tests"); - ColoredPrintf(GTestColor::kGreen, "[----------] "); - printf("%s from %s (%s ms total)\n\n", counts.c_str(), test_suite.name(), - internal::StreamableToString(test_suite.elapsed_time()).c_str()); - fflush(stdout); -} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart( - const UnitTest& /*unit_test*/) { - ColoredPrintf(GTestColor::kGreen, "[----------] "); - printf("Global test environment tear-down\n"); - fflush(stdout); -} - -// Internal helper for printing the list of failed tests. -void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) { - const int failed_test_count = unit_test.failed_test_count(); - ColoredPrintf(GTestColor::kRed, "[ FAILED ] "); - printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str()); - - for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { - const TestSuite& test_suite = *unit_test.GetTestSuite(i); - if (!test_suite.should_run() || (test_suite.failed_test_count() == 0)) { - continue; - } - for (int j = 0; j < test_suite.total_test_count(); ++j) { - const TestInfo& test_info = *test_suite.GetTestInfo(j); - if (!test_info.should_run() || !test_info.result()->Failed()) { - continue; - } - ColoredPrintf(GTestColor::kRed, "[ FAILED ] "); - printf("%s.%s", test_suite.name(), test_info.name()); - PrintFullTestCommentIfPresent(test_info); - printf("\n"); - } - } - printf("\n%2d FAILED %s\n", failed_test_count, - failed_test_count == 1 ? "TEST" : "TESTS"); -} - -// Internal helper for printing the list of test suite failures not covered by -// PrintFailedTests. -void PrettyUnitTestResultPrinter::PrintFailedTestSuites( - const UnitTest& unit_test) { - int suite_failure_count = 0; - for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { - const TestSuite& test_suite = *unit_test.GetTestSuite(i); - if (!test_suite.should_run()) { - continue; - } - if (test_suite.ad_hoc_test_result().Failed()) { - ColoredPrintf(GTestColor::kRed, "[ FAILED ] "); - printf("%s: SetUpTestSuite or TearDownTestSuite\n", test_suite.name()); - ++suite_failure_count; - } - } - if (suite_failure_count > 0) { - printf("\n%2d FAILED TEST %s\n", suite_failure_count, - suite_failure_count == 1 ? "SUITE" : "SUITES"); - } -} - -// Internal helper for printing the list of skipped tests. -void PrettyUnitTestResultPrinter::PrintSkippedTests(const UnitTest& unit_test) { - const int skipped_test_count = unit_test.skipped_test_count(); - if (skipped_test_count == 0) { - return; - } - - for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { - const TestSuite& test_suite = *unit_test.GetTestSuite(i); - if (!test_suite.should_run() || (test_suite.skipped_test_count() == 0)) { - continue; - } - for (int j = 0; j < test_suite.total_test_count(); ++j) { - const TestInfo& test_info = *test_suite.GetTestInfo(j); - if (!test_info.should_run() || !test_info.result()->Skipped()) { - continue; - } - ColoredPrintf(GTestColor::kGreen, "[ SKIPPED ] "); - printf("%s.%s", test_suite.name(), test_info.name()); - printf("\n"); - } - } -} - -void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, - int /*iteration*/) { - ColoredPrintf(GTestColor::kGreen, "[==========] "); - printf("%s from %s ran.", - FormatTestCount(unit_test.test_to_run_count()).c_str(), - FormatTestSuiteCount(unit_test.test_suite_to_run_count()).c_str()); - if (GTEST_FLAG(print_time)) { - printf(" (%s ms total)", - internal::StreamableToString(unit_test.elapsed_time()).c_str()); - } - printf("\n"); - ColoredPrintf(GTestColor::kGreen, "[ PASSED ] "); - printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str()); - - const int skipped_test_count = unit_test.skipped_test_count(); - if (skipped_test_count > 0) { - ColoredPrintf(GTestColor::kGreen, "[ SKIPPED ] "); - printf("%s, listed below:\n", FormatTestCount(skipped_test_count).c_str()); - PrintSkippedTests(unit_test); - } - - if (!unit_test.Passed()) { - PrintFailedTests(unit_test); - PrintFailedTestSuites(unit_test); - } - - int num_disabled = unit_test.reportable_disabled_test_count(); - if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) { - if (unit_test.Passed()) { - printf("\n"); // Add a spacer if no FAILURE banner is displayed. - } - ColoredPrintf(GTestColor::kYellow, " YOU HAVE %d DISABLED %s\n\n", - num_disabled, num_disabled == 1 ? "TEST" : "TESTS"); - } - // Ensure that Google Test output is printed before, e.g., heapchecker output. - fflush(stdout); -} - -// End PrettyUnitTestResultPrinter - -// This class implements the TestEventListener interface. -// -// Class BriefUnitTestResultPrinter is copyable. -class BriefUnitTestResultPrinter : public TestEventListener { - public: - BriefUnitTestResultPrinter() {} - static void PrintTestName(const char* test_suite, const char* test) { - printf("%s.%s", test_suite, test); - } - - // The following methods override what's in the TestEventListener class. - void OnTestProgramStart(const UnitTest& /*unit_test*/) override {} - void OnTestIterationStart(const UnitTest& /*unit_test*/, - int /*iteration*/) override {} - void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) override {} - void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {} -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseStart(const TestCase& /*test_case*/) override {} -#else - void OnTestSuiteStart(const TestSuite& /*test_suite*/) override {} -#endif // OnTestCaseStart - - void OnTestStart(const TestInfo& /*test_info*/) override {} - - void OnTestPartResult(const TestPartResult& result) override; - void OnTestEnd(const TestInfo& test_info) override; -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseEnd(const TestCase& /*test_case*/) override {} -#else - void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {} - void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {} - void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override; - void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {} -}; - -// Called after an assertion failure. -void BriefUnitTestResultPrinter::OnTestPartResult( - const TestPartResult& result) { - switch (result.type()) { - // If the test part succeeded, we don't need to do anything. - case TestPartResult::kSuccess: - return; - default: - // Print failure message from the assertion - // (e.g. expected this and got that). - PrintTestPartResult(result); - fflush(stdout); - } -} - -void BriefUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) { - if (test_info.result()->Failed()) { - ColoredPrintf(GTestColor::kRed, "[ FAILED ] "); - PrintTestName(test_info.test_suite_name(), test_info.name()); - PrintFullTestCommentIfPresent(test_info); - - if (GTEST_FLAG(print_time)) { - printf(" (%s ms)\n", - internal::StreamableToString(test_info.result()->elapsed_time()) - .c_str()); - } else { - printf("\n"); - } - fflush(stdout); - } -} - -void BriefUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, - int /*iteration*/) { - ColoredPrintf(GTestColor::kGreen, "[==========] "); - printf("%s from %s ran.", - FormatTestCount(unit_test.test_to_run_count()).c_str(), - FormatTestSuiteCount(unit_test.test_suite_to_run_count()).c_str()); - if (GTEST_FLAG(print_time)) { - printf(" (%s ms total)", - internal::StreamableToString(unit_test.elapsed_time()).c_str()); - } - printf("\n"); - ColoredPrintf(GTestColor::kGreen, "[ PASSED ] "); - printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str()); - - const int skipped_test_count = unit_test.skipped_test_count(); - if (skipped_test_count > 0) { - ColoredPrintf(GTestColor::kGreen, "[ SKIPPED ] "); - printf("%s.\n", FormatTestCount(skipped_test_count).c_str()); - } - - int num_disabled = unit_test.reportable_disabled_test_count(); - if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) { - if (unit_test.Passed()) { - printf("\n"); // Add a spacer if no FAILURE banner is displayed. - } - ColoredPrintf(GTestColor::kYellow, " YOU HAVE %d DISABLED %s\n\n", - num_disabled, num_disabled == 1 ? "TEST" : "TESTS"); - } - // Ensure that Google Test output is printed before, e.g., heapchecker output. - fflush(stdout); -} - -// End BriefUnitTestResultPrinter - -// class TestEventRepeater -// -// This class forwards events to other event listeners. -class TestEventRepeater : public TestEventListener { - public: - TestEventRepeater() : forwarding_enabled_(true) {} - ~TestEventRepeater() override; - void Append(TestEventListener *listener); - TestEventListener* Release(TestEventListener* listener); - - // Controls whether events will be forwarded to listeners_. Set to false - // in death test child processes. - bool forwarding_enabled() const { return forwarding_enabled_; } - void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; } - - void OnTestProgramStart(const UnitTest& unit_test) override; - void OnTestIterationStart(const UnitTest& unit_test, int iteration) override; - void OnEnvironmentsSetUpStart(const UnitTest& unit_test) override; - void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) override; -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseStart(const TestSuite& parameter) override; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestSuiteStart(const TestSuite& parameter) override; - void OnTestStart(const TestInfo& test_info) override; - void OnTestPartResult(const TestPartResult& result) override; - void OnTestEnd(const TestInfo& test_info) override; -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseEnd(const TestCase& parameter) override; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestSuiteEnd(const TestSuite& parameter) override; - void OnEnvironmentsTearDownStart(const UnitTest& unit_test) override; - void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) override; - void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override; - void OnTestProgramEnd(const UnitTest& unit_test) override; - - private: - // Controls whether events will be forwarded to listeners_. Set to false - // in death test child processes. - bool forwarding_enabled_; - // The list of listeners that receive events. - std::vector listeners_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater); -}; - -TestEventRepeater::~TestEventRepeater() { - ForEach(listeners_, Delete); -} - -void TestEventRepeater::Append(TestEventListener *listener) { - listeners_.push_back(listener); -} - -TestEventListener* TestEventRepeater::Release(TestEventListener *listener) { - for (size_t i = 0; i < listeners_.size(); ++i) { - if (listeners_[i] == listener) { - listeners_.erase(listeners_.begin() + static_cast(i)); - return listener; - } - } - - return nullptr; -} - -// Since most methods are very similar, use macros to reduce boilerplate. -// This defines a member that forwards the call to all listeners. -#define GTEST_REPEATER_METHOD_(Name, Type) \ -void TestEventRepeater::Name(const Type& parameter) { \ - if (forwarding_enabled_) { \ - for (size_t i = 0; i < listeners_.size(); i++) { \ - listeners_[i]->Name(parameter); \ - } \ - } \ -} -// This defines a member that forwards the call to all listeners in reverse -// order. -#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \ - void TestEventRepeater::Name(const Type& parameter) { \ - if (forwarding_enabled_) { \ - for (size_t i = listeners_.size(); i != 0; i--) { \ - listeners_[i - 1]->Name(parameter); \ - } \ - } \ - } - -GTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest) -GTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest) -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -GTEST_REPEATER_METHOD_(OnTestCaseStart, TestSuite) -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -GTEST_REPEATER_METHOD_(OnTestSuiteStart, TestSuite) -GTEST_REPEATER_METHOD_(OnTestStart, TestInfo) -GTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult) -GTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest) -GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest) -GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest) -GTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo) -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -GTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestSuite) -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -GTEST_REVERSE_REPEATER_METHOD_(OnTestSuiteEnd, TestSuite) -GTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest) - -#undef GTEST_REPEATER_METHOD_ -#undef GTEST_REVERSE_REPEATER_METHOD_ - -void TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test, - int iteration) { - if (forwarding_enabled_) { - for (size_t i = 0; i < listeners_.size(); i++) { - listeners_[i]->OnTestIterationStart(unit_test, iteration); - } - } -} - -void TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test, - int iteration) { - if (forwarding_enabled_) { - for (size_t i = listeners_.size(); i > 0; i--) { - listeners_[i - 1]->OnTestIterationEnd(unit_test, iteration); - } - } -} - -// End TestEventRepeater - -// This class generates an XML output file. -class XmlUnitTestResultPrinter : public EmptyTestEventListener { - public: - explicit XmlUnitTestResultPrinter(const char* output_file); - - void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override; - void ListTestsMatchingFilter(const std::vector& test_suites); - - // Prints an XML summary of all unit tests. - static void PrintXmlTestsList(std::ostream* stream, - const std::vector& test_suites); - - private: - // Is c a whitespace character that is normalized to a space character - // when it appears in an XML attribute value? - static bool IsNormalizableWhitespace(char c) { - return c == 0x9 || c == 0xA || c == 0xD; - } - - // May c appear in a well-formed XML document? - static bool IsValidXmlCharacter(char c) { - return IsNormalizableWhitespace(c) || c >= 0x20; - } - - // Returns an XML-escaped copy of the input string str. If - // is_attribute is true, the text is meant to appear as an attribute - // value, and normalizable whitespace is preserved by replacing it - // with character references. - static std::string EscapeXml(const std::string& str, bool is_attribute); - - // Returns the given string with all characters invalid in XML removed. - static std::string RemoveInvalidXmlCharacters(const std::string& str); - - // Convenience wrapper around EscapeXml when str is an attribute value. - static std::string EscapeXmlAttribute(const std::string& str) { - return EscapeXml(str, true); - } - - // Convenience wrapper around EscapeXml when str is not an attribute value. - static std::string EscapeXmlText(const char* str) { - return EscapeXml(str, false); - } - - // Verifies that the given attribute belongs to the given element and - // streams the attribute as XML. - static void OutputXmlAttribute(std::ostream* stream, - const std::string& element_name, - const std::string& name, - const std::string& value); - - // Streams an XML CDATA section, escaping invalid CDATA sequences as needed. - static void OutputXmlCDataSection(::std::ostream* stream, const char* data); - - // Streams a test suite XML stanza containing the given test result. - // - // Requires: result.Failed() - static void OutputXmlTestSuiteForTestResult(::std::ostream* stream, - const TestResult& result); - - // Streams an XML representation of a TestResult object. - static void OutputXmlTestResult(::std::ostream* stream, - const TestResult& result); - - // Streams an XML representation of a TestInfo object. - static void OutputXmlTestInfo(::std::ostream* stream, - const char* test_suite_name, - const TestInfo& test_info); - - // Prints an XML representation of a TestSuite object - static void PrintXmlTestSuite(::std::ostream* stream, - const TestSuite& test_suite); - - // Prints an XML summary of unit_test to output stream out. - static void PrintXmlUnitTest(::std::ostream* stream, - const UnitTest& unit_test); - - // Produces a string representing the test properties in a result as space - // delimited XML attributes based on the property key="value" pairs. - // When the std::string is not empty, it includes a space at the beginning, - // to delimit this attribute from prior attributes. - static std::string TestPropertiesAsXmlAttributes(const TestResult& result); - - // Streams an XML representation of the test properties of a TestResult - // object. - static void OutputXmlTestProperties(std::ostream* stream, - const TestResult& result); - - // The output file. - const std::string output_file_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter); -}; - -// Creates a new XmlUnitTestResultPrinter. -XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file) - : output_file_(output_file) { - if (output_file_.empty()) { - GTEST_LOG_(FATAL) << "XML output file may not be null"; - } -} - -// Called after the unit test ends. -void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, - int /*iteration*/) { - FILE* xmlout = OpenFileForWriting(output_file_); - std::stringstream stream; - PrintXmlUnitTest(&stream, unit_test); - fprintf(xmlout, "%s", StringStreamToString(&stream).c_str()); - fclose(xmlout); -} - -void XmlUnitTestResultPrinter::ListTestsMatchingFilter( - const std::vector& test_suites) { - FILE* xmlout = OpenFileForWriting(output_file_); - std::stringstream stream; - PrintXmlTestsList(&stream, test_suites); - fprintf(xmlout, "%s", StringStreamToString(&stream).c_str()); - fclose(xmlout); -} - -// Returns an XML-escaped copy of the input string str. If is_attribute -// is true, the text is meant to appear as an attribute value, and -// normalizable whitespace is preserved by replacing it with character -// references. -// -// Invalid XML characters in str, if any, are stripped from the output. -// It is expected that most, if not all, of the text processed by this -// module will consist of ordinary English text. -// If this module is ever modified to produce version 1.1 XML output, -// most invalid characters can be retained using character references. -std::string XmlUnitTestResultPrinter::EscapeXml( - const std::string& str, bool is_attribute) { - Message m; - - for (size_t i = 0; i < str.size(); ++i) { - const char ch = str[i]; - switch (ch) { - case '<': - m << "<"; - break; - case '>': - m << ">"; - break; - case '&': - m << "&"; - break; - case '\'': - if (is_attribute) - m << "'"; - else - m << '\''; - break; - case '"': - if (is_attribute) - m << """; - else - m << '"'; - break; - default: - if (IsValidXmlCharacter(ch)) { - if (is_attribute && IsNormalizableWhitespace(ch)) - m << "&#x" << String::FormatByte(static_cast(ch)) - << ";"; - else - m << ch; - } - break; - } - } - - return m.GetString(); -} - -// Returns the given string with all characters invalid in XML removed. -// Currently invalid characters are dropped from the string. An -// alternative is to replace them with certain characters such as . or ?. -std::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters( - const std::string& str) { - std::string output; - output.reserve(str.size()); - for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) - if (IsValidXmlCharacter(*it)) - output.push_back(*it); - - return output; -} - -// The following routines generate an XML representation of a UnitTest -// object. -// GOOGLETEST_CM0009 DO NOT DELETE -// -// This is how Google Test concepts map to the DTD: -// -// <-- corresponds to a UnitTest object -// <-- corresponds to a TestSuite object -// <-- corresponds to a TestInfo object -// ... -// ... -// ... -// <-- individual assertion failures -// -// -// - -// Formats the given time in milliseconds as seconds. -std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) { - ::std::stringstream ss; - ss << (static_cast(ms) * 1e-3); - return ss.str(); -} - -static bool PortableLocaltime(time_t seconds, struct tm* out) { -#if defined(_MSC_VER) - return localtime_s(out, &seconds) == 0; -#elif defined(__MINGW32__) || defined(__MINGW64__) - // MINGW provides neither localtime_r nor localtime_s, but uses - // Windows' localtime(), which has a thread-local tm buffer. - struct tm* tm_ptr = localtime(&seconds); // NOLINT - if (tm_ptr == nullptr) return false; - *out = *tm_ptr; - return true; -#elif defined(__STDC_LIB_EXT1__) - // Uses localtime_s when available as localtime_r is only available from - // C23 standard. - return localtime_s(&seconds, out) != nullptr; -#else - return localtime_r(&seconds, out) != nullptr; -#endif -} - -// Converts the given epoch time in milliseconds to a date string in the ISO -// 8601 format, without the timezone information. -std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) { - struct tm time_struct; - if (!PortableLocaltime(static_cast(ms / 1000), &time_struct)) - return ""; - // YYYY-MM-DDThh:mm:ss.sss - return StreamableToString(time_struct.tm_year + 1900) + "-" + - String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" + - String::FormatIntWidth2(time_struct.tm_mday) + "T" + - String::FormatIntWidth2(time_struct.tm_hour) + ":" + - String::FormatIntWidth2(time_struct.tm_min) + ":" + - String::FormatIntWidth2(time_struct.tm_sec) + "." + - String::FormatIntWidthN(static_cast(ms % 1000), 3); -} - -// Streams an XML CDATA section, escaping invalid CDATA sequences as needed. -void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream, - const char* data) { - const char* segment = data; - *stream << ""); - if (next_segment != nullptr) { - stream->write( - segment, static_cast(next_segment - segment)); - *stream << "]]>]]>"); - } else { - *stream << segment; - break; - } - } - *stream << "]]>"; -} - -void XmlUnitTestResultPrinter::OutputXmlAttribute( - std::ostream* stream, - const std::string& element_name, - const std::string& name, - const std::string& value) { - const std::vector& allowed_names = - GetReservedOutputAttributesForElement(element_name); - - GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != - allowed_names.end()) - << "Attribute " << name << " is not allowed for element <" << element_name - << ">."; - - *stream << " " << name << "=\"" << EscapeXmlAttribute(value) << "\""; -} - -// Streams a test suite XML stanza containing the given test result. -void XmlUnitTestResultPrinter::OutputXmlTestSuiteForTestResult( - ::std::ostream* stream, const TestResult& result) { - // Output the boilerplate for a minimal test suite with one test. - *stream << " "; - - // Output the boilerplate for a minimal test case with a single test. - *stream << " \n"; -} - -// Prints an XML representation of a TestInfo object. -void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream, - const char* test_suite_name, - const TestInfo& test_info) { - const TestResult& result = *test_info.result(); - const std::string kTestsuite = "testcase"; - - if (test_info.is_in_another_shard()) { - return; - } - - *stream << " \n"; - return; - } - - OutputXmlAttribute(stream, kTestsuite, "status", - test_info.should_run() ? "run" : "notrun"); - OutputXmlAttribute(stream, kTestsuite, "result", - test_info.should_run() - ? (result.Skipped() ? "skipped" : "completed") - : "suppressed"); - OutputXmlAttribute(stream, kTestsuite, "time", - FormatTimeInMillisAsSeconds(result.elapsed_time())); - OutputXmlAttribute( - stream, kTestsuite, "timestamp", - FormatEpochTimeInMillisAsIso8601(result.start_timestamp())); - OutputXmlAttribute(stream, kTestsuite, "classname", test_suite_name); - - OutputXmlTestResult(stream, result); -} - -void XmlUnitTestResultPrinter::OutputXmlTestResult(::std::ostream* stream, - const TestResult& result) { - int failures = 0; - int skips = 0; - for (int i = 0; i < result.total_part_count(); ++i) { - const TestPartResult& part = result.GetTestPartResult(i); - if (part.failed()) { - if (++failures == 1 && skips == 0) { - *stream << ">\n"; - } - const std::string location = - internal::FormatCompilerIndependentFileLocation(part.file_name(), - part.line_number()); - const std::string summary = location + "\n" + part.summary(); - *stream << " "; - const std::string detail = location + "\n" + part.message(); - OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str()); - *stream << "\n"; - } else if (part.skipped()) { - if (++skips == 1 && failures == 0) { - *stream << ">\n"; - } - const std::string location = - internal::FormatCompilerIndependentFileLocation(part.file_name(), - part.line_number()); - const std::string summary = location + "\n" + part.summary(); - *stream << " "; - const std::string detail = location + "\n" + part.message(); - OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str()); - *stream << "\n"; - } - } - - if (failures == 0 && skips == 0 && result.test_property_count() == 0) { - *stream << " />\n"; - } else { - if (failures == 0 && skips == 0) { - *stream << ">\n"; - } - OutputXmlTestProperties(stream, result); - *stream << " \n"; - } -} - -// Prints an XML representation of a TestSuite object -void XmlUnitTestResultPrinter::PrintXmlTestSuite(std::ostream* stream, - const TestSuite& test_suite) { - const std::string kTestsuite = "testsuite"; - *stream << " <" << kTestsuite; - OutputXmlAttribute(stream, kTestsuite, "name", test_suite.name()); - OutputXmlAttribute(stream, kTestsuite, "tests", - StreamableToString(test_suite.reportable_test_count())); - if (!GTEST_FLAG(list_tests)) { - OutputXmlAttribute(stream, kTestsuite, "failures", - StreamableToString(test_suite.failed_test_count())); - OutputXmlAttribute( - stream, kTestsuite, "disabled", - StreamableToString(test_suite.reportable_disabled_test_count())); - OutputXmlAttribute(stream, kTestsuite, "skipped", - StreamableToString(test_suite.skipped_test_count())); - - OutputXmlAttribute(stream, kTestsuite, "errors", "0"); - - OutputXmlAttribute(stream, kTestsuite, "time", - FormatTimeInMillisAsSeconds(test_suite.elapsed_time())); - OutputXmlAttribute( - stream, kTestsuite, "timestamp", - FormatEpochTimeInMillisAsIso8601(test_suite.start_timestamp())); - *stream << TestPropertiesAsXmlAttributes(test_suite.ad_hoc_test_result()); - } - *stream << ">\n"; - for (int i = 0; i < test_suite.total_test_count(); ++i) { - if (test_suite.GetTestInfo(i)->is_reportable()) - OutputXmlTestInfo(stream, test_suite.name(), *test_suite.GetTestInfo(i)); - } - *stream << " \n"; -} - -// Prints an XML summary of unit_test to output stream out. -void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream, - const UnitTest& unit_test) { - const std::string kTestsuites = "testsuites"; - - *stream << "\n"; - *stream << "<" << kTestsuites; - - OutputXmlAttribute(stream, kTestsuites, "tests", - StreamableToString(unit_test.reportable_test_count())); - OutputXmlAttribute(stream, kTestsuites, "failures", - StreamableToString(unit_test.failed_test_count())); - OutputXmlAttribute( - stream, kTestsuites, "disabled", - StreamableToString(unit_test.reportable_disabled_test_count())); - OutputXmlAttribute(stream, kTestsuites, "errors", "0"); - OutputXmlAttribute(stream, kTestsuites, "time", - FormatTimeInMillisAsSeconds(unit_test.elapsed_time())); - OutputXmlAttribute( - stream, kTestsuites, "timestamp", - FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp())); - - if (GTEST_FLAG(shuffle)) { - OutputXmlAttribute(stream, kTestsuites, "random_seed", - StreamableToString(unit_test.random_seed())); - } - *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result()); - - OutputXmlAttribute(stream, kTestsuites, "name", "AllTests"); - *stream << ">\n"; - - for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { - if (unit_test.GetTestSuite(i)->reportable_test_count() > 0) - PrintXmlTestSuite(stream, *unit_test.GetTestSuite(i)); - } - - // If there was a test failure outside of one of the test suites (like in a - // test environment) include that in the output. - if (unit_test.ad_hoc_test_result().Failed()) { - OutputXmlTestSuiteForTestResult(stream, unit_test.ad_hoc_test_result()); - } - - *stream << "\n"; -} - -void XmlUnitTestResultPrinter::PrintXmlTestsList( - std::ostream* stream, const std::vector& test_suites) { - const std::string kTestsuites = "testsuites"; - - *stream << "\n"; - *stream << "<" << kTestsuites; - - int total_tests = 0; - for (auto test_suite : test_suites) { - total_tests += test_suite->total_test_count(); - } - OutputXmlAttribute(stream, kTestsuites, "tests", - StreamableToString(total_tests)); - OutputXmlAttribute(stream, kTestsuites, "name", "AllTests"); - *stream << ">\n"; - - for (auto test_suite : test_suites) { - PrintXmlTestSuite(stream, *test_suite); - } - *stream << "\n"; -} - -// Produces a string representing the test properties in a result as space -// delimited XML attributes based on the property key="value" pairs. -std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes( - const TestResult& result) { - Message attributes; - for (int i = 0; i < result.test_property_count(); ++i) { - const TestProperty& property = result.GetTestProperty(i); - attributes << " " << property.key() << "=" - << "\"" << EscapeXmlAttribute(property.value()) << "\""; - } - return attributes.GetString(); -} - -void XmlUnitTestResultPrinter::OutputXmlTestProperties( - std::ostream* stream, const TestResult& result) { - const std::string kProperties = "properties"; - const std::string kProperty = "property"; - - if (result.test_property_count() <= 0) { - return; - } - - *stream << "<" << kProperties << ">\n"; - for (int i = 0; i < result.test_property_count(); ++i) { - const TestProperty& property = result.GetTestProperty(i); - *stream << "<" << kProperty; - *stream << " name=\"" << EscapeXmlAttribute(property.key()) << "\""; - *stream << " value=\"" << EscapeXmlAttribute(property.value()) << "\""; - *stream << "/>\n"; - } - *stream << "\n"; -} - -// End XmlUnitTestResultPrinter - -// This class generates an JSON output file. -class JsonUnitTestResultPrinter : public EmptyTestEventListener { - public: - explicit JsonUnitTestResultPrinter(const char* output_file); - - void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override; - - // Prints an JSON summary of all unit tests. - static void PrintJsonTestList(::std::ostream* stream, - const std::vector& test_suites); - - private: - // Returns an JSON-escaped copy of the input string str. - static std::string EscapeJson(const std::string& str); - - //// Verifies that the given attribute belongs to the given element and - //// streams the attribute as JSON. - static void OutputJsonKey(std::ostream* stream, - const std::string& element_name, - const std::string& name, - const std::string& value, - const std::string& indent, - bool comma = true); - static void OutputJsonKey(std::ostream* stream, - const std::string& element_name, - const std::string& name, - int value, - const std::string& indent, - bool comma = true); - - // Streams a test suite JSON stanza containing the given test result. - // - // Requires: result.Failed() - static void OutputJsonTestSuiteForTestResult(::std::ostream* stream, - const TestResult& result); - - // Streams a JSON representation of a TestResult object. - static void OutputJsonTestResult(::std::ostream* stream, - const TestResult& result); - - // Streams a JSON representation of a TestInfo object. - static void OutputJsonTestInfo(::std::ostream* stream, - const char* test_suite_name, - const TestInfo& test_info); - - // Prints a JSON representation of a TestSuite object - static void PrintJsonTestSuite(::std::ostream* stream, - const TestSuite& test_suite); - - // Prints a JSON summary of unit_test to output stream out. - static void PrintJsonUnitTest(::std::ostream* stream, - const UnitTest& unit_test); - - // Produces a string representing the test properties in a result as - // a JSON dictionary. - static std::string TestPropertiesAsJson(const TestResult& result, - const std::string& indent); - - // The output file. - const std::string output_file_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(JsonUnitTestResultPrinter); -}; - -// Creates a new JsonUnitTestResultPrinter. -JsonUnitTestResultPrinter::JsonUnitTestResultPrinter(const char* output_file) - : output_file_(output_file) { - if (output_file_.empty()) { - GTEST_LOG_(FATAL) << "JSON output file may not be null"; - } -} - -void JsonUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, - int /*iteration*/) { - FILE* jsonout = OpenFileForWriting(output_file_); - std::stringstream stream; - PrintJsonUnitTest(&stream, unit_test); - fprintf(jsonout, "%s", StringStreamToString(&stream).c_str()); - fclose(jsonout); -} - -// Returns an JSON-escaped copy of the input string str. -std::string JsonUnitTestResultPrinter::EscapeJson(const std::string& str) { - Message m; - - for (size_t i = 0; i < str.size(); ++i) { - const char ch = str[i]; - switch (ch) { - case '\\': - case '"': - case '/': - m << '\\' << ch; - break; - case '\b': - m << "\\b"; - break; - case '\t': - m << "\\t"; - break; - case '\n': - m << "\\n"; - break; - case '\f': - m << "\\f"; - break; - case '\r': - m << "\\r"; - break; - default: - if (ch < ' ') { - m << "\\u00" << String::FormatByte(static_cast(ch)); - } else { - m << ch; - } - break; - } - } - - return m.GetString(); -} - -// The following routines generate an JSON representation of a UnitTest -// object. - -// Formats the given time in milliseconds as seconds. -static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) { - ::std::stringstream ss; - ss << (static_cast(ms) * 1e-3) << "s"; - return ss.str(); -} - -// Converts the given epoch time in milliseconds to a date string in the -// RFC3339 format, without the timezone information. -static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) { - struct tm time_struct; - if (!PortableLocaltime(static_cast(ms / 1000), &time_struct)) - return ""; - // YYYY-MM-DDThh:mm:ss - return StreamableToString(time_struct.tm_year + 1900) + "-" + - String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" + - String::FormatIntWidth2(time_struct.tm_mday) + "T" + - String::FormatIntWidth2(time_struct.tm_hour) + ":" + - String::FormatIntWidth2(time_struct.tm_min) + ":" + - String::FormatIntWidth2(time_struct.tm_sec) + "Z"; -} - -static inline std::string Indent(size_t width) { - return std::string(width, ' '); -} - -void JsonUnitTestResultPrinter::OutputJsonKey( - std::ostream* stream, - const std::string& element_name, - const std::string& name, - const std::string& value, - const std::string& indent, - bool comma) { - const std::vector& allowed_names = - GetReservedOutputAttributesForElement(element_name); - - GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != - allowed_names.end()) - << "Key \"" << name << "\" is not allowed for value \"" << element_name - << "\"."; - - *stream << indent << "\"" << name << "\": \"" << EscapeJson(value) << "\""; - if (comma) - *stream << ",\n"; -} - -void JsonUnitTestResultPrinter::OutputJsonKey( - std::ostream* stream, - const std::string& element_name, - const std::string& name, - int value, - const std::string& indent, - bool comma) { - const std::vector& allowed_names = - GetReservedOutputAttributesForElement(element_name); - - GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != - allowed_names.end()) - << "Key \"" << name << "\" is not allowed for value \"" << element_name - << "\"."; - - *stream << indent << "\"" << name << "\": " << StreamableToString(value); - if (comma) - *stream << ",\n"; -} - -// Streams a test suite JSON stanza containing the given test result. -void JsonUnitTestResultPrinter::OutputJsonTestSuiteForTestResult( - ::std::ostream* stream, const TestResult& result) { - // Output the boilerplate for a new test suite. - *stream << Indent(4) << "{\n"; - OutputJsonKey(stream, "testsuite", "name", "NonTestSuiteFailure", Indent(6)); - OutputJsonKey(stream, "testsuite", "tests", 1, Indent(6)); - if (!GTEST_FLAG(list_tests)) { - OutputJsonKey(stream, "testsuite", "failures", 1, Indent(6)); - OutputJsonKey(stream, "testsuite", "disabled", 0, Indent(6)); - OutputJsonKey(stream, "testsuite", "skipped", 0, Indent(6)); - OutputJsonKey(stream, "testsuite", "errors", 0, Indent(6)); - OutputJsonKey(stream, "testsuite", "time", - FormatTimeInMillisAsDuration(result.elapsed_time()), - Indent(6)); - OutputJsonKey(stream, "testsuite", "timestamp", - FormatEpochTimeInMillisAsRFC3339(result.start_timestamp()), - Indent(6)); - } - *stream << Indent(6) << "\"testsuite\": [\n"; - - // Output the boilerplate for a new test case. - *stream << Indent(8) << "{\n"; - OutputJsonKey(stream, "testcase", "name", "", Indent(10)); - OutputJsonKey(stream, "testcase", "status", "RUN", Indent(10)); - OutputJsonKey(stream, "testcase", "result", "COMPLETED", Indent(10)); - OutputJsonKey(stream, "testcase", "timestamp", - FormatEpochTimeInMillisAsRFC3339(result.start_timestamp()), - Indent(10)); - OutputJsonKey(stream, "testcase", "time", - FormatTimeInMillisAsDuration(result.elapsed_time()), - Indent(10)); - OutputJsonKey(stream, "testcase", "classname", "", Indent(10), false); - *stream << TestPropertiesAsJson(result, Indent(10)); - - // Output the actual test result. - OutputJsonTestResult(stream, result); - - // Finish the test suite. - *stream << "\n" << Indent(6) << "]\n" << Indent(4) << "}"; -} - -// Prints a JSON representation of a TestInfo object. -void JsonUnitTestResultPrinter::OutputJsonTestInfo(::std::ostream* stream, - const char* test_suite_name, - const TestInfo& test_info) { - const TestResult& result = *test_info.result(); - const std::string kTestsuite = "testcase"; - const std::string kIndent = Indent(10); - - *stream << Indent(8) << "{\n"; - OutputJsonKey(stream, kTestsuite, "name", test_info.name(), kIndent); - - if (test_info.value_param() != nullptr) { - OutputJsonKey(stream, kTestsuite, "value_param", test_info.value_param(), - kIndent); - } - if (test_info.type_param() != nullptr) { - OutputJsonKey(stream, kTestsuite, "type_param", test_info.type_param(), - kIndent); - } - if (GTEST_FLAG(list_tests)) { - OutputJsonKey(stream, kTestsuite, "file", test_info.file(), kIndent); - OutputJsonKey(stream, kTestsuite, "line", test_info.line(), kIndent, false); - *stream << "\n" << Indent(8) << "}"; - return; - } - - OutputJsonKey(stream, kTestsuite, "status", - test_info.should_run() ? "RUN" : "NOTRUN", kIndent); - OutputJsonKey(stream, kTestsuite, "result", - test_info.should_run() - ? (result.Skipped() ? "SKIPPED" : "COMPLETED") - : "SUPPRESSED", - kIndent); - OutputJsonKey(stream, kTestsuite, "timestamp", - FormatEpochTimeInMillisAsRFC3339(result.start_timestamp()), - kIndent); - OutputJsonKey(stream, kTestsuite, "time", - FormatTimeInMillisAsDuration(result.elapsed_time()), kIndent); - OutputJsonKey(stream, kTestsuite, "classname", test_suite_name, kIndent, - false); - *stream << TestPropertiesAsJson(result, kIndent); - - OutputJsonTestResult(stream, result); -} - -void JsonUnitTestResultPrinter::OutputJsonTestResult(::std::ostream* stream, - const TestResult& result) { - const std::string kIndent = Indent(10); - - int failures = 0; - for (int i = 0; i < result.total_part_count(); ++i) { - const TestPartResult& part = result.GetTestPartResult(i); - if (part.failed()) { - *stream << ",\n"; - if (++failures == 1) { - *stream << kIndent << "\"" << "failures" << "\": [\n"; - } - const std::string location = - internal::FormatCompilerIndependentFileLocation(part.file_name(), - part.line_number()); - const std::string message = EscapeJson(location + "\n" + part.message()); - *stream << kIndent << " {\n" - << kIndent << " \"failure\": \"" << message << "\",\n" - << kIndent << " \"type\": \"\"\n" - << kIndent << " }"; - } - } - - if (failures > 0) - *stream << "\n" << kIndent << "]"; - *stream << "\n" << Indent(8) << "}"; -} - -// Prints an JSON representation of a TestSuite object -void JsonUnitTestResultPrinter::PrintJsonTestSuite( - std::ostream* stream, const TestSuite& test_suite) { - const std::string kTestsuite = "testsuite"; - const std::string kIndent = Indent(6); - - *stream << Indent(4) << "{\n"; - OutputJsonKey(stream, kTestsuite, "name", test_suite.name(), kIndent); - OutputJsonKey(stream, kTestsuite, "tests", test_suite.reportable_test_count(), - kIndent); - if (!GTEST_FLAG(list_tests)) { - OutputJsonKey(stream, kTestsuite, "failures", - test_suite.failed_test_count(), kIndent); - OutputJsonKey(stream, kTestsuite, "disabled", - test_suite.reportable_disabled_test_count(), kIndent); - OutputJsonKey(stream, kTestsuite, "errors", 0, kIndent); - OutputJsonKey( - stream, kTestsuite, "timestamp", - FormatEpochTimeInMillisAsRFC3339(test_suite.start_timestamp()), - kIndent); - OutputJsonKey(stream, kTestsuite, "time", - FormatTimeInMillisAsDuration(test_suite.elapsed_time()), - kIndent, false); - *stream << TestPropertiesAsJson(test_suite.ad_hoc_test_result(), kIndent) - << ",\n"; - } - - *stream << kIndent << "\"" << kTestsuite << "\": [\n"; - - bool comma = false; - for (int i = 0; i < test_suite.total_test_count(); ++i) { - if (test_suite.GetTestInfo(i)->is_reportable()) { - if (comma) { - *stream << ",\n"; - } else { - comma = true; - } - OutputJsonTestInfo(stream, test_suite.name(), *test_suite.GetTestInfo(i)); - } - } - *stream << "\n" << kIndent << "]\n" << Indent(4) << "}"; -} - -// Prints a JSON summary of unit_test to output stream out. -void JsonUnitTestResultPrinter::PrintJsonUnitTest(std::ostream* stream, - const UnitTest& unit_test) { - const std::string kTestsuites = "testsuites"; - const std::string kIndent = Indent(2); - *stream << "{\n"; - - OutputJsonKey(stream, kTestsuites, "tests", unit_test.reportable_test_count(), - kIndent); - OutputJsonKey(stream, kTestsuites, "failures", unit_test.failed_test_count(), - kIndent); - OutputJsonKey(stream, kTestsuites, "disabled", - unit_test.reportable_disabled_test_count(), kIndent); - OutputJsonKey(stream, kTestsuites, "errors", 0, kIndent); - if (GTEST_FLAG(shuffle)) { - OutputJsonKey(stream, kTestsuites, "random_seed", unit_test.random_seed(), - kIndent); - } - OutputJsonKey(stream, kTestsuites, "timestamp", - FormatEpochTimeInMillisAsRFC3339(unit_test.start_timestamp()), - kIndent); - OutputJsonKey(stream, kTestsuites, "time", - FormatTimeInMillisAsDuration(unit_test.elapsed_time()), kIndent, - false); - - *stream << TestPropertiesAsJson(unit_test.ad_hoc_test_result(), kIndent) - << ",\n"; - - OutputJsonKey(stream, kTestsuites, "name", "AllTests", kIndent); - *stream << kIndent << "\"" << kTestsuites << "\": [\n"; - - bool comma = false; - for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { - if (unit_test.GetTestSuite(i)->reportable_test_count() > 0) { - if (comma) { - *stream << ",\n"; - } else { - comma = true; - } - PrintJsonTestSuite(stream, *unit_test.GetTestSuite(i)); - } - } - - // If there was a test failure outside of one of the test suites (like in a - // test environment) include that in the output. - if (unit_test.ad_hoc_test_result().Failed()) { - OutputJsonTestSuiteForTestResult(stream, unit_test.ad_hoc_test_result()); - } - - *stream << "\n" << kIndent << "]\n" << "}\n"; -} - -void JsonUnitTestResultPrinter::PrintJsonTestList( - std::ostream* stream, const std::vector& test_suites) { - const std::string kTestsuites = "testsuites"; - const std::string kIndent = Indent(2); - *stream << "{\n"; - int total_tests = 0; - for (auto test_suite : test_suites) { - total_tests += test_suite->total_test_count(); - } - OutputJsonKey(stream, kTestsuites, "tests", total_tests, kIndent); - - OutputJsonKey(stream, kTestsuites, "name", "AllTests", kIndent); - *stream << kIndent << "\"" << kTestsuites << "\": [\n"; - - for (size_t i = 0; i < test_suites.size(); ++i) { - if (i != 0) { - *stream << ",\n"; - } - PrintJsonTestSuite(stream, *test_suites[i]); - } - - *stream << "\n" - << kIndent << "]\n" - << "}\n"; -} -// Produces a string representing the test properties in a result as -// a JSON dictionary. -std::string JsonUnitTestResultPrinter::TestPropertiesAsJson( - const TestResult& result, const std::string& indent) { - Message attributes; - for (int i = 0; i < result.test_property_count(); ++i) { - const TestProperty& property = result.GetTestProperty(i); - attributes << ",\n" << indent << "\"" << property.key() << "\": " - << "\"" << EscapeJson(property.value()) << "\""; - } - return attributes.GetString(); -} - -// End JsonUnitTestResultPrinter - -#if GTEST_CAN_STREAM_RESULTS_ - -// Checks if str contains '=', '&', '%' or '\n' characters. If yes, -// replaces them by "%xx" where xx is their hexadecimal value. For -// example, replaces "=" with "%3D". This algorithm is O(strlen(str)) -// in both time and space -- important as the input str may contain an -// arbitrarily long test failure message and stack trace. -std::string StreamingListener::UrlEncode(const char* str) { - std::string result; - result.reserve(strlen(str) + 1); - for (char ch = *str; ch != '\0'; ch = *++str) { - switch (ch) { - case '%': - case '=': - case '&': - case '\n': - result.append("%" + String::FormatByte(static_cast(ch))); - break; - default: - result.push_back(ch); - break; - } - } - return result; -} - -void StreamingListener::SocketWriter::MakeConnection() { - GTEST_CHECK_(sockfd_ == -1) - << "MakeConnection() can't be called when there is already a connection."; - - addrinfo hints; - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; // To allow both IPv4 and IPv6 addresses. - hints.ai_socktype = SOCK_STREAM; - addrinfo* servinfo = nullptr; - - // Use the getaddrinfo() to get a linked list of IP addresses for - // the given host name. - const int error_num = getaddrinfo( - host_name_.c_str(), port_num_.c_str(), &hints, &servinfo); - if (error_num != 0) { - GTEST_LOG_(WARNING) << "stream_result_to: getaddrinfo() failed: " - << gai_strerror(error_num); - } - - // Loop through all the results and connect to the first we can. - for (addrinfo* cur_addr = servinfo; sockfd_ == -1 && cur_addr != nullptr; - cur_addr = cur_addr->ai_next) { - sockfd_ = socket( - cur_addr->ai_family, cur_addr->ai_socktype, cur_addr->ai_protocol); - if (sockfd_ != -1) { - // Connect the client socket to the server socket. - if (connect(sockfd_, cur_addr->ai_addr, cur_addr->ai_addrlen) == -1) { - close(sockfd_); - sockfd_ = -1; - } - } - } - - freeaddrinfo(servinfo); // all done with this structure - - if (sockfd_ == -1) { - GTEST_LOG_(WARNING) << "stream_result_to: failed to connect to " - << host_name_ << ":" << port_num_; - } -} - -// End of class Streaming Listener -#endif // GTEST_CAN_STREAM_RESULTS__ - -// class OsStackTraceGetter - -const char* const OsStackTraceGetterInterface::kElidedFramesMarker = - "... " GTEST_NAME_ " internal frames ..."; - -std::string OsStackTraceGetter::CurrentStackTrace(int max_depth, int skip_count) - GTEST_LOCK_EXCLUDED_(mutex_) { -#if GTEST_HAS_ABSL - std::string result; - - if (max_depth <= 0) { - return result; - } - - max_depth = std::min(max_depth, kMaxStackTraceDepth); - - std::vector raw_stack(max_depth); - // Skips the frames requested by the caller, plus this function. - const int raw_stack_size = - absl::GetStackTrace(&raw_stack[0], max_depth, skip_count + 1); - - void* caller_frame = nullptr; - { - MutexLock lock(&mutex_); - caller_frame = caller_frame_; - } - - for (int i = 0; i < raw_stack_size; ++i) { - if (raw_stack[i] == caller_frame && - !GTEST_FLAG(show_internal_stack_frames)) { - // Add a marker to the trace and stop adding frames. - absl::StrAppend(&result, kElidedFramesMarker, "\n"); - break; - } - - char tmp[1024]; - const char* symbol = "(unknown)"; - if (absl::Symbolize(raw_stack[i], tmp, sizeof(tmp))) { - symbol = tmp; - } - - char line[1024]; - snprintf(line, sizeof(line), " %p: %s\n", raw_stack[i], symbol); - result += line; - } - - return result; - -#else // !GTEST_HAS_ABSL - static_cast(max_depth); - static_cast(skip_count); - return ""; -#endif // GTEST_HAS_ABSL -} - -void OsStackTraceGetter::UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_) { -#if GTEST_HAS_ABSL - void* caller_frame = nullptr; - if (absl::GetStackTrace(&caller_frame, 1, 3) <= 0) { - caller_frame = nullptr; - } - - MutexLock lock(&mutex_); - caller_frame_ = caller_frame; -#endif // GTEST_HAS_ABSL -} - -// A helper class that creates the premature-exit file in its -// constructor and deletes the file in its destructor. -class ScopedPrematureExitFile { - public: - explicit ScopedPrematureExitFile(const char* premature_exit_filepath) - : premature_exit_filepath_(premature_exit_filepath ? - premature_exit_filepath : "") { - // If a path to the premature-exit file is specified... - if (!premature_exit_filepath_.empty()) { - // create the file with a single "0" character in it. I/O - // errors are ignored as there's nothing better we can do and we - // don't want to fail the test because of this. - FILE* pfile = posix::FOpen(premature_exit_filepath, "w"); - fwrite("0", 1, 1, pfile); - fclose(pfile); - } - } - - ~ScopedPrematureExitFile() { -#if !defined GTEST_OS_ESP8266 - if (!premature_exit_filepath_.empty()) { - int retval = remove(premature_exit_filepath_.c_str()); - if (retval) { - GTEST_LOG_(ERROR) << "Failed to remove premature exit filepath \"" - << premature_exit_filepath_ << "\" with error " - << retval; - } - } -#endif - } - - private: - const std::string premature_exit_filepath_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile); -}; - -} // namespace internal - -// class TestEventListeners - -TestEventListeners::TestEventListeners() - : repeater_(new internal::TestEventRepeater()), - default_result_printer_(nullptr), - default_xml_generator_(nullptr) {} - -TestEventListeners::~TestEventListeners() { delete repeater_; } - -// Returns the standard listener responsible for the default console -// output. Can be removed from the listeners list to shut down default -// console output. Note that removing this object from the listener list -// with Release transfers its ownership to the user. -void TestEventListeners::Append(TestEventListener* listener) { - repeater_->Append(listener); -} - -// Removes the given event listener from the list and returns it. It then -// becomes the caller's responsibility to delete the listener. Returns -// NULL if the listener is not found in the list. -TestEventListener* TestEventListeners::Release(TestEventListener* listener) { - if (listener == default_result_printer_) - default_result_printer_ = nullptr; - else if (listener == default_xml_generator_) - default_xml_generator_ = nullptr; - return repeater_->Release(listener); -} - -// Returns repeater that broadcasts the TestEventListener events to all -// subscribers. -TestEventListener* TestEventListeners::repeater() { return repeater_; } - -// Sets the default_result_printer attribute to the provided listener. -// The listener is also added to the listener list and previous -// default_result_printer is removed from it and deleted. The listener can -// also be NULL in which case it will not be added to the list. Does -// nothing if the previous and the current listener objects are the same. -void TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) { - if (default_result_printer_ != listener) { - // It is an error to pass this method a listener that is already in the - // list. - delete Release(default_result_printer_); - default_result_printer_ = listener; - if (listener != nullptr) Append(listener); - } -} - -// Sets the default_xml_generator attribute to the provided listener. The -// listener is also added to the listener list and previous -// default_xml_generator is removed from it and deleted. The listener can -// also be NULL in which case it will not be added to the list. Does -// nothing if the previous and the current listener objects are the same. -void TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) { - if (default_xml_generator_ != listener) { - // It is an error to pass this method a listener that is already in the - // list. - delete Release(default_xml_generator_); - default_xml_generator_ = listener; - if (listener != nullptr) Append(listener); - } -} - -// Controls whether events will be forwarded by the repeater to the -// listeners in the list. -bool TestEventListeners::EventForwardingEnabled() const { - return repeater_->forwarding_enabled(); -} - -void TestEventListeners::SuppressEventForwarding() { - repeater_->set_forwarding_enabled(false); -} - -// class UnitTest - -// Gets the singleton UnitTest object. The first time this method is -// called, a UnitTest object is constructed and returned. Consecutive -// calls will return the same object. -// -// We don't protect this under mutex_ as a user is not supposed to -// call this before main() starts, from which point on the return -// value will never change. -UnitTest* UnitTest::GetInstance() { - // CodeGear C++Builder insists on a public destructor for the - // default implementation. Use this implementation to keep good OO - // design with private destructor. - -#if defined(__BORLANDC__) - static UnitTest* const instance = new UnitTest; - return instance; -#else - static UnitTest instance; - return &instance; -#endif // defined(__BORLANDC__) -} - -// Gets the number of successful test suites. -int UnitTest::successful_test_suite_count() const { - return impl()->successful_test_suite_count(); -} - -// Gets the number of failed test suites. -int UnitTest::failed_test_suite_count() const { - return impl()->failed_test_suite_count(); -} - -// Gets the number of all test suites. -int UnitTest::total_test_suite_count() const { - return impl()->total_test_suite_count(); -} - -// Gets the number of all test suites that contain at least one test -// that should run. -int UnitTest::test_suite_to_run_count() const { - return impl()->test_suite_to_run_count(); -} - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -int UnitTest::successful_test_case_count() const { - return impl()->successful_test_suite_count(); -} -int UnitTest::failed_test_case_count() const { - return impl()->failed_test_suite_count(); -} -int UnitTest::total_test_case_count() const { - return impl()->total_test_suite_count(); -} -int UnitTest::test_case_to_run_count() const { - return impl()->test_suite_to_run_count(); -} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -// Gets the number of successful tests. -int UnitTest::successful_test_count() const { - return impl()->successful_test_count(); -} - -// Gets the number of skipped tests. -int UnitTest::skipped_test_count() const { - return impl()->skipped_test_count(); -} - -// Gets the number of failed tests. -int UnitTest::failed_test_count() const { return impl()->failed_test_count(); } - -// Gets the number of disabled tests that will be reported in the XML report. -int UnitTest::reportable_disabled_test_count() const { - return impl()->reportable_disabled_test_count(); -} - -// Gets the number of disabled tests. -int UnitTest::disabled_test_count() const { - return impl()->disabled_test_count(); -} - -// Gets the number of tests to be printed in the XML report. -int UnitTest::reportable_test_count() const { - return impl()->reportable_test_count(); -} - -// Gets the number of all tests. -int UnitTest::total_test_count() const { return impl()->total_test_count(); } - -// Gets the number of tests that should run. -int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); } - -// Gets the time of the test program start, in ms from the start of the -// UNIX epoch. -internal::TimeInMillis UnitTest::start_timestamp() const { - return impl()->start_timestamp(); -} - -// Gets the elapsed time, in milliseconds. -internal::TimeInMillis UnitTest::elapsed_time() const { - return impl()->elapsed_time(); -} - -// Returns true if and only if the unit test passed (i.e. all test suites -// passed). -bool UnitTest::Passed() const { return impl()->Passed(); } - -// Returns true if and only if the unit test failed (i.e. some test suite -// failed or something outside of all tests failed). -bool UnitTest::Failed() const { return impl()->Failed(); } - -// Gets the i-th test suite among all the test suites. i can range from 0 to -// total_test_suite_count() - 1. If i is not in that range, returns NULL. -const TestSuite* UnitTest::GetTestSuite(int i) const { - return impl()->GetTestSuite(i); -} - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -const TestCase* UnitTest::GetTestCase(int i) const { - return impl()->GetTestCase(i); -} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -// Returns the TestResult containing information on test failures and -// properties logged outside of individual test suites. -const TestResult& UnitTest::ad_hoc_test_result() const { - return *impl()->ad_hoc_test_result(); -} - -// Gets the i-th test suite among all the test suites. i can range from 0 to -// total_test_suite_count() - 1. If i is not in that range, returns NULL. -TestSuite* UnitTest::GetMutableTestSuite(int i) { - return impl()->GetMutableSuiteCase(i); -} - -// Returns the list of event listeners that can be used to track events -// inside Google Test. -TestEventListeners& UnitTest::listeners() { - return *impl()->listeners(); -} - -// Registers and returns a global test environment. When a test -// program is run, all global test environments will be set-up in the -// order they were registered. After all tests in the program have -// finished, all global test environments will be torn-down in the -// *reverse* order they were registered. -// -// The UnitTest object takes ownership of the given environment. -// -// We don't protect this under mutex_, as we only support calling it -// from the main thread. -Environment* UnitTest::AddEnvironment(Environment* env) { - if (env == nullptr) { - return nullptr; - } - - impl_->environments().push_back(env); - return env; -} - -// Adds a TestPartResult to the current TestResult object. All Google Test -// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call -// this to report their results. The user code should use the -// assertion macros instead of calling this directly. -void UnitTest::AddTestPartResult( - TestPartResult::Type result_type, - const char* file_name, - int line_number, - const std::string& message, - const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_) { - Message msg; - msg << message; - - internal::MutexLock lock(&mutex_); - if (impl_->gtest_trace_stack().size() > 0) { - msg << "\n" << GTEST_NAME_ << " trace:"; - - for (size_t i = impl_->gtest_trace_stack().size(); i > 0; --i) { - const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1]; - msg << "\n" << internal::FormatFileLocation(trace.file, trace.line) - << " " << trace.message; - } - } - - if (os_stack_trace.c_str() != nullptr && !os_stack_trace.empty()) { - msg << internal::kStackTraceMarker << os_stack_trace; - } - - const TestPartResult result = TestPartResult( - result_type, file_name, line_number, msg.GetString().c_str()); - impl_->GetTestPartResultReporterForCurrentThread()-> - ReportTestPartResult(result); - - if (result_type != TestPartResult::kSuccess && - result_type != TestPartResult::kSkip) { - // gtest_break_on_failure takes precedence over - // gtest_throw_on_failure. This allows a user to set the latter - // in the code (perhaps in order to use Google Test assertions - // with another testing framework) and specify the former on the - // command line for debugging. - if (GTEST_FLAG(break_on_failure)) { -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT - // Using DebugBreak on Windows allows gtest to still break into a debugger - // when a failure happens and both the --gtest_break_on_failure and - // the --gtest_catch_exceptions flags are specified. - DebugBreak(); -#elif (!defined(__native_client__)) && \ - ((defined(__clang__) || defined(__GNUC__)) && \ - (defined(__x86_64__) || defined(__i386__))) - // with clang/gcc we can achieve the same effect on x86 by invoking int3 - asm("int3"); -#else - // Dereference nullptr through a volatile pointer to prevent the compiler - // from removing. We use this rather than abort() or __builtin_trap() for - // portability: some debuggers don't correctly trap abort(). - *static_cast(nullptr) = 1; -#endif // GTEST_OS_WINDOWS - } else if (GTEST_FLAG(throw_on_failure)) { -#if GTEST_HAS_EXCEPTIONS - throw internal::GoogleTestFailureException(result); -#else - // We cannot call abort() as it generates a pop-up in debug mode - // that cannot be suppressed in VC 7.1 or below. - exit(1); -#endif - } - } -} - -// Adds a TestProperty to the current TestResult object when invoked from -// inside a test, to current TestSuite's ad_hoc_test_result_ when invoked -// from SetUpTestSuite or TearDownTestSuite, or to the global property set -// when invoked elsewhere. If the result already contains a property with -// the same key, the value will be updated. -void UnitTest::RecordProperty(const std::string& key, - const std::string& value) { - impl_->RecordProperty(TestProperty(key, value)); -} - -// Runs all tests in this UnitTest object and prints the result. -// Returns 0 if successful, or 1 otherwise. -// -// We don't protect this under mutex_, as we only support calling it -// from the main thread. -int UnitTest::Run() { - const bool in_death_test_child_process = - internal::GTEST_FLAG(internal_run_death_test).length() > 0; - - // Google Test implements this protocol for catching that a test - // program exits before returning control to Google Test: - // - // 1. Upon start, Google Test creates a file whose absolute path - // is specified by the environment variable - // TEST_PREMATURE_EXIT_FILE. - // 2. When Google Test has finished its work, it deletes the file. - // - // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before - // running a Google-Test-based test program and check the existence - // of the file at the end of the test execution to see if it has - // exited prematurely. - - // If we are in the child process of a death test, don't - // create/delete the premature exit file, as doing so is unnecessary - // and will confuse the parent process. Otherwise, create/delete - // the file upon entering/leaving this function. If the program - // somehow exits before this function has a chance to return, the - // premature-exit file will be left undeleted, causing a test runner - // that understands the premature-exit-file protocol to report the - // test as having failed. - const internal::ScopedPrematureExitFile premature_exit_file( - in_death_test_child_process - ? nullptr - : internal::posix::GetEnv("TEST_PREMATURE_EXIT_FILE")); - - // Captures the value of GTEST_FLAG(catch_exceptions). This value will be - // used for the duration of the program. - impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions)); - -#if GTEST_OS_WINDOWS - // Either the user wants Google Test to catch exceptions thrown by the - // tests or this is executing in the context of death test child - // process. In either case the user does not want to see pop-up dialogs - // about crashes - they are expected. - if (impl()->catch_exceptions() || in_death_test_child_process) { -# if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT - // SetErrorMode doesn't exist on CE. - SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | - SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); -# endif // !GTEST_OS_WINDOWS_MOBILE - -# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE - // Death test children can be terminated with _abort(). On Windows, - // _abort() can show a dialog with a warning message. This forces the - // abort message to go to stderr instead. - _set_error_mode(_OUT_TO_STDERR); -# endif - -# if defined(_MSC_VER) && !GTEST_OS_WINDOWS_MOBILE - // In the debug version, Visual Studio pops up a separate dialog - // offering a choice to debug the aborted program. We need to suppress - // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement - // executed. Google Test will notify the user of any unexpected - // failure via stderr. - if (!GTEST_FLAG(break_on_failure)) - _set_abort_behavior( - 0x0, // Clear the following flags: - _WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump. - - // In debug mode, the Windows CRT can crash with an assertion over invalid - // input (e.g. passing an invalid file descriptor). The default handling - // for these assertions is to pop up a dialog and wait for user input. - // Instead ask the CRT to dump such assertions to stderr non-interactively. - if (!IsDebuggerPresent()) { - (void)_CrtSetReportMode(_CRT_ASSERT, - _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); - (void)_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); - } -# endif - } -#endif // GTEST_OS_WINDOWS - - return internal::HandleExceptionsInMethodIfSupported( - impl(), - &internal::UnitTestImpl::RunAllTests, - "auxiliary test code (environments or event listeners)") ? 0 : 1; -} - -// Returns the working directory when the first TEST() or TEST_F() was -// executed. -const char* UnitTest::original_working_dir() const { - return impl_->original_working_dir_.c_str(); -} - -// Returns the TestSuite object for the test that's currently running, -// or NULL if no test is running. -const TestSuite* UnitTest::current_test_suite() const - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - return impl_->current_test_suite(); -} - -// Legacy API is still available but deprecated -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -const TestCase* UnitTest::current_test_case() const - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - return impl_->current_test_suite(); -} -#endif - -// Returns the TestInfo object for the test that's currently running, -// or NULL if no test is running. -const TestInfo* UnitTest::current_test_info() const - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - return impl_->current_test_info(); -} - -// Returns the random seed used at the start of the current test run. -int UnitTest::random_seed() const { return impl_->random_seed(); } - -// Returns ParameterizedTestSuiteRegistry object used to keep track of -// value-parameterized tests and instantiate and register them. -internal::ParameterizedTestSuiteRegistry& -UnitTest::parameterized_test_registry() GTEST_LOCK_EXCLUDED_(mutex_) { - return impl_->parameterized_test_registry(); -} - -// Creates an empty UnitTest. -UnitTest::UnitTest() { - impl_ = new internal::UnitTestImpl(this); -} - -// Destructor of UnitTest. -UnitTest::~UnitTest() { - delete impl_; -} - -// Pushes a trace defined by SCOPED_TRACE() on to the per-thread -// Google Test trace stack. -void UnitTest::PushGTestTrace(const internal::TraceInfo& trace) - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - impl_->gtest_trace_stack().push_back(trace); -} - -// Pops a trace from the per-thread Google Test trace stack. -void UnitTest::PopGTestTrace() - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - impl_->gtest_trace_stack().pop_back(); -} - -namespace internal { - -UnitTestImpl::UnitTestImpl(UnitTest* parent) - : parent_(parent), - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */) - default_global_test_part_result_reporter_(this), - default_per_thread_test_part_result_reporter_(this), - GTEST_DISABLE_MSC_WARNINGS_POP_() global_test_part_result_repoter_( - &default_global_test_part_result_reporter_), - per_thread_test_part_result_reporter_( - &default_per_thread_test_part_result_reporter_), - parameterized_test_registry_(), - parameterized_tests_registered_(false), - last_death_test_suite_(-1), - current_test_suite_(nullptr), - current_test_info_(nullptr), - ad_hoc_test_result_(), - os_stack_trace_getter_(nullptr), - post_flag_parse_init_performed_(false), - random_seed_(0), // Will be overridden by the flag before first use. - random_(0), // Will be reseeded before first use. - start_timestamp_(0), - elapsed_time_(0), -#if GTEST_HAS_DEATH_TEST - death_test_factory_(new DefaultDeathTestFactory), -#endif - // Will be overridden by the flag before first use. - catch_exceptions_(false) { - listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter); -} - -UnitTestImpl::~UnitTestImpl() { - // Deletes every TestSuite. - ForEach(test_suites_, internal::Delete); - - // Deletes every Environment. - ForEach(environments_, internal::Delete); - - delete os_stack_trace_getter_; -} - -// Adds a TestProperty to the current TestResult object when invoked in a -// context of a test, to current test suite's ad_hoc_test_result when invoke -// from SetUpTestSuite/TearDownTestSuite, or to the global property set -// otherwise. If the result already contains a property with the same key, -// the value will be updated. -void UnitTestImpl::RecordProperty(const TestProperty& test_property) { - std::string xml_element; - TestResult* test_result; // TestResult appropriate for property recording. - - if (current_test_info_ != nullptr) { - xml_element = "testcase"; - test_result = &(current_test_info_->result_); - } else if (current_test_suite_ != nullptr) { - xml_element = "testsuite"; - test_result = &(current_test_suite_->ad_hoc_test_result_); - } else { - xml_element = "testsuites"; - test_result = &ad_hoc_test_result_; - } - test_result->RecordProperty(xml_element, test_property); -} - -#if GTEST_HAS_DEATH_TEST -// Disables event forwarding if the control is currently in a death test -// subprocess. Must not be called before InitGoogleTest. -void UnitTestImpl::SuppressTestEventsIfInSubprocess() { - if (internal_run_death_test_flag_.get() != nullptr) - listeners()->SuppressEventForwarding(); -} -#endif // GTEST_HAS_DEATH_TEST - -// Initializes event listeners performing XML output as specified by -// UnitTestOptions. Must not be called before InitGoogleTest. -void UnitTestImpl::ConfigureXmlOutput() { - const std::string& output_format = UnitTestOptions::GetOutputFormat(); - if (output_format == "xml") { - listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); - } else if (output_format == "json") { - listeners()->SetDefaultXmlGenerator(new JsonUnitTestResultPrinter( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); - } else if (output_format != "") { - GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \"" - << output_format << "\" ignored."; - } -} - -#if GTEST_CAN_STREAM_RESULTS_ -// Initializes event listeners for streaming test results in string form. -// Must not be called before InitGoogleTest. -void UnitTestImpl::ConfigureStreamingOutput() { - const std::string& target = GTEST_FLAG(stream_result_to); - if (!target.empty()) { - const size_t pos = target.find(':'); - if (pos != std::string::npos) { - listeners()->Append(new StreamingListener(target.substr(0, pos), - target.substr(pos+1))); - } else { - GTEST_LOG_(WARNING) << "unrecognized streaming target \"" << target - << "\" ignored."; - } - } -} -#endif // GTEST_CAN_STREAM_RESULTS_ - -// Performs initialization dependent upon flag values obtained in -// ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to -// ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest -// this function is also called from RunAllTests. Since this function can be -// called more than once, it has to be idempotent. -void UnitTestImpl::PostFlagParsingInit() { - // Ensures that this function does not execute more than once. - if (!post_flag_parse_init_performed_) { - post_flag_parse_init_performed_ = true; - -#if defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_) - // Register to send notifications about key process state changes. - listeners()->Append(new GTEST_CUSTOM_TEST_EVENT_LISTENER_()); -#endif // defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_) - -#if GTEST_HAS_DEATH_TEST - InitDeathTestSubprocessControlInfo(); - SuppressTestEventsIfInSubprocess(); -#endif // GTEST_HAS_DEATH_TEST - - // Registers parameterized tests. This makes parameterized tests - // available to the UnitTest reflection API without running - // RUN_ALL_TESTS. - RegisterParameterizedTests(); - - // Configures listeners for XML output. This makes it possible for users - // to shut down the default XML output before invoking RUN_ALL_TESTS. - ConfigureXmlOutput(); - - if (GTEST_FLAG(brief)) { - listeners()->SetDefaultResultPrinter(new BriefUnitTestResultPrinter); - } - -#if GTEST_CAN_STREAM_RESULTS_ - // Configures listeners for streaming test results to the specified server. - ConfigureStreamingOutput(); -#endif // GTEST_CAN_STREAM_RESULTS_ - -#if GTEST_HAS_ABSL - if (GTEST_FLAG(install_failure_signal_handler)) { - absl::FailureSignalHandlerOptions options; - absl::InstallFailureSignalHandler(options); - } -#endif // GTEST_HAS_ABSL - } -} - -// A predicate that checks the name of a TestSuite against a known -// value. -// -// This is used for implementation of the UnitTest class only. We put -// it in the anonymous namespace to prevent polluting the outer -// namespace. -// -// TestSuiteNameIs is copyable. -class TestSuiteNameIs { - public: - // Constructor. - explicit TestSuiteNameIs(const std::string& name) : name_(name) {} - - // Returns true if and only if the name of test_suite matches name_. - bool operator()(const TestSuite* test_suite) const { - return test_suite != nullptr && - strcmp(test_suite->name(), name_.c_str()) == 0; - } - - private: - std::string name_; -}; - -// Finds and returns a TestSuite with the given name. If one doesn't -// exist, creates one and returns it. It's the CALLER'S -// RESPONSIBILITY to ensure that this function is only called WHEN THE -// TESTS ARE NOT SHUFFLED. -// -// Arguments: -// -// test_suite_name: name of the test suite -// type_param: the name of the test suite's type parameter, or NULL if -// this is not a typed or a type-parameterized test suite. -// set_up_tc: pointer to the function that sets up the test suite -// tear_down_tc: pointer to the function that tears down the test suite -TestSuite* UnitTestImpl::GetTestSuite( - const char* test_suite_name, const char* type_param, - internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc) { - // Can we find a TestSuite with the given name? - const auto test_suite = - std::find_if(test_suites_.rbegin(), test_suites_.rend(), - TestSuiteNameIs(test_suite_name)); - - if (test_suite != test_suites_.rend()) return *test_suite; - - // No. Let's create one. - auto* const new_test_suite = - new TestSuite(test_suite_name, type_param, set_up_tc, tear_down_tc); - - // Is this a death test suite? - if (internal::UnitTestOptions::MatchesFilter(test_suite_name, - kDeathTestSuiteFilter)) { - // Yes. Inserts the test suite after the last death test suite - // defined so far. This only works when the test suites haven't - // been shuffled. Otherwise we may end up running a death test - // after a non-death test. - ++last_death_test_suite_; - test_suites_.insert(test_suites_.begin() + last_death_test_suite_, - new_test_suite); - } else { - // No. Appends to the end of the list. - test_suites_.push_back(new_test_suite); - } - - test_suite_indices_.push_back(static_cast(test_suite_indices_.size())); - return new_test_suite; -} - -// Helpers for setting up / tearing down the given environment. They -// are for use in the ForEach() function. -static void SetUpEnvironment(Environment* env) { env->SetUp(); } -static void TearDownEnvironment(Environment* env) { env->TearDown(); } - -// Runs all tests in this UnitTest object, prints the result, and -// returns true if all tests are successful. If any exception is -// thrown during a test, the test is considered to be failed, but the -// rest of the tests will still be run. -// -// When parameterized tests are enabled, it expands and registers -// parameterized tests first in RegisterParameterizedTests(). -// All other functions called from RunAllTests() may safely assume that -// parameterized tests are ready to be counted and run. -bool UnitTestImpl::RunAllTests() { - // True if and only if Google Test is initialized before RUN_ALL_TESTS() is - // called. - const bool gtest_is_initialized_before_run_all_tests = GTestIsInitialized(); - - // Do not run any test if the --help flag was specified. - if (g_help_flag) - return true; - - // Repeats the call to the post-flag parsing initialization in case the - // user didn't call InitGoogleTest. - PostFlagParsingInit(); - - // Even if sharding is not on, test runners may want to use the - // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding - // protocol. - internal::WriteToShardStatusFileIfNeeded(); - - // True if and only if we are in a subprocess for running a thread-safe-style - // death test. - bool in_subprocess_for_death_test = false; - -#if GTEST_HAS_DEATH_TEST - in_subprocess_for_death_test = - (internal_run_death_test_flag_.get() != nullptr); -# if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_) - if (in_subprocess_for_death_test) { - GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_(); - } -# endif // defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_) -#endif // GTEST_HAS_DEATH_TEST - - const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex, - in_subprocess_for_death_test); - - // Compares the full test names with the filter to decide which - // tests to run. - const bool has_tests_to_run = FilterTests(should_shard - ? HONOR_SHARDING_PROTOCOL - : IGNORE_SHARDING_PROTOCOL) > 0; - - // Lists the tests and exits if the --gtest_list_tests flag was specified. - if (GTEST_FLAG(list_tests)) { - // This must be called *after* FilterTests() has been called. - ListTestsMatchingFilter(); - return true; - } - - random_seed_ = GTEST_FLAG(shuffle) ? - GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0; - - // True if and only if at least one test has failed. - bool failed = false; - - TestEventListener* repeater = listeners()->repeater(); - - start_timestamp_ = GetTimeInMillis(); - repeater->OnTestProgramStart(*parent_); - - // How many times to repeat the tests? We don't want to repeat them - // when we are inside the subprocess of a death test. - const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat); - // Repeats forever if the repeat count is negative. - const bool gtest_repeat_forever = repeat < 0; - for (int i = 0; gtest_repeat_forever || i != repeat; i++) { - // We want to preserve failures generated by ad-hoc test - // assertions executed before RUN_ALL_TESTS(). - ClearNonAdHocTestResult(); - - Timer timer; - - // Shuffles test suites and tests if requested. - if (has_tests_to_run && GTEST_FLAG(shuffle)) { - random()->Reseed(static_cast(random_seed_)); - // This should be done before calling OnTestIterationStart(), - // such that a test event listener can see the actual test order - // in the event. - ShuffleTests(); - } - - // Tells the unit test event listeners that the tests are about to start. - repeater->OnTestIterationStart(*parent_, i); - - // Runs each test suite if there is at least one test to run. - if (has_tests_to_run) { - // Sets up all environments beforehand. - repeater->OnEnvironmentsSetUpStart(*parent_); - ForEach(environments_, SetUpEnvironment); - repeater->OnEnvironmentsSetUpEnd(*parent_); - - // Runs the tests only if there was no fatal failure or skip triggered - // during global set-up. - if (Test::IsSkipped()) { - // Emit diagnostics when global set-up calls skip, as it will not be - // emitted by default. - TestResult& test_result = - *internal::GetUnitTestImpl()->current_test_result(); - for (int j = 0; j < test_result.total_part_count(); ++j) { - const TestPartResult& test_part_result = - test_result.GetTestPartResult(j); - if (test_part_result.type() == TestPartResult::kSkip) { - const std::string& result = test_part_result.message(); - printf("%s\n", result.c_str()); - } - } - fflush(stdout); - } else if (!Test::HasFatalFailure()) { - for (int test_index = 0; test_index < total_test_suite_count(); - test_index++) { - GetMutableSuiteCase(test_index)->Run(); - if (GTEST_FLAG(fail_fast) && - GetMutableSuiteCase(test_index)->Failed()) { - for (int j = test_index + 1; j < total_test_suite_count(); j++) { - GetMutableSuiteCase(j)->Skip(); - } - break; - } - } - } else if (Test::HasFatalFailure()) { - // If there was a fatal failure during the global setup then we know we - // aren't going to run any tests. Explicitly mark all of the tests as - // skipped to make this obvious in the output. - for (int test_index = 0; test_index < total_test_suite_count(); - test_index++) { - GetMutableSuiteCase(test_index)->Skip(); - } - } - - // Tears down all environments in reverse order afterwards. - repeater->OnEnvironmentsTearDownStart(*parent_); - std::for_each(environments_.rbegin(), environments_.rend(), - TearDownEnvironment); - repeater->OnEnvironmentsTearDownEnd(*parent_); - } - - elapsed_time_ = timer.Elapsed(); - - // Tells the unit test event listener that the tests have just finished. - repeater->OnTestIterationEnd(*parent_, i); - - // Gets the result and clears it. - if (!Passed()) { - failed = true; - } - - // Restores the original test order after the iteration. This - // allows the user to quickly repro a failure that happens in the - // N-th iteration without repeating the first (N - 1) iterations. - // This is not enclosed in "if (GTEST_FLAG(shuffle)) { ... }", in - // case the user somehow changes the value of the flag somewhere - // (it's always safe to unshuffle the tests). - UnshuffleTests(); - - if (GTEST_FLAG(shuffle)) { - // Picks a new random seed for each iteration. - random_seed_ = GetNextRandomSeed(random_seed_); - } - } - - repeater->OnTestProgramEnd(*parent_); - - if (!gtest_is_initialized_before_run_all_tests) { - ColoredPrintf( - GTestColor::kRed, - "\nIMPORTANT NOTICE - DO NOT IGNORE:\n" - "This test program did NOT call " GTEST_INIT_GOOGLE_TEST_NAME_ - "() before calling RUN_ALL_TESTS(). This is INVALID. Soon " GTEST_NAME_ - " will start to enforce the valid usage. " - "Please fix it ASAP, or IT WILL START TO FAIL.\n"); // NOLINT -#if GTEST_FOR_GOOGLE_ - ColoredPrintf(GTestColor::kRed, - "For more details, see http://wiki/Main/ValidGUnitMain.\n"); -#endif // GTEST_FOR_GOOGLE_ - } - - return !failed; -} - -// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file -// if the variable is present. If a file already exists at this location, this -// function will write over it. If the variable is present, but the file cannot -// be created, prints an error and exits. -void WriteToShardStatusFileIfNeeded() { - const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile); - if (test_shard_file != nullptr) { - FILE* const file = posix::FOpen(test_shard_file, "w"); - if (file == nullptr) { - ColoredPrintf(GTestColor::kRed, - "Could not write to the test shard status file \"%s\" " - "specified by the %s environment variable.\n", - test_shard_file, kTestShardStatusFile); - fflush(stdout); - exit(EXIT_FAILURE); - } - fclose(file); - } -} - -// Checks whether sharding is enabled by examining the relevant -// environment variable values. If the variables are present, -// but inconsistent (i.e., shard_index >= total_shards), prints -// an error and exits. If in_subprocess_for_death_test, sharding is -// disabled because it must only be applied to the original test -// process. Otherwise, we could filter out death tests we intended to execute. -bool ShouldShard(const char* total_shards_env, - const char* shard_index_env, - bool in_subprocess_for_death_test) { - if (in_subprocess_for_death_test) { - return false; - } - - const int32_t total_shards = Int32FromEnvOrDie(total_shards_env, -1); - const int32_t shard_index = Int32FromEnvOrDie(shard_index_env, -1); - - if (total_shards == -1 && shard_index == -1) { - return false; - } else if (total_shards == -1 && shard_index != -1) { - const Message msg = Message() - << "Invalid environment variables: you have " - << kTestShardIndex << " = " << shard_index - << ", but have left " << kTestTotalShards << " unset.\n"; - ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str()); - fflush(stdout); - exit(EXIT_FAILURE); - } else if (total_shards != -1 && shard_index == -1) { - const Message msg = Message() - << "Invalid environment variables: you have " - << kTestTotalShards << " = " << total_shards - << ", but have left " << kTestShardIndex << " unset.\n"; - ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str()); - fflush(stdout); - exit(EXIT_FAILURE); - } else if (shard_index < 0 || shard_index >= total_shards) { - const Message msg = Message() - << "Invalid environment variables: we require 0 <= " - << kTestShardIndex << " < " << kTestTotalShards - << ", but you have " << kTestShardIndex << "=" << shard_index - << ", " << kTestTotalShards << "=" << total_shards << ".\n"; - ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str()); - fflush(stdout); - exit(EXIT_FAILURE); - } - - return total_shards > 1; -} - -// Parses the environment variable var as an Int32. If it is unset, -// returns default_val. If it is not an Int32, prints an error -// and aborts. -int32_t Int32FromEnvOrDie(const char* var, int32_t default_val) { - const char* str_val = posix::GetEnv(var); - if (str_val == nullptr) { - return default_val; - } - - int32_t result; - if (!ParseInt32(Message() << "The value of environment variable " << var, - str_val, &result)) { - exit(EXIT_FAILURE); - } - return result; -} - -// Given the total number of shards, the shard index, and the test id, -// returns true if and only if the test should be run on this shard. The test id -// is some arbitrary but unique non-negative integer assigned to each test -// method. Assumes that 0 <= shard_index < total_shards. -bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) { - return (test_id % total_shards) == shard_index; -} - -// Compares the name of each test with the user-specified filter to -// decide whether the test should be run, then records the result in -// each TestSuite and TestInfo object. -// If shard_tests == true, further filters tests based on sharding -// variables in the environment - see -// https://github.com/google/googletest/blob/master/googletest/docs/advanced.md -// . Returns the number of tests that should run. -int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) { - const int32_t total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ? - Int32FromEnvOrDie(kTestTotalShards, -1) : -1; - const int32_t shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ? - Int32FromEnvOrDie(kTestShardIndex, -1) : -1; - - // num_runnable_tests are the number of tests that will - // run across all shards (i.e., match filter and are not disabled). - // num_selected_tests are the number of tests to be run on - // this shard. - int num_runnable_tests = 0; - int num_selected_tests = 0; - for (auto* test_suite : test_suites_) { - const std::string& test_suite_name = test_suite->name(); - test_suite->set_should_run(false); - - for (size_t j = 0; j < test_suite->test_info_list().size(); j++) { - TestInfo* const test_info = test_suite->test_info_list()[j]; - const std::string test_name(test_info->name()); - // A test is disabled if test suite name or test name matches - // kDisableTestFilter. - const bool is_disabled = internal::UnitTestOptions::MatchesFilter( - test_suite_name, kDisableTestFilter) || - internal::UnitTestOptions::MatchesFilter( - test_name, kDisableTestFilter); - test_info->is_disabled_ = is_disabled; - - const bool matches_filter = internal::UnitTestOptions::FilterMatchesTest( - test_suite_name, test_name); - test_info->matches_filter_ = matches_filter; - - const bool is_runnable = - (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) && - matches_filter; - - const bool is_in_another_shard = - shard_tests != IGNORE_SHARDING_PROTOCOL && - !ShouldRunTestOnShard(total_shards, shard_index, num_runnable_tests); - test_info->is_in_another_shard_ = is_in_another_shard; - const bool is_selected = is_runnable && !is_in_another_shard; - - num_runnable_tests += is_runnable; - num_selected_tests += is_selected; - - test_info->should_run_ = is_selected; - test_suite->set_should_run(test_suite->should_run() || is_selected); - } - } - return num_selected_tests; -} - -// Prints the given C-string on a single line by replacing all '\n' -// characters with string "\\n". If the output takes more than -// max_length characters, only prints the first max_length characters -// and "...". -static void PrintOnOneLine(const char* str, int max_length) { - if (str != nullptr) { - for (int i = 0; *str != '\0'; ++str) { - if (i >= max_length) { - printf("..."); - break; - } - if (*str == '\n') { - printf("\\n"); - i += 2; - } else { - printf("%c", *str); - ++i; - } - } - } -} - -// Prints the names of the tests matching the user-specified filter flag. -void UnitTestImpl::ListTestsMatchingFilter() { - // Print at most this many characters for each type/value parameter. - const int kMaxParamLength = 250; - - for (auto* test_suite : test_suites_) { - bool printed_test_suite_name = false; - - for (size_t j = 0; j < test_suite->test_info_list().size(); j++) { - const TestInfo* const test_info = test_suite->test_info_list()[j]; - if (test_info->matches_filter_) { - if (!printed_test_suite_name) { - printed_test_suite_name = true; - printf("%s.", test_suite->name()); - if (test_suite->type_param() != nullptr) { - printf(" # %s = ", kTypeParamLabel); - // We print the type parameter on a single line to make - // the output easy to parse by a program. - PrintOnOneLine(test_suite->type_param(), kMaxParamLength); - } - printf("\n"); - } - printf(" %s", test_info->name()); - if (test_info->value_param() != nullptr) { - printf(" # %s = ", kValueParamLabel); - // We print the value parameter on a single line to make the - // output easy to parse by a program. - PrintOnOneLine(test_info->value_param(), kMaxParamLength); - } - printf("\n"); - } - } - } - fflush(stdout); - const std::string& output_format = UnitTestOptions::GetOutputFormat(); - if (output_format == "xml" || output_format == "json") { - FILE* fileout = OpenFileForWriting( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); - std::stringstream stream; - if (output_format == "xml") { - XmlUnitTestResultPrinter( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()) - .PrintXmlTestsList(&stream, test_suites_); - } else if (output_format == "json") { - JsonUnitTestResultPrinter( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()) - .PrintJsonTestList(&stream, test_suites_); - } - fprintf(fileout, "%s", StringStreamToString(&stream).c_str()); - fclose(fileout); - } -} - -// Sets the OS stack trace getter. -// -// Does nothing if the input and the current OS stack trace getter are -// the same; otherwise, deletes the old getter and makes the input the -// current getter. -void UnitTestImpl::set_os_stack_trace_getter( - OsStackTraceGetterInterface* getter) { - if (os_stack_trace_getter_ != getter) { - delete os_stack_trace_getter_; - os_stack_trace_getter_ = getter; - } -} - -// Returns the current OS stack trace getter if it is not NULL; -// otherwise, creates an OsStackTraceGetter, makes it the current -// getter, and returns it. -OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() { - if (os_stack_trace_getter_ == nullptr) { -#ifdef GTEST_OS_STACK_TRACE_GETTER_ - os_stack_trace_getter_ = new GTEST_OS_STACK_TRACE_GETTER_; -#else - os_stack_trace_getter_ = new OsStackTraceGetter; -#endif // GTEST_OS_STACK_TRACE_GETTER_ - } - - return os_stack_trace_getter_; -} - -// Returns the most specific TestResult currently running. -TestResult* UnitTestImpl::current_test_result() { - if (current_test_info_ != nullptr) { - return ¤t_test_info_->result_; - } - if (current_test_suite_ != nullptr) { - return ¤t_test_suite_->ad_hoc_test_result_; - } - return &ad_hoc_test_result_; -} - -// Shuffles all test suites, and the tests within each test suite, -// making sure that death tests are still run first. -void UnitTestImpl::ShuffleTests() { - // Shuffles the death test suites. - ShuffleRange(random(), 0, last_death_test_suite_ + 1, &test_suite_indices_); - - // Shuffles the non-death test suites. - ShuffleRange(random(), last_death_test_suite_ + 1, - static_cast(test_suites_.size()), &test_suite_indices_); - - // Shuffles the tests inside each test suite. - for (auto& test_suite : test_suites_) { - test_suite->ShuffleTests(random()); - } -} - -// Restores the test suites and tests to their order before the first shuffle. -void UnitTestImpl::UnshuffleTests() { - for (size_t i = 0; i < test_suites_.size(); i++) { - // Unshuffles the tests in each test suite. - test_suites_[i]->UnshuffleTests(); - // Resets the index of each test suite. - test_suite_indices_[i] = static_cast(i); - } -} - -// Returns the current OS stack trace as an std::string. -// -// The maximum number of stack frames to be included is specified by -// the gtest_stack_trace_depth flag. The skip_count parameter -// specifies the number of top frames to be skipped, which doesn't -// count against the number of frames to be included. -// -// For example, if Foo() calls Bar(), which in turn calls -// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in -// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. -std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/, - int skip_count) { - // We pass skip_count + 1 to skip this wrapper function in addition - // to what the user really wants to skip. - return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1); -} - -// Used by the GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ macro to -// suppress unreachable code warnings. -namespace { -class ClassUniqueToAlwaysTrue {}; -} - -bool IsTrue(bool condition) { return condition; } - -bool AlwaysTrue() { -#if GTEST_HAS_EXCEPTIONS - // This condition is always false so AlwaysTrue() never actually throws, - // but it makes the compiler think that it may throw. - if (IsTrue(false)) - throw ClassUniqueToAlwaysTrue(); -#endif // GTEST_HAS_EXCEPTIONS - return true; -} - -// If *pstr starts with the given prefix, modifies *pstr to be right -// past the prefix and returns true; otherwise leaves *pstr unchanged -// and returns false. None of pstr, *pstr, and prefix can be NULL. -bool SkipPrefix(const char* prefix, const char** pstr) { - const size_t prefix_len = strlen(prefix); - if (strncmp(*pstr, prefix, prefix_len) == 0) { - *pstr += prefix_len; - return true; - } - return false; -} - -// Parses a string as a command line flag. The string should have -// the format "--flag=value". When def_optional is true, the "=value" -// part can be omitted. -// -// Returns the value of the flag, or NULL if the parsing failed. -static const char* ParseFlagValue(const char* str, const char* flag, - bool def_optional) { - // str and flag must not be NULL. - if (str == nullptr || flag == nullptr) return nullptr; - - // The flag must start with "--" followed by GTEST_FLAG_PREFIX_. - const std::string flag_str = std::string("--") + GTEST_FLAG_PREFIX_ + flag; - const size_t flag_len = flag_str.length(); - if (strncmp(str, flag_str.c_str(), flag_len) != 0) return nullptr; - - // Skips the flag name. - const char* flag_end = str + flag_len; - - // When def_optional is true, it's OK to not have a "=value" part. - if (def_optional && (flag_end[0] == '\0')) { - return flag_end; - } - - // If def_optional is true and there are more characters after the - // flag name, or if def_optional is false, there must be a '=' after - // the flag name. - if (flag_end[0] != '=') return nullptr; - - // Returns the string after "=". - return flag_end + 1; -} - -// Parses a string for a bool flag, in the form of either -// "--flag=value" or "--flag". -// -// In the former case, the value is taken as true as long as it does -// not start with '0', 'f', or 'F'. -// -// In the latter case, the value is taken as true. -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -static bool ParseBoolFlag(const char* str, const char* flag, bool* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseFlagValue(str, flag, true); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Converts the string value to a bool. - *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F'); - return true; -} - -// Parses a string for an int32_t flag, in the form of "--flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -bool ParseInt32Flag(const char* str, const char* flag, int32_t* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseFlagValue(str, flag, false); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Sets *value to the value of the flag. - return ParseInt32(Message() << "The value of flag --" << flag, - value_str, value); -} - -// Parses a string for a string flag, in the form of "--flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -template -static bool ParseStringFlag(const char* str, const char* flag, String* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseFlagValue(str, flag, false); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Sets *value to the value of the flag. - *value = value_str; - return true; -} - -// Determines whether a string has a prefix that Google Test uses for its -// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_. -// If Google Test detects that a command line flag has its prefix but is not -// recognized, it will print its help message. Flags starting with -// GTEST_INTERNAL_PREFIX_ followed by "internal_" are considered Google Test -// internal flags and do not trigger the help message. -static bool HasGoogleTestFlagPrefix(const char* str) { - return (SkipPrefix("--", &str) || - SkipPrefix("-", &str) || - SkipPrefix("/", &str)) && - !SkipPrefix(GTEST_FLAG_PREFIX_ "internal_", &str) && - (SkipPrefix(GTEST_FLAG_PREFIX_, &str) || - SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str)); -} - -// Prints a string containing code-encoded text. The following escape -// sequences can be used in the string to control the text color: -// -// @@ prints a single '@' character. -// @R changes the color to red. -// @G changes the color to green. -// @Y changes the color to yellow. -// @D changes to the default terminal text color. -// -static void PrintColorEncoded(const char* str) { - GTestColor color = GTestColor::kDefault; // The current color. - - // Conceptually, we split the string into segments divided by escape - // sequences. Then we print one segment at a time. At the end of - // each iteration, the str pointer advances to the beginning of the - // next segment. - for (;;) { - const char* p = strchr(str, '@'); - if (p == nullptr) { - ColoredPrintf(color, "%s", str); - return; - } - - ColoredPrintf(color, "%s", std::string(str, p).c_str()); - - const char ch = p[1]; - str = p + 2; - if (ch == '@') { - ColoredPrintf(color, "@"); - } else if (ch == 'D') { - color = GTestColor::kDefault; - } else if (ch == 'R') { - color = GTestColor::kRed; - } else if (ch == 'G') { - color = GTestColor::kGreen; - } else if (ch == 'Y') { - color = GTestColor::kYellow; - } else { - --str; - } - } -} - -static const char kColorEncodedHelpMessage[] = - "This program contains tests written using " GTEST_NAME_ - ". You can use the\n" - "following command line flags to control its behavior:\n" - "\n" - "Test Selection:\n" - " @G--" GTEST_FLAG_PREFIX_ - "list_tests@D\n" - " List the names of all tests instead of running them. The name of\n" - " TEST(Foo, Bar) is \"Foo.Bar\".\n" - " @G--" GTEST_FLAG_PREFIX_ - "filter=@YPOSITIVE_PATTERNS" - "[@G-@YNEGATIVE_PATTERNS]@D\n" - " Run only the tests whose name matches one of the positive patterns " - "but\n" - " none of the negative patterns. '?' matches any single character; " - "'*'\n" - " matches any substring; ':' separates two patterns.\n" - " @G--" GTEST_FLAG_PREFIX_ - "also_run_disabled_tests@D\n" - " Run all disabled tests too.\n" - "\n" - "Test Execution:\n" - " @G--" GTEST_FLAG_PREFIX_ - "repeat=@Y[COUNT]@D\n" - " Run the tests repeatedly; use a negative count to repeat forever.\n" - " @G--" GTEST_FLAG_PREFIX_ - "shuffle@D\n" - " Randomize tests' orders on every iteration.\n" - " @G--" GTEST_FLAG_PREFIX_ - "random_seed=@Y[NUMBER]@D\n" - " Random number seed to use for shuffling test orders (between 1 and\n" - " 99999, or 0 to use a seed based on the current time).\n" - "\n" - "Test Output:\n" - " @G--" GTEST_FLAG_PREFIX_ - "color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n" - " Enable/disable colored output. The default is @Gauto@D.\n" - " @G--" GTEST_FLAG_PREFIX_ - "brief=1@D\n" - " Only print test failures.\n" - " @G--" GTEST_FLAG_PREFIX_ - "print_time=0@D\n" - " Don't print the elapsed time of each test.\n" - " @G--" GTEST_FLAG_PREFIX_ - "output=@Y(@Gjson@Y|@Gxml@Y)[@G:@YDIRECTORY_PATH@G" GTEST_PATH_SEP_ - "@Y|@G:@YFILE_PATH]@D\n" - " Generate a JSON or XML report in the given directory or with the " - "given\n" - " file name. @YFILE_PATH@D defaults to @Gtest_detail.xml@D.\n" -# if GTEST_CAN_STREAM_RESULTS_ - " @G--" GTEST_FLAG_PREFIX_ - "stream_result_to=@YHOST@G:@YPORT@D\n" - " Stream test results to the given server.\n" -# endif // GTEST_CAN_STREAM_RESULTS_ - "\n" - "Assertion Behavior:\n" -# if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS - " @G--" GTEST_FLAG_PREFIX_ - "death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n" - " Set the default death test style.\n" -# endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS - " @G--" GTEST_FLAG_PREFIX_ - "break_on_failure@D\n" - " Turn assertion failures into debugger break-points.\n" - " @G--" GTEST_FLAG_PREFIX_ - "throw_on_failure@D\n" - " Turn assertion failures into C++ exceptions for use by an external\n" - " test framework.\n" - " @G--" GTEST_FLAG_PREFIX_ - "catch_exceptions=0@D\n" - " Do not report exceptions as test failures. Instead, allow them\n" - " to crash the program or throw a pop-up (on Windows).\n" - "\n" - "Except for @G--" GTEST_FLAG_PREFIX_ - "list_tests@D, you can alternatively set " - "the corresponding\n" - "environment variable of a flag (all letters in upper-case). For example, " - "to\n" - "disable colored text output, you can either specify " - "@G--" GTEST_FLAG_PREFIX_ - "color=no@D or set\n" - "the @G" GTEST_FLAG_PREFIX_UPPER_ - "COLOR@D environment variable to @Gno@D.\n" - "\n" - "For more information, please read the " GTEST_NAME_ - " documentation at\n" - "@G" GTEST_PROJECT_URL_ "@D. If you find a bug in " GTEST_NAME_ - "\n" - "(not one in your own code or tests), please report it to\n" - "@G<" GTEST_DEV_EMAIL_ ">@D.\n"; - -static bool ParseGoogleTestFlag(const char* const arg) { - return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag, - >EST_FLAG(also_run_disabled_tests)) || - ParseBoolFlag(arg, kBreakOnFailureFlag, - >EST_FLAG(break_on_failure)) || - ParseBoolFlag(arg, kCatchExceptionsFlag, - >EST_FLAG(catch_exceptions)) || - ParseStringFlag(arg, kColorFlag, >EST_FLAG(color)) || - ParseStringFlag(arg, kDeathTestStyleFlag, - >EST_FLAG(death_test_style)) || - ParseBoolFlag(arg, kDeathTestUseFork, - >EST_FLAG(death_test_use_fork)) || - ParseBoolFlag(arg, kFailFast, >EST_FLAG(fail_fast)) || - ParseStringFlag(arg, kFilterFlag, >EST_FLAG(filter)) || - ParseStringFlag(arg, kInternalRunDeathTestFlag, - >EST_FLAG(internal_run_death_test)) || - ParseBoolFlag(arg, kListTestsFlag, >EST_FLAG(list_tests)) || - ParseStringFlag(arg, kOutputFlag, >EST_FLAG(output)) || - ParseBoolFlag(arg, kBriefFlag, >EST_FLAG(brief)) || - ParseBoolFlag(arg, kPrintTimeFlag, >EST_FLAG(print_time)) || - ParseBoolFlag(arg, kPrintUTF8Flag, >EST_FLAG(print_utf8)) || - ParseInt32Flag(arg, kRandomSeedFlag, >EST_FLAG(random_seed)) || - ParseInt32Flag(arg, kRepeatFlag, >EST_FLAG(repeat)) || - ParseBoolFlag(arg, kShuffleFlag, >EST_FLAG(shuffle)) || - ParseInt32Flag(arg, kStackTraceDepthFlag, - >EST_FLAG(stack_trace_depth)) || - ParseStringFlag(arg, kStreamResultToFlag, - >EST_FLAG(stream_result_to)) || - ParseBoolFlag(arg, kThrowOnFailureFlag, >EST_FLAG(throw_on_failure)); -} - -#if GTEST_USE_OWN_FLAGFILE_FLAG_ -static void LoadFlagsFromFile(const std::string& path) { - FILE* flagfile = posix::FOpen(path.c_str(), "r"); - if (!flagfile) { - GTEST_LOG_(FATAL) << "Unable to open file \"" << GTEST_FLAG(flagfile) - << "\""; - } - std::string contents(ReadEntireFile(flagfile)); - posix::FClose(flagfile); - std::vector lines; - SplitString(contents, '\n', &lines); - for (size_t i = 0; i < lines.size(); ++i) { - if (lines[i].empty()) - continue; - if (!ParseGoogleTestFlag(lines[i].c_str())) - g_help_flag = true; - } -} -#endif // GTEST_USE_OWN_FLAGFILE_FLAG_ - -// Parses the command line for Google Test flags, without initializing -// other parts of Google Test. The type parameter CharType can be -// instantiated to either char or wchar_t. -template -void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) { - for (int i = 1; i < *argc; i++) { - const std::string arg_string = StreamableToString(argv[i]); - const char* const arg = arg_string.c_str(); - - using internal::ParseBoolFlag; - using internal::ParseInt32Flag; - using internal::ParseStringFlag; - - bool remove_flag = false; - if (ParseGoogleTestFlag(arg)) { - remove_flag = true; -#if GTEST_USE_OWN_FLAGFILE_FLAG_ - } else if (ParseStringFlag(arg, kFlagfileFlag, >EST_FLAG(flagfile))) { - LoadFlagsFromFile(GTEST_FLAG(flagfile)); - remove_flag = true; -#endif // GTEST_USE_OWN_FLAGFILE_FLAG_ - } else if (arg_string == "--help" || arg_string == "-h" || - arg_string == "-?" || arg_string == "/?" || - HasGoogleTestFlagPrefix(arg)) { - // Both help flag and unrecognized Google Test flags (excluding - // internal ones) trigger help display. - g_help_flag = true; - } - - if (remove_flag) { - // Shift the remainder of the argv list left by one. Note - // that argv has (*argc + 1) elements, the last one always being - // NULL. The following loop moves the trailing NULL element as - // well. - for (int j = i; j != *argc; j++) { - argv[j] = argv[j + 1]; - } - - // Decrements the argument count. - (*argc)--; - - // We also need to decrement the iterator as we just removed - // an element. - i--; - } - } - - if (g_help_flag) { - // We print the help here instead of in RUN_ALL_TESTS(), as the - // latter may not be called at all if the user is using Google - // Test with another testing framework. - PrintColorEncoded(kColorEncodedHelpMessage); - } -} - -// Parses the command line for Google Test flags, without initializing -// other parts of Google Test. -void ParseGoogleTestFlagsOnly(int* argc, char** argv) { - ParseGoogleTestFlagsOnlyImpl(argc, argv); - - // Fix the value of *_NSGetArgc() on macOS, but if and only if - // *_NSGetArgv() == argv - // Only applicable to char** version of argv -#if GTEST_OS_MAC -#ifndef GTEST_OS_IOS - if (*_NSGetArgv() == argv) { - *_NSGetArgc() = *argc; - } -#endif -#endif -} -void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) { - ParseGoogleTestFlagsOnlyImpl(argc, argv); -} - -// The internal implementation of InitGoogleTest(). -// -// The type parameter CharType can be instantiated to either char or -// wchar_t. -template -void InitGoogleTestImpl(int* argc, CharType** argv) { - // We don't want to run the initialization code twice. - if (GTestIsInitialized()) return; - - if (*argc <= 0) return; - - g_argvs.clear(); - for (int i = 0; i != *argc; i++) { - g_argvs.push_back(StreamableToString(argv[i])); - } - -#if GTEST_HAS_ABSL - absl::InitializeSymbolizer(g_argvs[0].c_str()); -#endif // GTEST_HAS_ABSL - - ParseGoogleTestFlagsOnly(argc, argv); - GetUnitTestImpl()->PostFlagParsingInit(); -} - -} // namespace internal - -// Initializes Google Test. This must be called before calling -// RUN_ALL_TESTS(). In particular, it parses a command line for the -// flags that Google Test recognizes. Whenever a Google Test flag is -// seen, it is removed from argv, and *argc is decremented. -// -// No value is returned. Instead, the Google Test flag variables are -// updated. -// -// Calling the function for the second time has no user-visible effect. -void InitGoogleTest(int* argc, char** argv) { -#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(argc, argv); -#else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - internal::InitGoogleTestImpl(argc, argv); -#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) -} - -// This overloaded version can be used in Windows programs compiled in -// UNICODE mode. -void InitGoogleTest(int* argc, wchar_t** argv) { -#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(argc, argv); -#else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - internal::InitGoogleTestImpl(argc, argv); -#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) -} - -// This overloaded version can be used on Arduino/embedded platforms where -// there is no argc/argv. -void InitGoogleTest() { - // Since Arduino doesn't have a command line, fake out the argc/argv arguments - int argc = 1; - const auto arg0 = "dummy"; - char* argv0 = const_cast(arg0); - char** argv = &argv0; - -#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(&argc, argv); -#else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - internal::InitGoogleTestImpl(&argc, argv); -#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) -} - -std::string TempDir() { -#if defined(GTEST_CUSTOM_TEMPDIR_FUNCTION_) - return GTEST_CUSTOM_TEMPDIR_FUNCTION_(); -#elif GTEST_OS_WINDOWS_MOBILE - return "\\temp\\"; -#elif GTEST_OS_WINDOWS - const char* temp_dir = internal::posix::GetEnv("TEMP"); - if (temp_dir == nullptr || temp_dir[0] == '\0') { - return "\\temp\\"; - } else if (temp_dir[strlen(temp_dir) - 1] == '\\') { - return temp_dir; - } else { - return std::string(temp_dir) + "\\"; - } -#elif GTEST_OS_LINUX_ANDROID - const char* temp_dir = internal::posix::GetEnv("TEST_TMPDIR"); - if (temp_dir == nullptr || temp_dir[0] == '\0') { - return "/data/local/tmp/"; - } else { - return temp_dir; - } -#elif GTEST_OS_LINUX - const char* temp_dir = internal::posix::GetEnv("TEST_TMPDIR"); - if (temp_dir == nullptr || temp_dir[0] == '\0') { - return "/tmp/"; - } else { - return temp_dir; - } -#else - return "/tmp/"; -#endif // GTEST_OS_WINDOWS_MOBILE -} - -// Class ScopedTrace - -// Pushes the given source file location and message onto a per-thread -// trace stack maintained by Google Test. -void ScopedTrace::PushTrace(const char* file, int line, std::string message) { - internal::TraceInfo trace; - trace.file = file; - trace.line = line; - trace.message.swap(message); - - UnitTest::GetInstance()->PushGTestTrace(trace); -} - -// Pops the info pushed by the c'tor. -ScopedTrace::~ScopedTrace() - GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) { - UnitTest::GetInstance()->PopGTestTrace(); -} - -} // namespace testing -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// This file implements death tests. - - -#include -#include - - -#if GTEST_HAS_DEATH_TEST - -# if GTEST_OS_MAC -# include -# endif // GTEST_OS_MAC - -# include -# include -# include - -# if GTEST_OS_LINUX -# include -# endif // GTEST_OS_LINUX - -# include - -# if GTEST_OS_WINDOWS -# include -# else -# include -# include -# endif // GTEST_OS_WINDOWS - -# if GTEST_OS_QNX -# include -# endif // GTEST_OS_QNX - -# if GTEST_OS_FUCHSIA -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# endif // GTEST_OS_FUCHSIA - -#endif // GTEST_HAS_DEATH_TEST - - -namespace testing { - -// Constants. - -// The default death test style. -// -// This is defined in internal/gtest-port.h as "fast", but can be overridden by -// a definition in internal/custom/gtest-port.h. The recommended value, which is -// used internally at Google, is "threadsafe". -static const char kDefaultDeathTestStyle[] = GTEST_DEFAULT_DEATH_TEST_STYLE; - -GTEST_DEFINE_string_( - death_test_style, - internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle), - "Indicates how to run a death test in a forked child process: " - "\"threadsafe\" (child process re-executes the test binary " - "from the beginning, running only the specific death test) or " - "\"fast\" (child process runs the death test immediately " - "after forking)."); - -GTEST_DEFINE_bool_( - death_test_use_fork, - internal::BoolFromGTestEnv("death_test_use_fork", false), - "Instructs to use fork()/_exit() instead of clone() in death tests. " - "Ignored and always uses fork() on POSIX systems where clone() is not " - "implemented. Useful when running under valgrind or similar tools if " - "those do not support clone(). Valgrind 3.3.1 will just fail if " - "it sees an unsupported combination of clone() flags. " - "It is not recommended to use this flag w/o valgrind though it will " - "work in 99% of the cases. Once valgrind is fixed, this flag will " - "most likely be removed."); - -namespace internal { -GTEST_DEFINE_string_( - internal_run_death_test, "", - "Indicates the file, line number, temporal index of " - "the single death test to run, and a file descriptor to " - "which a success code may be sent, all separated by " - "the '|' characters. This flag is specified if and only if the " - "current process is a sub-process launched for running a thread-safe " - "death test. FOR INTERNAL USE ONLY."); -} // namespace internal - -#if GTEST_HAS_DEATH_TEST - -namespace internal { - -// Valid only for fast death tests. Indicates the code is running in the -// child process of a fast style death test. -# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA -static bool g_in_fast_death_test_child = false; -# endif - -// Returns a Boolean value indicating whether the caller is currently -// executing in the context of the death test child process. Tools such as -// Valgrind heap checkers may need this to modify their behavior in death -// tests. IMPORTANT: This is an internal utility. Using it may break the -// implementation of death tests. User code MUST NOT use it. -bool InDeathTestChild() { -# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA - - // On Windows and Fuchsia, death tests are thread-safe regardless of the value - // of the death_test_style flag. - return !GTEST_FLAG(internal_run_death_test).empty(); - -# else - - if (GTEST_FLAG(death_test_style) == "threadsafe") - return !GTEST_FLAG(internal_run_death_test).empty(); - else - return g_in_fast_death_test_child; -#endif -} - -} // namespace internal - -// ExitedWithCode constructor. -ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) { -} - -// ExitedWithCode function-call operator. -bool ExitedWithCode::operator()(int exit_status) const { -# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA - - return exit_status == exit_code_; - -# else - - return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_; - -# endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA -} - -# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA -// KilledBySignal constructor. -KilledBySignal::KilledBySignal(int signum) : signum_(signum) { -} - -// KilledBySignal function-call operator. -bool KilledBySignal::operator()(int exit_status) const { -# if defined(GTEST_KILLED_BY_SIGNAL_OVERRIDE_) - { - bool result; - if (GTEST_KILLED_BY_SIGNAL_OVERRIDE_(signum_, exit_status, &result)) { - return result; - } - } -# endif // defined(GTEST_KILLED_BY_SIGNAL_OVERRIDE_) - return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_; -} -# endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA - -namespace internal { - -// Utilities needed for death tests. - -// Generates a textual description of a given exit code, in the format -// specified by wait(2). -static std::string ExitSummary(int exit_code) { - Message m; - -# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA - - m << "Exited with exit status " << exit_code; - -# else - - if (WIFEXITED(exit_code)) { - m << "Exited with exit status " << WEXITSTATUS(exit_code); - } else if (WIFSIGNALED(exit_code)) { - m << "Terminated by signal " << WTERMSIG(exit_code); - } -# ifdef WCOREDUMP - if (WCOREDUMP(exit_code)) { - m << " (core dumped)"; - } -# endif -# endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA - - return m.GetString(); -} - -// Returns true if exit_status describes a process that was terminated -// by a signal, or exited normally with a nonzero exit code. -bool ExitedUnsuccessfully(int exit_status) { - return !ExitedWithCode(0)(exit_status); -} - -# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA -// Generates a textual failure message when a death test finds more than -// one thread running, or cannot determine the number of threads, prior -// to executing the given statement. It is the responsibility of the -// caller not to pass a thread_count of 1. -static std::string DeathTestThreadWarning(size_t thread_count) { - Message msg; - msg << "Death tests use fork(), which is unsafe particularly" - << " in a threaded context. For this test, " << GTEST_NAME_ << " "; - if (thread_count == 0) { - msg << "couldn't detect the number of threads."; - } else { - msg << "detected " << thread_count << " threads."; - } - msg << " See " - "https://github.com/google/googletest/blob/master/docs/" - "advanced.md#death-tests-and-threads" - << " for more explanation and suggested solutions, especially if" - << " this is the last message you see before your test times out."; - return msg.GetString(); -} -# endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA - -// Flag characters for reporting a death test that did not die. -static const char kDeathTestLived = 'L'; -static const char kDeathTestReturned = 'R'; -static const char kDeathTestThrew = 'T'; -static const char kDeathTestInternalError = 'I'; - -#if GTEST_OS_FUCHSIA - -// File descriptor used for the pipe in the child process. -static const int kFuchsiaReadPipeFd = 3; - -#endif - -// An enumeration describing all of the possible ways that a death test can -// conclude. DIED means that the process died while executing the test -// code; LIVED means that process lived beyond the end of the test code; -// RETURNED means that the test statement attempted to execute a return -// statement, which is not allowed; THREW means that the test statement -// returned control by throwing an exception. IN_PROGRESS means the test -// has not yet concluded. -enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW }; - -// Routine for aborting the program which is safe to call from an -// exec-style death test child process, in which case the error -// message is propagated back to the parent process. Otherwise, the -// message is simply printed to stderr. In either case, the program -// then exits with status 1. -static void DeathTestAbort(const std::string& message) { - // On a POSIX system, this function may be called from a threadsafe-style - // death test child process, which operates on a very small stack. Use - // the heap for any additional non-minuscule memory requirements. - const InternalRunDeathTestFlag* const flag = - GetUnitTestImpl()->internal_run_death_test_flag(); - if (flag != nullptr) { - FILE* parent = posix::FDOpen(flag->write_fd(), "w"); - fputc(kDeathTestInternalError, parent); - fprintf(parent, "%s", message.c_str()); - fflush(parent); - _exit(1); - } else { - fprintf(stderr, "%s", message.c_str()); - fflush(stderr); - posix::Abort(); - } -} - -// A replacement for CHECK that calls DeathTestAbort if the assertion -// fails. -# define GTEST_DEATH_TEST_CHECK_(expression) \ - do { \ - if (!::testing::internal::IsTrue(expression)) { \ - DeathTestAbort( \ - ::std::string("CHECK failed: File ") + __FILE__ + ", line " \ - + ::testing::internal::StreamableToString(__LINE__) + ": " \ - + #expression); \ - } \ - } while (::testing::internal::AlwaysFalse()) - -// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for -// evaluating any system call that fulfills two conditions: it must return -// -1 on failure, and set errno to EINTR when it is interrupted and -// should be tried again. The macro expands to a loop that repeatedly -// evaluates the expression as long as it evaluates to -1 and sets -// errno to EINTR. If the expression evaluates to -1 but errno is -// something other than EINTR, DeathTestAbort is called. -# define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \ - do { \ - int gtest_retval; \ - do { \ - gtest_retval = (expression); \ - } while (gtest_retval == -1 && errno == EINTR); \ - if (gtest_retval == -1) { \ - DeathTestAbort( \ - ::std::string("CHECK failed: File ") + __FILE__ + ", line " \ - + ::testing::internal::StreamableToString(__LINE__) + ": " \ - + #expression + " != -1"); \ - } \ - } while (::testing::internal::AlwaysFalse()) - -// Returns the message describing the last system error in errno. -std::string GetLastErrnoDescription() { - return errno == 0 ? "" : posix::StrError(errno); -} - -// This is called from a death test parent process to read a failure -// message from the death test child process and log it with the FATAL -// severity. On Windows, the message is read from a pipe handle. On other -// platforms, it is read from a file descriptor. -static void FailFromInternalError(int fd) { - Message error; - char buffer[256]; - int num_read; - - do { - while ((num_read = posix::Read(fd, buffer, 255)) > 0) { - buffer[num_read] = '\0'; - error << buffer; - } - } while (num_read == -1 && errno == EINTR); - - if (num_read == 0) { - GTEST_LOG_(FATAL) << error.GetString(); - } else { - const int last_error = errno; - GTEST_LOG_(FATAL) << "Error while reading death test internal: " - << GetLastErrnoDescription() << " [" << last_error << "]"; - } -} - -// Death test constructor. Increments the running death test count -// for the current test. -DeathTest::DeathTest() { - TestInfo* const info = GetUnitTestImpl()->current_test_info(); - if (info == nullptr) { - DeathTestAbort("Cannot run a death test outside of a TEST or " - "TEST_F construct"); - } -} - -// Creates and returns a death test by dispatching to the current -// death test factory. -bool DeathTest::Create(const char* statement, - Matcher matcher, const char* file, - int line, DeathTest** test) { - return GetUnitTestImpl()->death_test_factory()->Create( - statement, std::move(matcher), file, line, test); -} - -const char* DeathTest::LastMessage() { - return last_death_test_message_.c_str(); -} - -void DeathTest::set_last_death_test_message(const std::string& message) { - last_death_test_message_ = message; -} - -std::string DeathTest::last_death_test_message_; - -// Provides cross platform implementation for some death functionality. -class DeathTestImpl : public DeathTest { - protected: - DeathTestImpl(const char* a_statement, Matcher matcher) - : statement_(a_statement), - matcher_(std::move(matcher)), - spawned_(false), - status_(-1), - outcome_(IN_PROGRESS), - read_fd_(-1), - write_fd_(-1) {} - - // read_fd_ is expected to be closed and cleared by a derived class. - ~DeathTestImpl() override { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); } - - void Abort(AbortReason reason) override; - bool Passed(bool status_ok) override; - - const char* statement() const { return statement_; } - bool spawned() const { return spawned_; } - void set_spawned(bool is_spawned) { spawned_ = is_spawned; } - int status() const { return status_; } - void set_status(int a_status) { status_ = a_status; } - DeathTestOutcome outcome() const { return outcome_; } - void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; } - int read_fd() const { return read_fd_; } - void set_read_fd(int fd) { read_fd_ = fd; } - int write_fd() const { return write_fd_; } - void set_write_fd(int fd) { write_fd_ = fd; } - - // Called in the parent process only. Reads the result code of the death - // test child process via a pipe, interprets it to set the outcome_ - // member, and closes read_fd_. Outputs diagnostics and terminates in - // case of unexpected codes. - void ReadAndInterpretStatusByte(); - - // Returns stderr output from the child process. - virtual std::string GetErrorLogs(); - - private: - // The textual content of the code this object is testing. This class - // doesn't own this string and should not attempt to delete it. - const char* const statement_; - // A matcher that's expected to match the stderr output by the child process. - Matcher matcher_; - // True if the death test child process has been successfully spawned. - bool spawned_; - // The exit status of the child process. - int status_; - // How the death test concluded. - DeathTestOutcome outcome_; - // Descriptor to the read end of the pipe to the child process. It is - // always -1 in the child process. The child keeps its write end of the - // pipe in write_fd_. - int read_fd_; - // Descriptor to the child's write end of the pipe to the parent process. - // It is always -1 in the parent process. The parent keeps its end of the - // pipe in read_fd_. - int write_fd_; -}; - -// Called in the parent process only. Reads the result code of the death -// test child process via a pipe, interprets it to set the outcome_ -// member, and closes read_fd_. Outputs diagnostics and terminates in -// case of unexpected codes. -void DeathTestImpl::ReadAndInterpretStatusByte() { - char flag; - int bytes_read; - - // The read() here blocks until data is available (signifying the - // failure of the death test) or until the pipe is closed (signifying - // its success), so it's okay to call this in the parent before - // the child process has exited. - do { - bytes_read = posix::Read(read_fd(), &flag, 1); - } while (bytes_read == -1 && errno == EINTR); - - if (bytes_read == 0) { - set_outcome(DIED); - } else if (bytes_read == 1) { - switch (flag) { - case kDeathTestReturned: - set_outcome(RETURNED); - break; - case kDeathTestThrew: - set_outcome(THREW); - break; - case kDeathTestLived: - set_outcome(LIVED); - break; - case kDeathTestInternalError: - FailFromInternalError(read_fd()); // Does not return. - break; - default: - GTEST_LOG_(FATAL) << "Death test child process reported " - << "unexpected status byte (" - << static_cast(flag) << ")"; - } - } else { - GTEST_LOG_(FATAL) << "Read from death test child process failed: " - << GetLastErrnoDescription(); - } - GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd())); - set_read_fd(-1); -} - -std::string DeathTestImpl::GetErrorLogs() { - return GetCapturedStderr(); -} - -// Signals that the death test code which should have exited, didn't. -// Should be called only in a death test child process. -// Writes a status byte to the child's status file descriptor, then -// calls _exit(1). -void DeathTestImpl::Abort(AbortReason reason) { - // The parent process considers the death test to be a failure if - // it finds any data in our pipe. So, here we write a single flag byte - // to the pipe, then exit. - const char status_ch = - reason == TEST_DID_NOT_DIE ? kDeathTestLived : - reason == TEST_THREW_EXCEPTION ? kDeathTestThrew : kDeathTestReturned; - - GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1)); - // We are leaking the descriptor here because on some platforms (i.e., - // when built as Windows DLL), destructors of global objects will still - // run after calling _exit(). On such systems, write_fd_ will be - // indirectly closed from the destructor of UnitTestImpl, causing double - // close if it is also closed here. On debug configurations, double close - // may assert. As there are no in-process buffers to flush here, we are - // relying on the OS to close the descriptor after the process terminates - // when the destructors are not run. - _exit(1); // Exits w/o any normal exit hooks (we were supposed to crash) -} - -// Returns an indented copy of stderr output for a death test. -// This makes distinguishing death test output lines from regular log lines -// much easier. -static ::std::string FormatDeathTestOutput(const ::std::string& output) { - ::std::string ret; - for (size_t at = 0; ; ) { - const size_t line_end = output.find('\n', at); - ret += "[ DEATH ] "; - if (line_end == ::std::string::npos) { - ret += output.substr(at); - break; - } - ret += output.substr(at, line_end + 1 - at); - at = line_end + 1; - } - return ret; -} - -// Assesses the success or failure of a death test, using both private -// members which have previously been set, and one argument: -// -// Private data members: -// outcome: An enumeration describing how the death test -// concluded: DIED, LIVED, THREW, or RETURNED. The death test -// fails in the latter three cases. -// status: The exit status of the child process. On *nix, it is in the -// in the format specified by wait(2). On Windows, this is the -// value supplied to the ExitProcess() API or a numeric code -// of the exception that terminated the program. -// matcher_: A matcher that's expected to match the stderr output by the child -// process. -// -// Argument: -// status_ok: true if exit_status is acceptable in the context of -// this particular death test, which fails if it is false -// -// Returns true if and only if all of the above conditions are met. Otherwise, -// the first failing condition, in the order given above, is the one that is -// reported. Also sets the last death test message string. -bool DeathTestImpl::Passed(bool status_ok) { - if (!spawned()) - return false; - - const std::string error_message = GetErrorLogs(); - - bool success = false; - Message buffer; - - buffer << "Death test: " << statement() << "\n"; - switch (outcome()) { - case LIVED: - buffer << " Result: failed to die.\n" - << " Error msg:\n" << FormatDeathTestOutput(error_message); - break; - case THREW: - buffer << " Result: threw an exception.\n" - << " Error msg:\n" << FormatDeathTestOutput(error_message); - break; - case RETURNED: - buffer << " Result: illegal return in test statement.\n" - << " Error msg:\n" << FormatDeathTestOutput(error_message); - break; - case DIED: - if (status_ok) { - if (matcher_.Matches(error_message)) { - success = true; - } else { - std::ostringstream stream; - matcher_.DescribeTo(&stream); - buffer << " Result: died but not with expected error.\n" - << " Expected: " << stream.str() << "\n" - << "Actual msg:\n" - << FormatDeathTestOutput(error_message); - } - } else { - buffer << " Result: died but not with expected exit code:\n" - << " " << ExitSummary(status()) << "\n" - << "Actual msg:\n" << FormatDeathTestOutput(error_message); - } - break; - case IN_PROGRESS: - default: - GTEST_LOG_(FATAL) - << "DeathTest::Passed somehow called before conclusion of test"; - } - - DeathTest::set_last_death_test_message(buffer.GetString()); - return success; -} - -# if GTEST_OS_WINDOWS -// WindowsDeathTest implements death tests on Windows. Due to the -// specifics of starting new processes on Windows, death tests there are -// always threadsafe, and Google Test considers the -// --gtest_death_test_style=fast setting to be equivalent to -// --gtest_death_test_style=threadsafe there. -// -// A few implementation notes: Like the Linux version, the Windows -// implementation uses pipes for child-to-parent communication. But due to -// the specifics of pipes on Windows, some extra steps are required: -// -// 1. The parent creates a communication pipe and stores handles to both -// ends of it. -// 2. The parent starts the child and provides it with the information -// necessary to acquire the handle to the write end of the pipe. -// 3. The child acquires the write end of the pipe and signals the parent -// using a Windows event. -// 4. Now the parent can release the write end of the pipe on its side. If -// this is done before step 3, the object's reference count goes down to -// 0 and it is destroyed, preventing the child from acquiring it. The -// parent now has to release it, or read operations on the read end of -// the pipe will not return when the child terminates. -// 5. The parent reads child's output through the pipe (outcome code and -// any possible error messages) from the pipe, and its stderr and then -// determines whether to fail the test. -// -// Note: to distinguish Win32 API calls from the local method and function -// calls, the former are explicitly resolved in the global namespace. -// -class WindowsDeathTest : public DeathTestImpl { - public: - WindowsDeathTest(const char* a_statement, Matcher matcher, - const char* file, int line) - : DeathTestImpl(a_statement, std::move(matcher)), - file_(file), - line_(line) {} - - // All of these virtual functions are inherited from DeathTest. - virtual int Wait(); - virtual TestRole AssumeRole(); - - private: - // The name of the file in which the death test is located. - const char* const file_; - // The line number on which the death test is located. - const int line_; - // Handle to the write end of the pipe to the child process. - AutoHandle write_handle_; - // Child process handle. - AutoHandle child_handle_; - // Event the child process uses to signal the parent that it has - // acquired the handle to the write end of the pipe. After seeing this - // event the parent can release its own handles to make sure its - // ReadFile() calls return when the child terminates. - AutoHandle event_handle_; -}; - -// Waits for the child in a death test to exit, returning its exit -// status, or 0 if no child process exists. As a side effect, sets the -// outcome data member. -int WindowsDeathTest::Wait() { - if (!spawned()) - return 0; - - // Wait until the child either signals that it has acquired the write end - // of the pipe or it dies. - const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() }; - switch (::WaitForMultipleObjects(2, - wait_handles, - FALSE, // Waits for any of the handles. - INFINITE)) { - case WAIT_OBJECT_0: - case WAIT_OBJECT_0 + 1: - break; - default: - GTEST_DEATH_TEST_CHECK_(false); // Should not get here. - } - - // The child has acquired the write end of the pipe or exited. - // We release the handle on our side and continue. - write_handle_.Reset(); - event_handle_.Reset(); - - ReadAndInterpretStatusByte(); - - // Waits for the child process to exit if it haven't already. This - // returns immediately if the child has already exited, regardless of - // whether previous calls to WaitForMultipleObjects synchronized on this - // handle or not. - GTEST_DEATH_TEST_CHECK_( - WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(), - INFINITE)); - DWORD status_code; - GTEST_DEATH_TEST_CHECK_( - ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE); - child_handle_.Reset(); - set_status(static_cast(status_code)); - return status(); -} - -// The AssumeRole process for a Windows death test. It creates a child -// process with the same executable as the current process to run the -// death test. The child process is given the --gtest_filter and -// --gtest_internal_run_death_test flags such that it knows to run the -// current death test only. -DeathTest::TestRole WindowsDeathTest::AssumeRole() { - const UnitTestImpl* const impl = GetUnitTestImpl(); - const InternalRunDeathTestFlag* const flag = - impl->internal_run_death_test_flag(); - const TestInfo* const info = impl->current_test_info(); - const int death_test_index = info->result()->death_test_count(); - - if (flag != nullptr) { - // ParseInternalRunDeathTestFlag() has performed all the necessary - // processing. - set_write_fd(flag->write_fd()); - return EXECUTE_TEST; - } - - // WindowsDeathTest uses an anonymous pipe to communicate results of - // a death test. - SECURITY_ATTRIBUTES handles_are_inheritable = {sizeof(SECURITY_ATTRIBUTES), - nullptr, TRUE}; - HANDLE read_handle, write_handle; - GTEST_DEATH_TEST_CHECK_( - ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable, - 0) // Default buffer size. - != FALSE); - set_read_fd(::_open_osfhandle(reinterpret_cast(read_handle), - O_RDONLY)); - write_handle_.Reset(write_handle); - event_handle_.Reset(::CreateEvent( - &handles_are_inheritable, - TRUE, // The event will automatically reset to non-signaled state. - FALSE, // The initial state is non-signalled. - nullptr)); // The even is unnamed. - GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != nullptr); - const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ + - kFilterFlag + "=" + info->test_suite_name() + - "." + info->name(); - const std::string internal_flag = - std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + - "=" + file_ + "|" + StreamableToString(line_) + "|" + - StreamableToString(death_test_index) + "|" + - StreamableToString(static_cast(::GetCurrentProcessId())) + - // size_t has the same width as pointers on both 32-bit and 64-bit - // Windows platforms. - // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx. - "|" + StreamableToString(reinterpret_cast(write_handle)) + - "|" + StreamableToString(reinterpret_cast(event_handle_.Get())); - - char executable_path[_MAX_PATH + 1]; // NOLINT - GTEST_DEATH_TEST_CHECK_(_MAX_PATH + 1 != ::GetModuleFileNameA(nullptr, - executable_path, - _MAX_PATH)); - - std::string command_line = - std::string(::GetCommandLineA()) + " " + filter_flag + " \"" + - internal_flag + "\""; - - DeathTest::set_last_death_test_message(""); - - CaptureStderr(); - // Flush the log buffers since the log streams are shared with the child. - FlushInfoLog(); - - // The child process will share the standard handles with the parent. - STARTUPINFOA startup_info; - memset(&startup_info, 0, sizeof(STARTUPINFO)); - startup_info.dwFlags = STARTF_USESTDHANDLES; - startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE); - startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE); - startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE); - - PROCESS_INFORMATION process_info; - GTEST_DEATH_TEST_CHECK_( - ::CreateProcessA( - executable_path, const_cast(command_line.c_str()), - nullptr, // Retuned process handle is not inheritable. - nullptr, // Retuned thread handle is not inheritable. - TRUE, // Child inherits all inheritable handles (for write_handle_). - 0x0, // Default creation flags. - nullptr, // Inherit the parent's environment. - UnitTest::GetInstance()->original_working_dir(), &startup_info, - &process_info) != FALSE); - child_handle_.Reset(process_info.hProcess); - ::CloseHandle(process_info.hThread); - set_spawned(true); - return OVERSEE_TEST; -} - -# elif GTEST_OS_FUCHSIA - -class FuchsiaDeathTest : public DeathTestImpl { - public: - FuchsiaDeathTest(const char* a_statement, Matcher matcher, - const char* file, int line) - : DeathTestImpl(a_statement, std::move(matcher)), - file_(file), - line_(line) {} - - // All of these virtual functions are inherited from DeathTest. - int Wait() override; - TestRole AssumeRole() override; - std::string GetErrorLogs() override; - - private: - // The name of the file in which the death test is located. - const char* const file_; - // The line number on which the death test is located. - const int line_; - // The stderr data captured by the child process. - std::string captured_stderr_; - - zx::process child_process_; - zx::channel exception_channel_; - zx::socket stderr_socket_; -}; - -// Utility class for accumulating command-line arguments. -class Arguments { - public: - Arguments() { args_.push_back(nullptr); } - - ~Arguments() { - for (std::vector::iterator i = args_.begin(); i != args_.end(); - ++i) { - free(*i); - } - } - void AddArgument(const char* argument) { - args_.insert(args_.end() - 1, posix::StrDup(argument)); - } - - template - void AddArguments(const ::std::vector& arguments) { - for (typename ::std::vector::const_iterator i = arguments.begin(); - i != arguments.end(); - ++i) { - args_.insert(args_.end() - 1, posix::StrDup(i->c_str())); - } - } - char* const* Argv() { - return &args_[0]; - } - - int size() { - return static_cast(args_.size()) - 1; - } - - private: - std::vector args_; -}; - -// Waits for the child in a death test to exit, returning its exit -// status, or 0 if no child process exists. As a side effect, sets the -// outcome data member. -int FuchsiaDeathTest::Wait() { - const int kProcessKey = 0; - const int kSocketKey = 1; - const int kExceptionKey = 2; - - if (!spawned()) - return 0; - - // Create a port to wait for socket/task/exception events. - zx_status_t status_zx; - zx::port port; - status_zx = zx::port::create(0, &port); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - // Register to wait for the child process to terminate. - status_zx = child_process_.wait_async( - port, kProcessKey, ZX_PROCESS_TERMINATED, 0); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - // Register to wait for the socket to be readable or closed. - status_zx = stderr_socket_.wait_async( - port, kSocketKey, ZX_SOCKET_READABLE | ZX_SOCKET_PEER_CLOSED, 0); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - // Register to wait for an exception. - status_zx = exception_channel_.wait_async( - port, kExceptionKey, ZX_CHANNEL_READABLE, 0); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - bool process_terminated = false; - bool socket_closed = false; - do { - zx_port_packet_t packet = {}; - status_zx = port.wait(zx::time::infinite(), &packet); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - if (packet.key == kExceptionKey) { - // Process encountered an exception. Kill it directly rather than - // letting other handlers process the event. We will get a kProcessKey - // event when the process actually terminates. - status_zx = child_process_.kill(); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - } else if (packet.key == kProcessKey) { - // Process terminated. - GTEST_DEATH_TEST_CHECK_(ZX_PKT_IS_SIGNAL_ONE(packet.type)); - GTEST_DEATH_TEST_CHECK_(packet.signal.observed & ZX_PROCESS_TERMINATED); - process_terminated = true; - } else if (packet.key == kSocketKey) { - GTEST_DEATH_TEST_CHECK_(ZX_PKT_IS_SIGNAL_ONE(packet.type)); - if (packet.signal.observed & ZX_SOCKET_READABLE) { - // Read data from the socket. - constexpr size_t kBufferSize = 1024; - do { - size_t old_length = captured_stderr_.length(); - size_t bytes_read = 0; - captured_stderr_.resize(old_length + kBufferSize); - status_zx = stderr_socket_.read( - 0, &captured_stderr_.front() + old_length, kBufferSize, - &bytes_read); - captured_stderr_.resize(old_length + bytes_read); - } while (status_zx == ZX_OK); - if (status_zx == ZX_ERR_PEER_CLOSED) { - socket_closed = true; - } else { - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_ERR_SHOULD_WAIT); - status_zx = stderr_socket_.wait_async( - port, kSocketKey, ZX_SOCKET_READABLE | ZX_SOCKET_PEER_CLOSED, 0); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - } - } else { - GTEST_DEATH_TEST_CHECK_(packet.signal.observed & ZX_SOCKET_PEER_CLOSED); - socket_closed = true; - } - } - } while (!process_terminated && !socket_closed); - - ReadAndInterpretStatusByte(); - - zx_info_process_t buffer; - status_zx = child_process_.get_info(ZX_INFO_PROCESS, &buffer, sizeof(buffer), - nullptr, nullptr); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - GTEST_DEATH_TEST_CHECK_(buffer.flags & ZX_INFO_PROCESS_FLAG_EXITED); - set_status(static_cast(buffer.return_code)); - return status(); -} - -// The AssumeRole process for a Fuchsia death test. It creates a child -// process with the same executable as the current process to run the -// death test. The child process is given the --gtest_filter and -// --gtest_internal_run_death_test flags such that it knows to run the -// current death test only. -DeathTest::TestRole FuchsiaDeathTest::AssumeRole() { - const UnitTestImpl* const impl = GetUnitTestImpl(); - const InternalRunDeathTestFlag* const flag = - impl->internal_run_death_test_flag(); - const TestInfo* const info = impl->current_test_info(); - const int death_test_index = info->result()->death_test_count(); - - if (flag != nullptr) { - // ParseInternalRunDeathTestFlag() has performed all the necessary - // processing. - set_write_fd(kFuchsiaReadPipeFd); - return EXECUTE_TEST; - } - - // Flush the log buffers since the log streams are shared with the child. - FlushInfoLog(); - - // Build the child process command line. - const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ + - kFilterFlag + "=" + info->test_suite_name() + - "." + info->name(); - const std::string internal_flag = - std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "=" - + file_ + "|" - + StreamableToString(line_) + "|" - + StreamableToString(death_test_index); - Arguments args; - args.AddArguments(GetInjectableArgvs()); - args.AddArgument(filter_flag.c_str()); - args.AddArgument(internal_flag.c_str()); - - // Build the pipe for communication with the child. - zx_status_t status; - zx_handle_t child_pipe_handle; - int child_pipe_fd; - status = fdio_pipe_half(&child_pipe_fd, &child_pipe_handle); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - set_read_fd(child_pipe_fd); - - // Set the pipe handle for the child. - fdio_spawn_action_t spawn_actions[2] = {}; - fdio_spawn_action_t* add_handle_action = &spawn_actions[0]; - add_handle_action->action = FDIO_SPAWN_ACTION_ADD_HANDLE; - add_handle_action->h.id = PA_HND(PA_FD, kFuchsiaReadPipeFd); - add_handle_action->h.handle = child_pipe_handle; - - // Create a socket pair will be used to receive the child process' stderr. - zx::socket stderr_producer_socket; - status = - zx::socket::create(0, &stderr_producer_socket, &stderr_socket_); - GTEST_DEATH_TEST_CHECK_(status >= 0); - int stderr_producer_fd = -1; - status = - fdio_fd_create(stderr_producer_socket.release(), &stderr_producer_fd); - GTEST_DEATH_TEST_CHECK_(status >= 0); - - // Make the stderr socket nonblocking. - GTEST_DEATH_TEST_CHECK_(fcntl(stderr_producer_fd, F_SETFL, 0) == 0); - - fdio_spawn_action_t* add_stderr_action = &spawn_actions[1]; - add_stderr_action->action = FDIO_SPAWN_ACTION_CLONE_FD; - add_stderr_action->fd.local_fd = stderr_producer_fd; - add_stderr_action->fd.target_fd = STDERR_FILENO; - - // Create a child job. - zx_handle_t child_job = ZX_HANDLE_INVALID; - status = zx_job_create(zx_job_default(), 0, & child_job); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - zx_policy_basic_t policy; - policy.condition = ZX_POL_NEW_ANY; - policy.policy = ZX_POL_ACTION_ALLOW; - status = zx_job_set_policy( - child_job, ZX_JOB_POL_RELATIVE, ZX_JOB_POL_BASIC, &policy, 1); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - - // Create an exception channel attached to the |child_job|, to allow - // us to suppress the system default exception handler from firing. - status = - zx_task_create_exception_channel( - child_job, 0, exception_channel_.reset_and_get_address()); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - - // Spawn the child process. - status = fdio_spawn_etc( - child_job, FDIO_SPAWN_CLONE_ALL, args.Argv()[0], args.Argv(), nullptr, - 2, spawn_actions, child_process_.reset_and_get_address(), nullptr); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - - set_spawned(true); - return OVERSEE_TEST; -} - -std::string FuchsiaDeathTest::GetErrorLogs() { - return captured_stderr_; -} - -#else // We are neither on Windows, nor on Fuchsia. - -// ForkingDeathTest provides implementations for most of the abstract -// methods of the DeathTest interface. Only the AssumeRole method is -// left undefined. -class ForkingDeathTest : public DeathTestImpl { - public: - ForkingDeathTest(const char* statement, Matcher matcher); - - // All of these virtual functions are inherited from DeathTest. - int Wait() override; - - protected: - void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; } - - private: - // PID of child process during death test; 0 in the child process itself. - pid_t child_pid_; -}; - -// Constructs a ForkingDeathTest. -ForkingDeathTest::ForkingDeathTest(const char* a_statement, - Matcher matcher) - : DeathTestImpl(a_statement, std::move(matcher)), child_pid_(-1) {} - -// Waits for the child in a death test to exit, returning its exit -// status, or 0 if no child process exists. As a side effect, sets the -// outcome data member. -int ForkingDeathTest::Wait() { - if (!spawned()) - return 0; - - ReadAndInterpretStatusByte(); - - int status_value; - GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0)); - set_status(status_value); - return status_value; -} - -// A concrete death test class that forks, then immediately runs the test -// in the child process. -class NoExecDeathTest : public ForkingDeathTest { - public: - NoExecDeathTest(const char* a_statement, Matcher matcher) - : ForkingDeathTest(a_statement, std::move(matcher)) {} - TestRole AssumeRole() override; -}; - -// The AssumeRole process for a fork-and-run death test. It implements a -// straightforward fork, with a simple pipe to transmit the status byte. -DeathTest::TestRole NoExecDeathTest::AssumeRole() { - const size_t thread_count = GetThreadCount(); - if (thread_count != 1) { - GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count); - } - - int pipe_fd[2]; - GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1); - - DeathTest::set_last_death_test_message(""); - CaptureStderr(); - // When we fork the process below, the log file buffers are copied, but the - // file descriptors are shared. We flush all log files here so that closing - // the file descriptors in the child process doesn't throw off the - // synchronization between descriptors and buffers in the parent process. - // This is as close to the fork as possible to avoid a race condition in case - // there are multiple threads running before the death test, and another - // thread writes to the log file. - FlushInfoLog(); - - const pid_t child_pid = fork(); - GTEST_DEATH_TEST_CHECK_(child_pid != -1); - set_child_pid(child_pid); - if (child_pid == 0) { - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0])); - set_write_fd(pipe_fd[1]); - // Redirects all logging to stderr in the child process to prevent - // concurrent writes to the log files. We capture stderr in the parent - // process and append the child process' output to a log. - LogToStderr(); - // Event forwarding to the listeners of event listener API mush be shut - // down in death test subprocesses. - GetUnitTestImpl()->listeners()->SuppressEventForwarding(); - g_in_fast_death_test_child = true; - return EXECUTE_TEST; - } else { - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1])); - set_read_fd(pipe_fd[0]); - set_spawned(true); - return OVERSEE_TEST; - } -} - -// A concrete death test class that forks and re-executes the main -// program from the beginning, with command-line flags set that cause -// only this specific death test to be run. -class ExecDeathTest : public ForkingDeathTest { - public: - ExecDeathTest(const char* a_statement, Matcher matcher, - const char* file, int line) - : ForkingDeathTest(a_statement, std::move(matcher)), - file_(file), - line_(line) {} - TestRole AssumeRole() override; - - private: - static ::std::vector GetArgvsForDeathTestChildProcess() { - ::std::vector args = GetInjectableArgvs(); -# if defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_) - ::std::vector extra_args = - GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_(); - args.insert(args.end(), extra_args.begin(), extra_args.end()); -# endif // defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_) - return args; - } - // The name of the file in which the death test is located. - const char* const file_; - // The line number on which the death test is located. - const int line_; -}; - -// Utility class for accumulating command-line arguments. -class Arguments { - public: - Arguments() { args_.push_back(nullptr); } - - ~Arguments() { - for (std::vector::iterator i = args_.begin(); i != args_.end(); - ++i) { - free(*i); - } - } - void AddArgument(const char* argument) { - args_.insert(args_.end() - 1, posix::StrDup(argument)); - } - - template - void AddArguments(const ::std::vector& arguments) { - for (typename ::std::vector::const_iterator i = arguments.begin(); - i != arguments.end(); - ++i) { - args_.insert(args_.end() - 1, posix::StrDup(i->c_str())); - } - } - char* const* Argv() { - return &args_[0]; - } - - private: - std::vector args_; -}; - -// A struct that encompasses the arguments to the child process of a -// threadsafe-style death test process. -struct ExecDeathTestArgs { - char* const* argv; // Command-line arguments for the child's call to exec - int close_fd; // File descriptor to close; the read end of a pipe -}; - -# if GTEST_OS_QNX -extern "C" char** environ; -# else // GTEST_OS_QNX -// The main function for a threadsafe-style death test child process. -// This function is called in a clone()-ed process and thus must avoid -// any potentially unsafe operations like malloc or libc functions. -static int ExecDeathTestChildMain(void* child_arg) { - ExecDeathTestArgs* const args = static_cast(child_arg); - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd)); - - // We need to execute the test program in the same environment where - // it was originally invoked. Therefore we change to the original - // working directory first. - const char* const original_dir = - UnitTest::GetInstance()->original_working_dir(); - // We can safely call chdir() as it's a direct system call. - if (chdir(original_dir) != 0) { - DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " + - GetLastErrnoDescription()); - return EXIT_FAILURE; - } - - // We can safely call execv() as it's almost a direct system call. We - // cannot use execvp() as it's a libc function and thus potentially - // unsafe. Since execv() doesn't search the PATH, the user must - // invoke the test program via a valid path that contains at least - // one path separator. - execv(args->argv[0], args->argv); - DeathTestAbort(std::string("execv(") + args->argv[0] + ", ...) in " + - original_dir + " failed: " + - GetLastErrnoDescription()); - return EXIT_FAILURE; -} -# endif // GTEST_OS_QNX - -# if GTEST_HAS_CLONE -// Two utility routines that together determine the direction the stack -// grows. -// This could be accomplished more elegantly by a single recursive -// function, but we want to guard against the unlikely possibility of -// a smart compiler optimizing the recursion away. -// -// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining -// StackLowerThanAddress into StackGrowsDown, which then doesn't give -// correct answer. -static void StackLowerThanAddress(const void* ptr, - bool* result) GTEST_NO_INLINE_; -// Make sure sanitizers do not tamper with the stack here. -// Ideally, we want to use `__builtin_frame_address` instead of a local variable -// address with sanitizer disabled, but it does not work when the -// compiler optimizes the stack frame out, which happens on PowerPC targets. -// HWAddressSanitizer add a random tag to the MSB of the local variable address, -// making comparison result unpredictable. -GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -static void StackLowerThanAddress(const void* ptr, bool* result) { - int dummy = 0; - *result = std::less()(&dummy, ptr); -} - -// Make sure AddressSanitizer does not tamper with the stack here. -GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -static bool StackGrowsDown() { - int dummy = 0; - bool result; - StackLowerThanAddress(&dummy, &result); - return result; -} -# endif // GTEST_HAS_CLONE - -// Spawns a child process with the same executable as the current process in -// a thread-safe manner and instructs it to run the death test. The -// implementation uses fork(2) + exec. On systems where clone(2) is -// available, it is used instead, being slightly more thread-safe. On QNX, -// fork supports only single-threaded environments, so this function uses -// spawn(2) there instead. The function dies with an error message if -// anything goes wrong. -static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) { - ExecDeathTestArgs args = { argv, close_fd }; - pid_t child_pid = -1; - -# if GTEST_OS_QNX - // Obtains the current directory and sets it to be closed in the child - // process. - const int cwd_fd = open(".", O_RDONLY); - GTEST_DEATH_TEST_CHECK_(cwd_fd != -1); - GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC)); - // We need to execute the test program in the same environment where - // it was originally invoked. Therefore we change to the original - // working directory first. - const char* const original_dir = - UnitTest::GetInstance()->original_working_dir(); - // We can safely call chdir() as it's a direct system call. - if (chdir(original_dir) != 0) { - DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " + - GetLastErrnoDescription()); - return EXIT_FAILURE; - } - - int fd_flags; - // Set close_fd to be closed after spawn. - GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD)); - GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD, - fd_flags | FD_CLOEXEC)); - struct inheritance inherit = {0}; - // spawn is a system call. - child_pid = spawn(args.argv[0], 0, nullptr, &inherit, args.argv, environ); - // Restores the current working directory. - GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1); - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd)); - -# else // GTEST_OS_QNX -# if GTEST_OS_LINUX - // When a SIGPROF signal is received while fork() or clone() are executing, - // the process may hang. To avoid this, we ignore SIGPROF here and re-enable - // it after the call to fork()/clone() is complete. - struct sigaction saved_sigprof_action; - struct sigaction ignore_sigprof_action; - memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action)); - sigemptyset(&ignore_sigprof_action.sa_mask); - ignore_sigprof_action.sa_handler = SIG_IGN; - GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction( - SIGPROF, &ignore_sigprof_action, &saved_sigprof_action)); -# endif // GTEST_OS_LINUX - -# if GTEST_HAS_CLONE - const bool use_fork = GTEST_FLAG(death_test_use_fork); - - if (!use_fork) { - static const bool stack_grows_down = StackGrowsDown(); - const auto stack_size = static_cast(getpagesize() * 2); - // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead. - void* const stack = mmap(nullptr, stack_size, PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PRIVATE, -1, 0); - GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED); - - // Maximum stack alignment in bytes: For a downward-growing stack, this - // amount is subtracted from size of the stack space to get an address - // that is within the stack space and is aligned on all systems we care - // about. As far as I know there is no ABI with stack alignment greater - // than 64. We assume stack and stack_size already have alignment of - // kMaxStackAlignment. - const size_t kMaxStackAlignment = 64; - void* const stack_top = - static_cast(stack) + - (stack_grows_down ? stack_size - kMaxStackAlignment : 0); - GTEST_DEATH_TEST_CHECK_( - static_cast(stack_size) > kMaxStackAlignment && - reinterpret_cast(stack_top) % kMaxStackAlignment == 0); - - child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args); - - GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1); - } -# else - const bool use_fork = true; -# endif // GTEST_HAS_CLONE - - if (use_fork && (child_pid = fork()) == 0) { - ExecDeathTestChildMain(&args); - _exit(0); - } -# endif // GTEST_OS_QNX -# if GTEST_OS_LINUX - GTEST_DEATH_TEST_CHECK_SYSCALL_( - sigaction(SIGPROF, &saved_sigprof_action, nullptr)); -# endif // GTEST_OS_LINUX - - GTEST_DEATH_TEST_CHECK_(child_pid != -1); - return child_pid; -} - -// The AssumeRole process for a fork-and-exec death test. It re-executes the -// main program from the beginning, setting the --gtest_filter -// and --gtest_internal_run_death_test flags to cause only the current -// death test to be re-run. -DeathTest::TestRole ExecDeathTest::AssumeRole() { - const UnitTestImpl* const impl = GetUnitTestImpl(); - const InternalRunDeathTestFlag* const flag = - impl->internal_run_death_test_flag(); - const TestInfo* const info = impl->current_test_info(); - const int death_test_index = info->result()->death_test_count(); - - if (flag != nullptr) { - set_write_fd(flag->write_fd()); - return EXECUTE_TEST; - } - - int pipe_fd[2]; - GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1); - // Clear the close-on-exec flag on the write end of the pipe, lest - // it be closed when the child process does an exec: - GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1); - - const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ + - kFilterFlag + "=" + info->test_suite_name() + - "." + info->name(); - const std::string internal_flag = - std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "=" - + file_ + "|" + StreamableToString(line_) + "|" - + StreamableToString(death_test_index) + "|" - + StreamableToString(pipe_fd[1]); - Arguments args; - args.AddArguments(GetArgvsForDeathTestChildProcess()); - args.AddArgument(filter_flag.c_str()); - args.AddArgument(internal_flag.c_str()); - - DeathTest::set_last_death_test_message(""); - - CaptureStderr(); - // See the comment in NoExecDeathTest::AssumeRole for why the next line - // is necessary. - FlushInfoLog(); - - const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]); - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1])); - set_child_pid(child_pid); - set_read_fd(pipe_fd[0]); - set_spawned(true); - return OVERSEE_TEST; -} - -# endif // !GTEST_OS_WINDOWS - -// Creates a concrete DeathTest-derived class that depends on the -// --gtest_death_test_style flag, and sets the pointer pointed to -// by the "test" argument to its address. If the test should be -// skipped, sets that pointer to NULL. Returns true, unless the -// flag is set to an invalid value. -bool DefaultDeathTestFactory::Create(const char* statement, - Matcher matcher, - const char* file, int line, - DeathTest** test) { - UnitTestImpl* const impl = GetUnitTestImpl(); - const InternalRunDeathTestFlag* const flag = - impl->internal_run_death_test_flag(); - const int death_test_index = impl->current_test_info() - ->increment_death_test_count(); - - if (flag != nullptr) { - if (death_test_index > flag->index()) { - DeathTest::set_last_death_test_message( - "Death test count (" + StreamableToString(death_test_index) - + ") somehow exceeded expected maximum (" - + StreamableToString(flag->index()) + ")"); - return false; - } - - if (!(flag->file() == file && flag->line() == line && - flag->index() == death_test_index)) { - *test = nullptr; - return true; - } - } - -# if GTEST_OS_WINDOWS - - if (GTEST_FLAG(death_test_style) == "threadsafe" || - GTEST_FLAG(death_test_style) == "fast") { - *test = new WindowsDeathTest(statement, std::move(matcher), file, line); - } - -# elif GTEST_OS_FUCHSIA - - if (GTEST_FLAG(death_test_style) == "threadsafe" || - GTEST_FLAG(death_test_style) == "fast") { - *test = new FuchsiaDeathTest(statement, std::move(matcher), file, line); - } - -# else - - if (GTEST_FLAG(death_test_style) == "threadsafe") { - *test = new ExecDeathTest(statement, std::move(matcher), file, line); - } else if (GTEST_FLAG(death_test_style) == "fast") { - *test = new NoExecDeathTest(statement, std::move(matcher)); - } - -# endif // GTEST_OS_WINDOWS - - else { // NOLINT - this is more readable than unbalanced brackets inside #if. - DeathTest::set_last_death_test_message( - "Unknown death test style \"" + GTEST_FLAG(death_test_style) - + "\" encountered"); - return false; - } - - return true; -} - -# if GTEST_OS_WINDOWS -// Recreates the pipe and event handles from the provided parameters, -// signals the event, and returns a file descriptor wrapped around the pipe -// handle. This function is called in the child process only. -static int GetStatusFileDescriptor(unsigned int parent_process_id, - size_t write_handle_as_size_t, - size_t event_handle_as_size_t) { - AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE, - FALSE, // Non-inheritable. - parent_process_id)); - if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) { - DeathTestAbort("Unable to open parent process " + - StreamableToString(parent_process_id)); - } - - GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t)); - - const HANDLE write_handle = - reinterpret_cast(write_handle_as_size_t); - HANDLE dup_write_handle; - - // The newly initialized handle is accessible only in the parent - // process. To obtain one accessible within the child, we need to use - // DuplicateHandle. - if (!::DuplicateHandle(parent_process_handle.Get(), write_handle, - ::GetCurrentProcess(), &dup_write_handle, - 0x0, // Requested privileges ignored since - // DUPLICATE_SAME_ACCESS is used. - FALSE, // Request non-inheritable handler. - DUPLICATE_SAME_ACCESS)) { - DeathTestAbort("Unable to duplicate the pipe handle " + - StreamableToString(write_handle_as_size_t) + - " from the parent process " + - StreamableToString(parent_process_id)); - } - - const HANDLE event_handle = reinterpret_cast(event_handle_as_size_t); - HANDLE dup_event_handle; - - if (!::DuplicateHandle(parent_process_handle.Get(), event_handle, - ::GetCurrentProcess(), &dup_event_handle, - 0x0, - FALSE, - DUPLICATE_SAME_ACCESS)) { - DeathTestAbort("Unable to duplicate the event handle " + - StreamableToString(event_handle_as_size_t) + - " from the parent process " + - StreamableToString(parent_process_id)); - } - - const int write_fd = - ::_open_osfhandle(reinterpret_cast(dup_write_handle), O_APPEND); - if (write_fd == -1) { - DeathTestAbort("Unable to convert pipe handle " + - StreamableToString(write_handle_as_size_t) + - " to a file descriptor"); - } - - // Signals the parent that the write end of the pipe has been acquired - // so the parent can release its own write end. - ::SetEvent(dup_event_handle); - - return write_fd; -} -# endif // GTEST_OS_WINDOWS - -// Returns a newly created InternalRunDeathTestFlag object with fields -// initialized from the GTEST_FLAG(internal_run_death_test) flag if -// the flag is specified; otherwise returns NULL. -InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() { - if (GTEST_FLAG(internal_run_death_test) == "") return nullptr; - - // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we - // can use it here. - int line = -1; - int index = -1; - ::std::vector< ::std::string> fields; - SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields); - int write_fd = -1; - -# if GTEST_OS_WINDOWS - - unsigned int parent_process_id = 0; - size_t write_handle_as_size_t = 0; - size_t event_handle_as_size_t = 0; - - if (fields.size() != 6 - || !ParseNaturalNumber(fields[1], &line) - || !ParseNaturalNumber(fields[2], &index) - || !ParseNaturalNumber(fields[3], &parent_process_id) - || !ParseNaturalNumber(fields[4], &write_handle_as_size_t) - || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) { - DeathTestAbort("Bad --gtest_internal_run_death_test flag: " + - GTEST_FLAG(internal_run_death_test)); - } - write_fd = GetStatusFileDescriptor(parent_process_id, - write_handle_as_size_t, - event_handle_as_size_t); - -# elif GTEST_OS_FUCHSIA - - if (fields.size() != 3 - || !ParseNaturalNumber(fields[1], &line) - || !ParseNaturalNumber(fields[2], &index)) { - DeathTestAbort("Bad --gtest_internal_run_death_test flag: " - + GTEST_FLAG(internal_run_death_test)); - } - -# else - - if (fields.size() != 4 - || !ParseNaturalNumber(fields[1], &line) - || !ParseNaturalNumber(fields[2], &index) - || !ParseNaturalNumber(fields[3], &write_fd)) { - DeathTestAbort("Bad --gtest_internal_run_death_test flag: " - + GTEST_FLAG(internal_run_death_test)); - } - -# endif // GTEST_OS_WINDOWS - - return new InternalRunDeathTestFlag(fields[0], line, index, write_fd); -} - -} // namespace internal - -#endif // GTEST_HAS_DEATH_TEST - -} // namespace testing -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#include - -#if GTEST_OS_WINDOWS_MOBILE -# include -#elif GTEST_OS_WINDOWS -# include -# include -#else -# include -# include // Some Linux distributions define PATH_MAX here. -#endif // GTEST_OS_WINDOWS_MOBILE - - -#if GTEST_OS_WINDOWS -# define GTEST_PATH_MAX_ _MAX_PATH -#elif defined(PATH_MAX) -# define GTEST_PATH_MAX_ PATH_MAX -#elif defined(_XOPEN_PATH_MAX) -# define GTEST_PATH_MAX_ _XOPEN_PATH_MAX -#else -# define GTEST_PATH_MAX_ _POSIX_PATH_MAX -#endif // GTEST_OS_WINDOWS - -namespace testing { -namespace internal { - -#if GTEST_OS_WINDOWS -// On Windows, '\\' is the standard path separator, but many tools and the -// Windows API also accept '/' as an alternate path separator. Unless otherwise -// noted, a file path can contain either kind of path separators, or a mixture -// of them. -const char kPathSeparator = '\\'; -const char kAlternatePathSeparator = '/'; -const char kAlternatePathSeparatorString[] = "/"; -# if GTEST_OS_WINDOWS_MOBILE -// Windows CE doesn't have a current directory. You should not use -// the current directory in tests on Windows CE, but this at least -// provides a reasonable fallback. -const char kCurrentDirectoryString[] = "\\"; -// Windows CE doesn't define INVALID_FILE_ATTRIBUTES -const DWORD kInvalidFileAttributes = 0xffffffff; -# else -const char kCurrentDirectoryString[] = ".\\"; -# endif // GTEST_OS_WINDOWS_MOBILE -#else -const char kPathSeparator = '/'; -const char kCurrentDirectoryString[] = "./"; -#endif // GTEST_OS_WINDOWS - -// Returns whether the given character is a valid path separator. -static bool IsPathSeparator(char c) { -#if GTEST_HAS_ALT_PATH_SEP_ - return (c == kPathSeparator) || (c == kAlternatePathSeparator); -#else - return c == kPathSeparator; -#endif -} - -// Returns the current working directory, or "" if unsuccessful. -FilePath FilePath::GetCurrentDir() { -#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \ - GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_ESP32 || \ - GTEST_OS_XTENSA - // These platforms do not have a current directory, so we just return - // something reasonable. - return FilePath(kCurrentDirectoryString); -#elif GTEST_OS_WINDOWS - char cwd[GTEST_PATH_MAX_ + 1] = { '\0' }; - return FilePath(_getcwd(cwd, sizeof(cwd)) == nullptr ? "" : cwd); -#else - char cwd[GTEST_PATH_MAX_ + 1] = { '\0' }; - char* result = getcwd(cwd, sizeof(cwd)); -# if GTEST_OS_NACL - // getcwd will likely fail in NaCl due to the sandbox, so return something - // reasonable. The user may have provided a shim implementation for getcwd, - // however, so fallback only when failure is detected. - return FilePath(result == nullptr ? kCurrentDirectoryString : cwd); -# endif // GTEST_OS_NACL - return FilePath(result == nullptr ? "" : cwd); -#endif // GTEST_OS_WINDOWS_MOBILE -} - -// Returns a copy of the FilePath with the case-insensitive extension removed. -// Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns -// FilePath("dir/file"). If a case-insensitive extension is not -// found, returns a copy of the original FilePath. -FilePath FilePath::RemoveExtension(const char* extension) const { - const std::string dot_extension = std::string(".") + extension; - if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) { - return FilePath(pathname_.substr( - 0, pathname_.length() - dot_extension.length())); - } - return *this; -} - -// Returns a pointer to the last occurrence of a valid path separator in -// the FilePath. On Windows, for example, both '/' and '\' are valid path -// separators. Returns NULL if no path separator was found. -const char* FilePath::FindLastPathSeparator() const { - const char* const last_sep = strrchr(c_str(), kPathSeparator); -#if GTEST_HAS_ALT_PATH_SEP_ - const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator); - // Comparing two pointers of which only one is NULL is undefined. - if (last_alt_sep != nullptr && - (last_sep == nullptr || last_alt_sep > last_sep)) { - return last_alt_sep; - } -#endif - return last_sep; -} - -// Returns a copy of the FilePath with the directory part removed. -// Example: FilePath("path/to/file").RemoveDirectoryName() returns -// FilePath("file"). If there is no directory part ("just_a_file"), it returns -// the FilePath unmodified. If there is no file part ("just_a_dir/") it -// returns an empty FilePath (""). -// On Windows platform, '\' is the path separator, otherwise it is '/'. -FilePath FilePath::RemoveDirectoryName() const { - const char* const last_sep = FindLastPathSeparator(); - return last_sep ? FilePath(last_sep + 1) : *this; -} - -// RemoveFileName returns the directory path with the filename removed. -// Example: FilePath("path/to/file").RemoveFileName() returns "path/to/". -// If the FilePath is "a_file" or "/a_file", RemoveFileName returns -// FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does -// not have a file, like "just/a/dir/", it returns the FilePath unmodified. -// On Windows platform, '\' is the path separator, otherwise it is '/'. -FilePath FilePath::RemoveFileName() const { - const char* const last_sep = FindLastPathSeparator(); - std::string dir; - if (last_sep) { - dir = std::string(c_str(), static_cast(last_sep + 1 - c_str())); - } else { - dir = kCurrentDirectoryString; - } - return FilePath(dir); -} - -// Helper functions for naming files in a directory for xml output. - -// Given directory = "dir", base_name = "test", number = 0, -// extension = "xml", returns "dir/test.xml". If number is greater -// than zero (e.g., 12), returns "dir/test_12.xml". -// On Windows platform, uses \ as the separator rather than /. -FilePath FilePath::MakeFileName(const FilePath& directory, - const FilePath& base_name, - int number, - const char* extension) { - std::string file; - if (number == 0) { - file = base_name.string() + "." + extension; - } else { - file = base_name.string() + "_" + StreamableToString(number) - + "." + extension; - } - return ConcatPaths(directory, FilePath(file)); -} - -// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml". -// On Windows, uses \ as the separator rather than /. -FilePath FilePath::ConcatPaths(const FilePath& directory, - const FilePath& relative_path) { - if (directory.IsEmpty()) - return relative_path; - const FilePath dir(directory.RemoveTrailingPathSeparator()); - return FilePath(dir.string() + kPathSeparator + relative_path.string()); -} - -// Returns true if pathname describes something findable in the file-system, -// either a file, directory, or whatever. -bool FilePath::FileOrDirectoryExists() const { -#if GTEST_OS_WINDOWS_MOBILE - LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str()); - const DWORD attributes = GetFileAttributes(unicode); - delete [] unicode; - return attributes != kInvalidFileAttributes; -#else - posix::StatStruct file_stat{}; - return posix::Stat(pathname_.c_str(), &file_stat) == 0; -#endif // GTEST_OS_WINDOWS_MOBILE -} - -// Returns true if pathname describes a directory in the file-system -// that exists. -bool FilePath::DirectoryExists() const { - bool result = false; -#if GTEST_OS_WINDOWS - // Don't strip off trailing separator if path is a root directory on - // Windows (like "C:\\"). - const FilePath& path(IsRootDirectory() ? *this : - RemoveTrailingPathSeparator()); -#else - const FilePath& path(*this); -#endif - -#if GTEST_OS_WINDOWS_MOBILE - LPCWSTR unicode = String::AnsiToUtf16(path.c_str()); - const DWORD attributes = GetFileAttributes(unicode); - delete [] unicode; - if ((attributes != kInvalidFileAttributes) && - (attributes & FILE_ATTRIBUTE_DIRECTORY)) { - result = true; - } -#else - posix::StatStruct file_stat{}; - result = posix::Stat(path.c_str(), &file_stat) == 0 && - posix::IsDir(file_stat); -#endif // GTEST_OS_WINDOWS_MOBILE - - return result; -} - -// Returns true if pathname describes a root directory. (Windows has one -// root directory per disk drive.) -bool FilePath::IsRootDirectory() const { -#if GTEST_OS_WINDOWS - return pathname_.length() == 3 && IsAbsolutePath(); -#else - return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]); -#endif -} - -// Returns true if pathname describes an absolute path. -bool FilePath::IsAbsolutePath() const { - const char* const name = pathname_.c_str(); -#if GTEST_OS_WINDOWS - return pathname_.length() >= 3 && - ((name[0] >= 'a' && name[0] <= 'z') || - (name[0] >= 'A' && name[0] <= 'Z')) && - name[1] == ':' && - IsPathSeparator(name[2]); -#else - return IsPathSeparator(name[0]); -#endif -} - -// Returns a pathname for a file that does not currently exist. The pathname -// will be directory/base_name.extension or -// directory/base_name_.extension if directory/base_name.extension -// already exists. The number will be incremented until a pathname is found -// that does not already exist. -// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'. -// There could be a race condition if two or more processes are calling this -// function at the same time -- they could both pick the same filename. -FilePath FilePath::GenerateUniqueFileName(const FilePath& directory, - const FilePath& base_name, - const char* extension) { - FilePath full_pathname; - int number = 0; - do { - full_pathname.Set(MakeFileName(directory, base_name, number++, extension)); - } while (full_pathname.FileOrDirectoryExists()); - return full_pathname; -} - -// Returns true if FilePath ends with a path separator, which indicates that -// it is intended to represent a directory. Returns false otherwise. -// This does NOT check that a directory (or file) actually exists. -bool FilePath::IsDirectory() const { - return !pathname_.empty() && - IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]); -} - -// Create directories so that path exists. Returns true if successful or if -// the directories already exist; returns false if unable to create directories -// for any reason. -bool FilePath::CreateDirectoriesRecursively() const { - if (!this->IsDirectory()) { - return false; - } - - if (pathname_.length() == 0 || this->DirectoryExists()) { - return true; - } - - const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName()); - return parent.CreateDirectoriesRecursively() && this->CreateFolder(); -} - -// Create the directory so that path exists. Returns true if successful or -// if the directory already exists; returns false if unable to create the -// directory for any reason, including if the parent directory does not -// exist. Not named "CreateDirectory" because that's a macro on Windows. -bool FilePath::CreateFolder() const { -#if GTEST_OS_WINDOWS_MOBILE - FilePath removed_sep(this->RemoveTrailingPathSeparator()); - LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str()); - int result = CreateDirectory(unicode, nullptr) ? 0 : -1; - delete [] unicode; -#elif GTEST_OS_WINDOWS - int result = _mkdir(pathname_.c_str()); -#elif GTEST_OS_ESP8266 || GTEST_OS_XTENSA - // do nothing - int result = 0; -#else - int result = mkdir(pathname_.c_str(), 0777); -#endif // GTEST_OS_WINDOWS_MOBILE - - if (result == -1) { - return this->DirectoryExists(); // An error is OK if the directory exists. - } - return true; // No error. -} - -// If input name has a trailing separator character, remove it and return the -// name, otherwise return the name string unmodified. -// On Windows platform, uses \ as the separator, other platforms use /. -FilePath FilePath::RemoveTrailingPathSeparator() const { - return IsDirectory() - ? FilePath(pathname_.substr(0, pathname_.length() - 1)) - : *this; -} - -// Removes any redundant separators that might be in the pathname. -// For example, "bar///foo" becomes "bar/foo". Does not eliminate other -// redundancies that might be in a pathname involving "." or "..". -void FilePath::Normalize() { - auto out = pathname_.begin(); - - for (const char character : pathname_) { - if (!IsPathSeparator(character)) { - *(out++) = character; - } else if (out == pathname_.begin() || *std::prev(out) != kPathSeparator) { - *(out++) = kPathSeparator; - } else { - continue; - } - } - - pathname_.erase(out, pathname_.end()); -} - -} // namespace internal -} // namespace testing -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This file implements just enough of the matcher interface to allow -// EXPECT_DEATH and friends to accept a matcher argument. - - -#include - -namespace testing { - -// Constructs a matcher that matches a const std::string& whose value is -// equal to s. -Matcher::Matcher(const std::string& s) { *this = Eq(s); } - -// Constructs a matcher that matches a const std::string& whose value is -// equal to s. -Matcher::Matcher(const char* s) { - *this = Eq(std::string(s)); -} - -// Constructs a matcher that matches a std::string whose value is equal to -// s. -Matcher::Matcher(const std::string& s) { *this = Eq(s); } - -// Constructs a matcher that matches a std::string whose value is equal to -// s. -Matcher::Matcher(const char* s) { *this = Eq(std::string(s)); } - -#if GTEST_INTERNAL_HAS_STRING_VIEW -// Constructs a matcher that matches a const StringView& whose value is -// equal to s. -Matcher::Matcher(const std::string& s) { - *this = Eq(s); -} - -// Constructs a matcher that matches a const StringView& whose value is -// equal to s. -Matcher::Matcher(const char* s) { - *this = Eq(std::string(s)); -} - -// Constructs a matcher that matches a const StringView& whose value is -// equal to s. -Matcher::Matcher(internal::StringView s) { - *this = Eq(std::string(s)); -} - -// Constructs a matcher that matches a StringView whose value is equal to -// s. -Matcher::Matcher(const std::string& s) { *this = Eq(s); } - -// Constructs a matcher that matches a StringView whose value is equal to -// s. -Matcher::Matcher(const char* s) { - *this = Eq(std::string(s)); -} - -// Constructs a matcher that matches a StringView whose value is equal to -// s. -Matcher::Matcher(internal::StringView s) { - *this = Eq(std::string(s)); -} -#endif // GTEST_INTERNAL_HAS_STRING_VIEW - -} // namespace testing -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -#include -#include -#include -#include -#include -#include -#include - -#if GTEST_OS_WINDOWS -# include -# include -# include -# include // Used in ThreadLocal. -# ifdef _MSC_VER -# include -# endif // _MSC_VER -#else -# include -#endif // GTEST_OS_WINDOWS - -#if GTEST_OS_MAC -# include -# include -# include -#endif // GTEST_OS_MAC - -#if GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD || \ - GTEST_OS_NETBSD || GTEST_OS_OPENBSD -# include -# if GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD -# include -# endif -#endif - -#if GTEST_OS_QNX -# include -# include -# include -#endif // GTEST_OS_QNX - -#if GTEST_OS_AIX -# include -# include -#endif // GTEST_OS_AIX - -#if GTEST_OS_FUCHSIA -# include -# include -#endif // GTEST_OS_FUCHSIA - - -namespace testing { -namespace internal { - -#if defined(_MSC_VER) || defined(__BORLANDC__) -// MSVC and C++Builder do not provide a definition of STDERR_FILENO. -const int kStdOutFileno = 1; -const int kStdErrFileno = 2; -#else -const int kStdOutFileno = STDOUT_FILENO; -const int kStdErrFileno = STDERR_FILENO; -#endif // _MSC_VER - -#if GTEST_OS_LINUX - -namespace { -template -T ReadProcFileField(const std::string& filename, int field) { - std::string dummy; - std::ifstream file(filename.c_str()); - while (field-- > 0) { - file >> dummy; - } - T output = 0; - file >> output; - return output; -} -} // namespace - -// Returns the number of active threads, or 0 when there is an error. -size_t GetThreadCount() { - const std::string filename = - (Message() << "/proc/" << getpid() << "/stat").GetString(); - return ReadProcFileField(filename, 19); -} - -#elif GTEST_OS_MAC - -size_t GetThreadCount() { - const task_t task = mach_task_self(); - mach_msg_type_number_t thread_count; - thread_act_array_t thread_list; - const kern_return_t status = task_threads(task, &thread_list, &thread_count); - if (status == KERN_SUCCESS) { - // task_threads allocates resources in thread_list and we need to free them - // to avoid leaks. - vm_deallocate(task, - reinterpret_cast(thread_list), - sizeof(thread_t) * thread_count); - return static_cast(thread_count); - } else { - return 0; - } -} - -#elif GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD || \ - GTEST_OS_NETBSD - -#if GTEST_OS_NETBSD -#undef KERN_PROC -#define KERN_PROC KERN_PROC2 -#define kinfo_proc kinfo_proc2 -#endif - -#if GTEST_OS_DRAGONFLY -#define KP_NLWP(kp) (kp.kp_nthreads) -#elif GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD -#define KP_NLWP(kp) (kp.ki_numthreads) -#elif GTEST_OS_NETBSD -#define KP_NLWP(kp) (kp.p_nlwps) -#endif - -// Returns the number of threads running in the process, or 0 to indicate that -// we cannot detect it. -size_t GetThreadCount() { - int mib[] = { - CTL_KERN, - KERN_PROC, - KERN_PROC_PID, - getpid(), -#if GTEST_OS_NETBSD - sizeof(struct kinfo_proc), - 1, -#endif - }; - u_int miblen = sizeof(mib) / sizeof(mib[0]); - struct kinfo_proc info; - size_t size = sizeof(info); - if (sysctl(mib, miblen, &info, &size, NULL, 0)) { - return 0; - } - return static_cast(KP_NLWP(info)); -} -#elif GTEST_OS_OPENBSD - -// Returns the number of threads running in the process, or 0 to indicate that -// we cannot detect it. -size_t GetThreadCount() { - int mib[] = { - CTL_KERN, - KERN_PROC, - KERN_PROC_PID | KERN_PROC_SHOW_THREADS, - getpid(), - sizeof(struct kinfo_proc), - 0, - }; - u_int miblen = sizeof(mib) / sizeof(mib[0]); - - // get number of structs - size_t size; - if (sysctl(mib, miblen, NULL, &size, NULL, 0)) { - return 0; - } - - mib[5] = static_cast(size / static_cast(mib[4])); - - // populate array of structs - struct kinfo_proc info[mib[5]]; - if (sysctl(mib, miblen, &info, &size, NULL, 0)) { - return 0; - } - - // exclude empty members - size_t nthreads = 0; - for (size_t i = 0; i < size / static_cast(mib[4]); i++) { - if (info[i].p_tid != -1) - nthreads++; - } - return nthreads; -} - -#elif GTEST_OS_QNX - -// Returns the number of threads running in the process, or 0 to indicate that -// we cannot detect it. -size_t GetThreadCount() { - const int fd = open("/proc/self/as", O_RDONLY); - if (fd < 0) { - return 0; - } - procfs_info process_info; - const int status = - devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), nullptr); - close(fd); - if (status == EOK) { - return static_cast(process_info.num_threads); - } else { - return 0; - } -} - -#elif GTEST_OS_AIX - -size_t GetThreadCount() { - struct procentry64 entry; - pid_t pid = getpid(); - int status = getprocs64(&entry, sizeof(entry), nullptr, 0, &pid, 1); - if (status == 1) { - return entry.pi_thcount; - } else { - return 0; - } -} - -#elif GTEST_OS_FUCHSIA - -size_t GetThreadCount() { - int dummy_buffer; - size_t avail; - zx_status_t status = zx_object_get_info( - zx_process_self(), - ZX_INFO_PROCESS_THREADS, - &dummy_buffer, - 0, - nullptr, - &avail); - if (status == ZX_OK) { - return avail; - } else { - return 0; - } -} - -#else - -size_t GetThreadCount() { - // There's no portable way to detect the number of threads, so we just - // return 0 to indicate that we cannot detect it. - return 0; -} - -#endif // GTEST_OS_LINUX - -#if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS - -void SleepMilliseconds(int n) { - ::Sleep(static_cast(n)); -} - -AutoHandle::AutoHandle() - : handle_(INVALID_HANDLE_VALUE) {} - -AutoHandle::AutoHandle(Handle handle) - : handle_(handle) {} - -AutoHandle::~AutoHandle() { - Reset(); -} - -AutoHandle::Handle AutoHandle::Get() const { - return handle_; -} - -void AutoHandle::Reset() { - Reset(INVALID_HANDLE_VALUE); -} - -void AutoHandle::Reset(HANDLE handle) { - // Resetting with the same handle we already own is invalid. - if (handle_ != handle) { - if (IsCloseable()) { - ::CloseHandle(handle_); - } - handle_ = handle; - } else { - GTEST_CHECK_(!IsCloseable()) - << "Resetting a valid handle to itself is likely a programmer error " - "and thus not allowed."; - } -} - -bool AutoHandle::IsCloseable() const { - // Different Windows APIs may use either of these values to represent an - // invalid handle. - return handle_ != nullptr && handle_ != INVALID_HANDLE_VALUE; -} - -Notification::Notification() - : event_(::CreateEvent(nullptr, // Default security attributes. - TRUE, // Do not reset automatically. - FALSE, // Initially unset. - nullptr)) { // Anonymous event. - GTEST_CHECK_(event_.Get() != nullptr); -} - -void Notification::Notify() { - GTEST_CHECK_(::SetEvent(event_.Get()) != FALSE); -} - -void Notification::WaitForNotification() { - GTEST_CHECK_( - ::WaitForSingleObject(event_.Get(), INFINITE) == WAIT_OBJECT_0); -} - -Mutex::Mutex() - : owner_thread_id_(0), - type_(kDynamic), - critical_section_init_phase_(0), - critical_section_(new CRITICAL_SECTION) { - ::InitializeCriticalSection(critical_section_); -} - -Mutex::~Mutex() { - // Static mutexes are leaked intentionally. It is not thread-safe to try - // to clean them up. - if (type_ == kDynamic) { - ::DeleteCriticalSection(critical_section_); - delete critical_section_; - critical_section_ = nullptr; - } -} - -void Mutex::Lock() { - ThreadSafeLazyInit(); - ::EnterCriticalSection(critical_section_); - owner_thread_id_ = ::GetCurrentThreadId(); -} - -void Mutex::Unlock() { - ThreadSafeLazyInit(); - // We don't protect writing to owner_thread_id_ here, as it's the - // caller's responsibility to ensure that the current thread holds the - // mutex when this is called. - owner_thread_id_ = 0; - ::LeaveCriticalSection(critical_section_); -} - -// Does nothing if the current thread holds the mutex. Otherwise, crashes -// with high probability. -void Mutex::AssertHeld() { - ThreadSafeLazyInit(); - GTEST_CHECK_(owner_thread_id_ == ::GetCurrentThreadId()) - << "The current thread is not holding the mutex @" << this; -} - -namespace { - -#ifdef _MSC_VER -// Use the RAII idiom to flag mem allocs that are intentionally never -// deallocated. The motivation is to silence the false positive mem leaks -// that are reported by the debug version of MS's CRT which can only detect -// if an alloc is missing a matching deallocation. -// Example: -// MemoryIsNotDeallocated memory_is_not_deallocated; -// critical_section_ = new CRITICAL_SECTION; -// -class MemoryIsNotDeallocated -{ - public: - MemoryIsNotDeallocated() : old_crtdbg_flag_(0) { - old_crtdbg_flag_ = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); - // Set heap allocation block type to _IGNORE_BLOCK so that MS debug CRT - // doesn't report mem leak if there's no matching deallocation. - _CrtSetDbgFlag(old_crtdbg_flag_ & ~_CRTDBG_ALLOC_MEM_DF); - } - - ~MemoryIsNotDeallocated() { - // Restore the original _CRTDBG_ALLOC_MEM_DF flag - _CrtSetDbgFlag(old_crtdbg_flag_); - } - - private: - int old_crtdbg_flag_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(MemoryIsNotDeallocated); -}; -#endif // _MSC_VER - -} // namespace - -// Initializes owner_thread_id_ and critical_section_ in static mutexes. -void Mutex::ThreadSafeLazyInit() { - // Dynamic mutexes are initialized in the constructor. - if (type_ == kStatic) { - switch ( - ::InterlockedCompareExchange(&critical_section_init_phase_, 1L, 0L)) { - case 0: - // If critical_section_init_phase_ was 0 before the exchange, we - // are the first to test it and need to perform the initialization. - owner_thread_id_ = 0; - { - // Use RAII to flag that following mem alloc is never deallocated. -#ifdef _MSC_VER - MemoryIsNotDeallocated memory_is_not_deallocated; -#endif // _MSC_VER - critical_section_ = new CRITICAL_SECTION; - } - ::InitializeCriticalSection(critical_section_); - // Updates the critical_section_init_phase_ to 2 to signal - // initialization complete. - GTEST_CHECK_(::InterlockedCompareExchange( - &critical_section_init_phase_, 2L, 1L) == - 1L); - break; - case 1: - // Somebody else is already initializing the mutex; spin until they - // are done. - while (::InterlockedCompareExchange(&critical_section_init_phase_, - 2L, - 2L) != 2L) { - // Possibly yields the rest of the thread's time slice to other - // threads. - ::Sleep(0); - } - break; - - case 2: - break; // The mutex is already initialized and ready for use. - - default: - GTEST_CHECK_(false) - << "Unexpected value of critical_section_init_phase_ " - << "while initializing a static mutex."; - } - } -} - -namespace { - -class ThreadWithParamSupport : public ThreadWithParamBase { - public: - static HANDLE CreateThread(Runnable* runnable, - Notification* thread_can_start) { - ThreadMainParam* param = new ThreadMainParam(runnable, thread_can_start); - DWORD thread_id; - HANDLE thread_handle = ::CreateThread( - nullptr, // Default security. - 0, // Default stack size. - &ThreadWithParamSupport::ThreadMain, - param, // Parameter to ThreadMainStatic - 0x0, // Default creation flags. - &thread_id); // Need a valid pointer for the call to work under Win98. - GTEST_CHECK_(thread_handle != nullptr) - << "CreateThread failed with error " << ::GetLastError() << "."; - if (thread_handle == nullptr) { - delete param; - } - return thread_handle; - } - - private: - struct ThreadMainParam { - ThreadMainParam(Runnable* runnable, Notification* thread_can_start) - : runnable_(runnable), - thread_can_start_(thread_can_start) { - } - std::unique_ptr runnable_; - // Does not own. - Notification* thread_can_start_; - }; - - static DWORD WINAPI ThreadMain(void* ptr) { - // Transfers ownership. - std::unique_ptr param(static_cast(ptr)); - if (param->thread_can_start_ != nullptr) - param->thread_can_start_->WaitForNotification(); - param->runnable_->Run(); - return 0; - } - - // Prohibit instantiation. - ThreadWithParamSupport(); - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParamSupport); -}; - -} // namespace - -ThreadWithParamBase::ThreadWithParamBase(Runnable *runnable, - Notification* thread_can_start) - : thread_(ThreadWithParamSupport::CreateThread(runnable, - thread_can_start)) { -} - -ThreadWithParamBase::~ThreadWithParamBase() { - Join(); -} - -void ThreadWithParamBase::Join() { - GTEST_CHECK_(::WaitForSingleObject(thread_.Get(), INFINITE) == WAIT_OBJECT_0) - << "Failed to join the thread with error " << ::GetLastError() << "."; -} - -// Maps a thread to a set of ThreadIdToThreadLocals that have values -// instantiated on that thread and notifies them when the thread exits. A -// ThreadLocal instance is expected to persist until all threads it has -// values on have terminated. -class ThreadLocalRegistryImpl { - public: - // Registers thread_local_instance as having value on the current thread. - // Returns a value that can be used to identify the thread from other threads. - static ThreadLocalValueHolderBase* GetValueOnCurrentThread( - const ThreadLocalBase* thread_local_instance) { -#ifdef _MSC_VER - MemoryIsNotDeallocated memory_is_not_deallocated; -#endif // _MSC_VER - DWORD current_thread = ::GetCurrentThreadId(); - MutexLock lock(&mutex_); - ThreadIdToThreadLocals* const thread_to_thread_locals = - GetThreadLocalsMapLocked(); - ThreadIdToThreadLocals::iterator thread_local_pos = - thread_to_thread_locals->find(current_thread); - if (thread_local_pos == thread_to_thread_locals->end()) { - thread_local_pos = thread_to_thread_locals->insert( - std::make_pair(current_thread, ThreadLocalValues())).first; - StartWatcherThreadFor(current_thread); - } - ThreadLocalValues& thread_local_values = thread_local_pos->second; - ThreadLocalValues::iterator value_pos = - thread_local_values.find(thread_local_instance); - if (value_pos == thread_local_values.end()) { - value_pos = - thread_local_values - .insert(std::make_pair( - thread_local_instance, - std::shared_ptr( - thread_local_instance->NewValueForCurrentThread()))) - .first; - } - return value_pos->second.get(); - } - - static void OnThreadLocalDestroyed( - const ThreadLocalBase* thread_local_instance) { - std::vector > value_holders; - // Clean up the ThreadLocalValues data structure while holding the lock, but - // defer the destruction of the ThreadLocalValueHolderBases. - { - MutexLock lock(&mutex_); - ThreadIdToThreadLocals* const thread_to_thread_locals = - GetThreadLocalsMapLocked(); - for (ThreadIdToThreadLocals::iterator it = - thread_to_thread_locals->begin(); - it != thread_to_thread_locals->end(); - ++it) { - ThreadLocalValues& thread_local_values = it->second; - ThreadLocalValues::iterator value_pos = - thread_local_values.find(thread_local_instance); - if (value_pos != thread_local_values.end()) { - value_holders.push_back(value_pos->second); - thread_local_values.erase(value_pos); - // This 'if' can only be successful at most once, so theoretically we - // could break out of the loop here, but we don't bother doing so. - } - } - } - // Outside the lock, let the destructor for 'value_holders' deallocate the - // ThreadLocalValueHolderBases. - } - - static void OnThreadExit(DWORD thread_id) { - GTEST_CHECK_(thread_id != 0) << ::GetLastError(); - std::vector > value_holders; - // Clean up the ThreadIdToThreadLocals data structure while holding the - // lock, but defer the destruction of the ThreadLocalValueHolderBases. - { - MutexLock lock(&mutex_); - ThreadIdToThreadLocals* const thread_to_thread_locals = - GetThreadLocalsMapLocked(); - ThreadIdToThreadLocals::iterator thread_local_pos = - thread_to_thread_locals->find(thread_id); - if (thread_local_pos != thread_to_thread_locals->end()) { - ThreadLocalValues& thread_local_values = thread_local_pos->second; - for (ThreadLocalValues::iterator value_pos = - thread_local_values.begin(); - value_pos != thread_local_values.end(); - ++value_pos) { - value_holders.push_back(value_pos->second); - } - thread_to_thread_locals->erase(thread_local_pos); - } - } - // Outside the lock, let the destructor for 'value_holders' deallocate the - // ThreadLocalValueHolderBases. - } - - private: - // In a particular thread, maps a ThreadLocal object to its value. - typedef std::map > - ThreadLocalValues; - // Stores all ThreadIdToThreadLocals having values in a thread, indexed by - // thread's ID. - typedef std::map ThreadIdToThreadLocals; - - // Holds the thread id and thread handle that we pass from - // StartWatcherThreadFor to WatcherThreadFunc. - typedef std::pair ThreadIdAndHandle; - - static void StartWatcherThreadFor(DWORD thread_id) { - // The returned handle will be kept in thread_map and closed by - // watcher_thread in WatcherThreadFunc. - HANDLE thread = ::OpenThread(SYNCHRONIZE | THREAD_QUERY_INFORMATION, - FALSE, - thread_id); - GTEST_CHECK_(thread != nullptr); - // We need to pass a valid thread ID pointer into CreateThread for it - // to work correctly under Win98. - DWORD watcher_thread_id; - HANDLE watcher_thread = ::CreateThread( - nullptr, // Default security. - 0, // Default stack size - &ThreadLocalRegistryImpl::WatcherThreadFunc, - reinterpret_cast(new ThreadIdAndHandle(thread_id, thread)), - CREATE_SUSPENDED, &watcher_thread_id); - GTEST_CHECK_(watcher_thread != nullptr); - // Give the watcher thread the same priority as ours to avoid being - // blocked by it. - ::SetThreadPriority(watcher_thread, - ::GetThreadPriority(::GetCurrentThread())); - ::ResumeThread(watcher_thread); - ::CloseHandle(watcher_thread); - } - - // Monitors exit from a given thread and notifies those - // ThreadIdToThreadLocals about thread termination. - static DWORD WINAPI WatcherThreadFunc(LPVOID param) { - const ThreadIdAndHandle* tah = - reinterpret_cast(param); - GTEST_CHECK_( - ::WaitForSingleObject(tah->second, INFINITE) == WAIT_OBJECT_0); - OnThreadExit(tah->first); - ::CloseHandle(tah->second); - delete tah; - return 0; - } - - // Returns map of thread local instances. - static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() { - mutex_.AssertHeld(); -#ifdef _MSC_VER - MemoryIsNotDeallocated memory_is_not_deallocated; -#endif // _MSC_VER - static ThreadIdToThreadLocals* map = new ThreadIdToThreadLocals(); - return map; - } - - // Protects access to GetThreadLocalsMapLocked() and its return value. - static Mutex mutex_; - // Protects access to GetThreadMapLocked() and its return value. - static Mutex thread_map_mutex_; -}; - -Mutex ThreadLocalRegistryImpl::mutex_(Mutex::kStaticMutex); // NOLINT -Mutex ThreadLocalRegistryImpl::thread_map_mutex_(Mutex::kStaticMutex); // NOLINT - -ThreadLocalValueHolderBase* ThreadLocalRegistry::GetValueOnCurrentThread( - const ThreadLocalBase* thread_local_instance) { - return ThreadLocalRegistryImpl::GetValueOnCurrentThread( - thread_local_instance); -} - -void ThreadLocalRegistry::OnThreadLocalDestroyed( - const ThreadLocalBase* thread_local_instance) { - ThreadLocalRegistryImpl::OnThreadLocalDestroyed(thread_local_instance); -} - -#endif // GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS - -#if GTEST_USES_POSIX_RE - -// Implements RE. Currently only needed for death tests. - -RE::~RE() { - if (is_valid_) { - // regfree'ing an invalid regex might crash because the content - // of the regex is undefined. Since the regex's are essentially - // the same, one cannot be valid (or invalid) without the other - // being so too. - regfree(&partial_regex_); - regfree(&full_regex_); - } - free(const_cast(pattern_)); -} - -// Returns true if and only if regular expression re matches the entire str. -bool RE::FullMatch(const char* str, const RE& re) { - if (!re.is_valid_) return false; - - regmatch_t match; - return regexec(&re.full_regex_, str, 1, &match, 0) == 0; -} - -// Returns true if and only if regular expression re matches a substring of -// str (including str itself). -bool RE::PartialMatch(const char* str, const RE& re) { - if (!re.is_valid_) return false; - - regmatch_t match; - return regexec(&re.partial_regex_, str, 1, &match, 0) == 0; -} - -// Initializes an RE from its string representation. -void RE::Init(const char* regex) { - pattern_ = posix::StrDup(regex); - - // Reserves enough bytes to hold the regular expression used for a - // full match. - const size_t full_regex_len = strlen(regex) + 10; - char* const full_pattern = new char[full_regex_len]; - - snprintf(full_pattern, full_regex_len, "^(%s)$", regex); - is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0; - // We want to call regcomp(&partial_regex_, ...) even if the - // previous expression returns false. Otherwise partial_regex_ may - // not be properly initialized can may cause trouble when it's - // freed. - // - // Some implementation of POSIX regex (e.g. on at least some - // versions of Cygwin) doesn't accept the empty string as a valid - // regex. We change it to an equivalent form "()" to be safe. - if (is_valid_) { - const char* const partial_regex = (*regex == '\0') ? "()" : regex; - is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0; - } - EXPECT_TRUE(is_valid_) - << "Regular expression \"" << regex - << "\" is not a valid POSIX Extended regular expression."; - - delete[] full_pattern; -} - -#elif GTEST_USES_SIMPLE_RE - -// Returns true if and only if ch appears anywhere in str (excluding the -// terminating '\0' character). -bool IsInSet(char ch, const char* str) { - return ch != '\0' && strchr(str, ch) != nullptr; -} - -// Returns true if and only if ch belongs to the given classification. -// Unlike similar functions in , these aren't affected by the -// current locale. -bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; } -bool IsAsciiPunct(char ch) { - return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"); -} -bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); } -bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); } -bool IsAsciiWordChar(char ch) { - return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') || - ('0' <= ch && ch <= '9') || ch == '_'; -} - -// Returns true if and only if "\\c" is a supported escape sequence. -bool IsValidEscape(char c) { - return (IsAsciiPunct(c) || IsInSet(c, "dDfnrsStvwW")); -} - -// Returns true if and only if the given atom (specified by escaped and -// pattern) matches ch. The result is undefined if the atom is invalid. -bool AtomMatchesChar(bool escaped, char pattern_char, char ch) { - if (escaped) { // "\\p" where p is pattern_char. - switch (pattern_char) { - case 'd': return IsAsciiDigit(ch); - case 'D': return !IsAsciiDigit(ch); - case 'f': return ch == '\f'; - case 'n': return ch == '\n'; - case 'r': return ch == '\r'; - case 's': return IsAsciiWhiteSpace(ch); - case 'S': return !IsAsciiWhiteSpace(ch); - case 't': return ch == '\t'; - case 'v': return ch == '\v'; - case 'w': return IsAsciiWordChar(ch); - case 'W': return !IsAsciiWordChar(ch); - } - return IsAsciiPunct(pattern_char) && pattern_char == ch; - } - - return (pattern_char == '.' && ch != '\n') || pattern_char == ch; -} - -// Helper function used by ValidateRegex() to format error messages. -static std::string FormatRegexSyntaxError(const char* regex, int index) { - return (Message() << "Syntax error at index " << index - << " in simple regular expression \"" << regex << "\": ").GetString(); -} - -// Generates non-fatal failures and returns false if regex is invalid; -// otherwise returns true. -bool ValidateRegex(const char* regex) { - if (regex == nullptr) { - ADD_FAILURE() << "NULL is not a valid simple regular expression."; - return false; - } - - bool is_valid = true; - - // True if and only if ?, *, or + can follow the previous atom. - bool prev_repeatable = false; - for (int i = 0; regex[i]; i++) { - if (regex[i] == '\\') { // An escape sequence - i++; - if (regex[i] == '\0') { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1) - << "'\\' cannot appear at the end."; - return false; - } - - if (!IsValidEscape(regex[i])) { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1) - << "invalid escape sequence \"\\" << regex[i] << "\"."; - is_valid = false; - } - prev_repeatable = true; - } else { // Not an escape sequence. - const char ch = regex[i]; - - if (ch == '^' && i > 0) { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i) - << "'^' can only appear at the beginning."; - is_valid = false; - } else if (ch == '$' && regex[i + 1] != '\0') { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i) - << "'$' can only appear at the end."; - is_valid = false; - } else if (IsInSet(ch, "()[]{}|")) { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i) - << "'" << ch << "' is unsupported."; - is_valid = false; - } else if (IsRepeat(ch) && !prev_repeatable) { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i) - << "'" << ch << "' can only follow a repeatable token."; - is_valid = false; - } - - prev_repeatable = !IsInSet(ch, "^$?*+"); - } - } - - return is_valid; -} - -// Matches a repeated regex atom followed by a valid simple regular -// expression. The regex atom is defined as c if escaped is false, -// or \c otherwise. repeat is the repetition meta character (?, *, -// or +). The behavior is undefined if str contains too many -// characters to be indexable by size_t, in which case the test will -// probably time out anyway. We are fine with this limitation as -// std::string has it too. -bool MatchRepetitionAndRegexAtHead( - bool escaped, char c, char repeat, const char* regex, - const char* str) { - const size_t min_count = (repeat == '+') ? 1 : 0; - const size_t max_count = (repeat == '?') ? 1 : - static_cast(-1) - 1; - // We cannot call numeric_limits::max() as it conflicts with the - // max() macro on Windows. - - for (size_t i = 0; i <= max_count; ++i) { - // We know that the atom matches each of the first i characters in str. - if (i >= min_count && MatchRegexAtHead(regex, str + i)) { - // We have enough matches at the head, and the tail matches too. - // Since we only care about *whether* the pattern matches str - // (as opposed to *how* it matches), there is no need to find a - // greedy match. - return true; - } - if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i])) - return false; - } - return false; -} - -// Returns true if and only if regex matches a prefix of str. regex must -// be a valid simple regular expression and not start with "^", or the -// result is undefined. -bool MatchRegexAtHead(const char* regex, const char* str) { - if (*regex == '\0') // An empty regex matches a prefix of anything. - return true; - - // "$" only matches the end of a string. Note that regex being - // valid guarantees that there's nothing after "$" in it. - if (*regex == '$') - return *str == '\0'; - - // Is the first thing in regex an escape sequence? - const bool escaped = *regex == '\\'; - if (escaped) - ++regex; - if (IsRepeat(regex[1])) { - // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so - // here's an indirect recursion. It terminates as the regex gets - // shorter in each recursion. - return MatchRepetitionAndRegexAtHead( - escaped, regex[0], regex[1], regex + 2, str); - } else { - // regex isn't empty, isn't "$", and doesn't start with a - // repetition. We match the first atom of regex with the first - // character of str and recurse. - return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) && - MatchRegexAtHead(regex + 1, str + 1); - } -} - -// Returns true if and only if regex matches any substring of str. regex must -// be a valid simple regular expression, or the result is undefined. -// -// The algorithm is recursive, but the recursion depth doesn't exceed -// the regex length, so we won't need to worry about running out of -// stack space normally. In rare cases the time complexity can be -// exponential with respect to the regex length + the string length, -// but usually it's must faster (often close to linear). -bool MatchRegexAnywhere(const char* regex, const char* str) { - if (regex == nullptr || str == nullptr) return false; - - if (*regex == '^') - return MatchRegexAtHead(regex + 1, str); - - // A successful match can be anywhere in str. - do { - if (MatchRegexAtHead(regex, str)) - return true; - } while (*str++ != '\0'); - return false; -} - -// Implements the RE class. - -RE::~RE() { - free(const_cast(pattern_)); - free(const_cast(full_pattern_)); -} - -// Returns true if and only if regular expression re matches the entire str. -bool RE::FullMatch(const char* str, const RE& re) { - return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str); -} - -// Returns true if and only if regular expression re matches a substring of -// str (including str itself). -bool RE::PartialMatch(const char* str, const RE& re) { - return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str); -} - -// Initializes an RE from its string representation. -void RE::Init(const char* regex) { - pattern_ = full_pattern_ = nullptr; - if (regex != nullptr) { - pattern_ = posix::StrDup(regex); - } - - is_valid_ = ValidateRegex(regex); - if (!is_valid_) { - // No need to calculate the full pattern when the regex is invalid. - return; - } - - const size_t len = strlen(regex); - // Reserves enough bytes to hold the regular expression used for a - // full match: we need space to prepend a '^', append a '$', and - // terminate the string with '\0'. - char* buffer = static_cast(malloc(len + 3)); - full_pattern_ = buffer; - - if (*regex != '^') - *buffer++ = '^'; // Makes sure full_pattern_ starts with '^'. - - // We don't use snprintf or strncpy, as they trigger a warning when - // compiled with VC++ 8.0. - memcpy(buffer, regex, len); - buffer += len; - - if (len == 0 || regex[len - 1] != '$') - *buffer++ = '$'; // Makes sure full_pattern_ ends with '$'. - - *buffer = '\0'; -} - -#endif // GTEST_USES_POSIX_RE - -const char kUnknownFile[] = "unknown file"; - -// Formats a source file path and a line number as they would appear -// in an error message from the compiler used to compile this code. -GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) { - const std::string file_name(file == nullptr ? kUnknownFile : file); - - if (line < 0) { - return file_name + ":"; - } -#ifdef _MSC_VER - return file_name + "(" + StreamableToString(line) + "):"; -#else - return file_name + ":" + StreamableToString(line) + ":"; -#endif // _MSC_VER -} - -// Formats a file location for compiler-independent XML output. -// Although this function is not platform dependent, we put it next to -// FormatFileLocation in order to contrast the two functions. -// Note that FormatCompilerIndependentFileLocation() does NOT append colon -// to the file location it produces, unlike FormatFileLocation(). -GTEST_API_ ::std::string FormatCompilerIndependentFileLocation( - const char* file, int line) { - const std::string file_name(file == nullptr ? kUnknownFile : file); - - if (line < 0) - return file_name; - else - return file_name + ":" + StreamableToString(line); -} - -GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line) - : severity_(severity) { - const char* const marker = - severity == GTEST_INFO ? "[ INFO ]" : - severity == GTEST_WARNING ? "[WARNING]" : - severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]"; - GetStream() << ::std::endl << marker << " " - << FormatFileLocation(file, line).c_str() << ": "; -} - -// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program. -GTestLog::~GTestLog() { - GetStream() << ::std::endl; - if (severity_ == GTEST_FATAL) { - fflush(stderr); - posix::Abort(); - } -} - -// Disable Microsoft deprecation warnings for POSIX functions called from -// this class (creat, dup, dup2, and close) -GTEST_DISABLE_MSC_DEPRECATED_PUSH_() - -#if GTEST_HAS_STREAM_REDIRECTION - -// Object that captures an output stream (stdout/stderr). -class CapturedStream { - public: - // The ctor redirects the stream to a temporary file. - explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) { -# if GTEST_OS_WINDOWS - char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT - char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT - - ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path); - const UINT success = ::GetTempFileNameA(temp_dir_path, - "gtest_redir", - 0, // Generate unique file name. - temp_file_path); - GTEST_CHECK_(success != 0) - << "Unable to create a temporary file in " << temp_dir_path; - const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE); - GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file " - << temp_file_path; - filename_ = temp_file_path; -# else - // There's no guarantee that a test has write access to the current - // directory, so we create the temporary file in a temporary directory. - std::string name_template; - -# if GTEST_OS_LINUX_ANDROID - // Note: Android applications are expected to call the framework's - // Context.getExternalStorageDirectory() method through JNI to get - // the location of the world-writable SD Card directory. However, - // this requires a Context handle, which cannot be retrieved - // globally from native code. Doing so also precludes running the - // code as part of a regular standalone executable, which doesn't - // run in a Dalvik process (e.g. when running it through 'adb shell'). - // - // The location /data/local/tmp is directly accessible from native code. - // '/sdcard' and other variants cannot be relied on, as they are not - // guaranteed to be mounted, or may have a delay in mounting. - name_template = "/data/local/tmp/"; -# elif GTEST_OS_IOS - char user_temp_dir[PATH_MAX + 1]; - - // Documented alternative to NSTemporaryDirectory() (for obtaining creating - // a temporary directory) at - // https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585-SW10 - // - // _CS_DARWIN_USER_TEMP_DIR (as well as _CS_DARWIN_USER_CACHE_DIR) is not - // documented in the confstr() man page at - // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/confstr.3.html#//apple_ref/doc/man/3/confstr - // but are still available, according to the WebKit patches at - // https://trac.webkit.org/changeset/262004/webkit - // https://trac.webkit.org/changeset/263705/webkit - // - // The confstr() implementation falls back to getenv("TMPDIR"). See - // https://opensource.apple.com/source/Libc/Libc-1439.100.3/gen/confstr.c.auto.html - ::confstr(_CS_DARWIN_USER_TEMP_DIR, user_temp_dir, sizeof(user_temp_dir)); - - name_template = user_temp_dir; - if (name_template.back() != GTEST_PATH_SEP_[0]) - name_template.push_back(GTEST_PATH_SEP_[0]); -# else - name_template = "/tmp/"; -# endif - name_template.append("gtest_captured_stream.XXXXXX"); - - // mkstemp() modifies the string bytes in place, and does not go beyond the - // string's length. This results in well-defined behavior in C++17. - // - // The const_cast is needed below C++17. The constraints on std::string - // implementations in C++11 and above make assumption behind the const_cast - // fairly safe. - const int captured_fd = ::mkstemp(const_cast(name_template.data())); - if (captured_fd == -1) { - GTEST_LOG_(WARNING) - << "Failed to create tmp file " << name_template - << " for test; does the test have access to the /tmp directory?"; - } - filename_ = std::move(name_template); -# endif // GTEST_OS_WINDOWS - fflush(nullptr); - dup2(captured_fd, fd_); - close(captured_fd); - } - - ~CapturedStream() { - remove(filename_.c_str()); - } - - std::string GetCapturedString() { - if (uncaptured_fd_ != -1) { - // Restores the original stream. - fflush(nullptr); - dup2(uncaptured_fd_, fd_); - close(uncaptured_fd_); - uncaptured_fd_ = -1; - } - - FILE* const file = posix::FOpen(filename_.c_str(), "r"); - if (file == nullptr) { - GTEST_LOG_(FATAL) << "Failed to open tmp file " << filename_ - << " for capturing stream."; - } - const std::string content = ReadEntireFile(file); - posix::FClose(file); - return content; - } - - private: - const int fd_; // A stream to capture. - int uncaptured_fd_; - // Name of the temporary file holding the stderr output. - ::std::string filename_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream); -}; - -GTEST_DISABLE_MSC_DEPRECATED_POP_() - -static CapturedStream* g_captured_stderr = nullptr; -static CapturedStream* g_captured_stdout = nullptr; - -// Starts capturing an output stream (stdout/stderr). -static void CaptureStream(int fd, const char* stream_name, - CapturedStream** stream) { - if (*stream != nullptr) { - GTEST_LOG_(FATAL) << "Only one " << stream_name - << " capturer can exist at a time."; - } - *stream = new CapturedStream(fd); -} - -// Stops capturing the output stream and returns the captured string. -static std::string GetCapturedStream(CapturedStream** captured_stream) { - const std::string content = (*captured_stream)->GetCapturedString(); - - delete *captured_stream; - *captured_stream = nullptr; - - return content; -} - -// Starts capturing stdout. -void CaptureStdout() { - CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout); -} - -// Starts capturing stderr. -void CaptureStderr() { - CaptureStream(kStdErrFileno, "stderr", &g_captured_stderr); -} - -// Stops capturing stdout and returns the captured string. -std::string GetCapturedStdout() { - return GetCapturedStream(&g_captured_stdout); -} - -// Stops capturing stderr and returns the captured string. -std::string GetCapturedStderr() { - return GetCapturedStream(&g_captured_stderr); -} - -#endif // GTEST_HAS_STREAM_REDIRECTION - - - - - -size_t GetFileSize(FILE* file) { - fseek(file, 0, SEEK_END); - return static_cast(ftell(file)); -} - -std::string ReadEntireFile(FILE* file) { - const size_t file_size = GetFileSize(file); - char* const buffer = new char[file_size]; - - size_t bytes_last_read = 0; // # of bytes read in the last fread() - size_t bytes_read = 0; // # of bytes read so far - - fseek(file, 0, SEEK_SET); - - // Keeps reading the file until we cannot read further or the - // pre-determined file size is reached. - do { - bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file); - bytes_read += bytes_last_read; - } while (bytes_last_read > 0 && bytes_read < file_size); - - const std::string content(buffer, bytes_read); - delete[] buffer; - - return content; -} - -#if GTEST_HAS_DEATH_TEST -static const std::vector* g_injected_test_argvs = - nullptr; // Owned. - -std::vector GetInjectableArgvs() { - if (g_injected_test_argvs != nullptr) { - return *g_injected_test_argvs; - } - return GetArgvs(); -} - -void SetInjectableArgvs(const std::vector* new_argvs) { - if (g_injected_test_argvs != new_argvs) delete g_injected_test_argvs; - g_injected_test_argvs = new_argvs; -} - -void SetInjectableArgvs(const std::vector& new_argvs) { - SetInjectableArgvs( - new std::vector(new_argvs.begin(), new_argvs.end())); -} - -void ClearInjectableArgvs() { - delete g_injected_test_argvs; - g_injected_test_argvs = nullptr; -} -#endif // GTEST_HAS_DEATH_TEST - -#if GTEST_OS_WINDOWS_MOBILE -namespace posix { -void Abort() { - DebugBreak(); - TerminateProcess(GetCurrentProcess(), 1); -} -} // namespace posix -#endif // GTEST_OS_WINDOWS_MOBILE - -// Returns the name of the environment variable corresponding to the -// given flag. For example, FlagToEnvVar("foo") will return -// "GTEST_FOO" in the open-source version. -static std::string FlagToEnvVar(const char* flag) { - const std::string full_flag = - (Message() << GTEST_FLAG_PREFIX_ << flag).GetString(); - - Message env_var; - for (size_t i = 0; i != full_flag.length(); i++) { - env_var << ToUpper(full_flag.c_str()[i]); - } - - return env_var.GetString(); -} - -// Parses 'str' for a 32-bit signed integer. If successful, writes -// the result to *value and returns true; otherwise leaves *value -// unchanged and returns false. -bool ParseInt32(const Message& src_text, const char* str, int32_t* value) { - // Parses the environment variable as a decimal integer. - char* end = nullptr; - const long long_value = strtol(str, &end, 10); // NOLINT - - // Has strtol() consumed all characters in the string? - if (*end != '\0') { - // No - an invalid character was encountered. - Message msg; - msg << "WARNING: " << src_text - << " is expected to be a 32-bit integer, but actually" - << " has value \"" << str << "\".\n"; - printf("%s", msg.GetString().c_str()); - fflush(stdout); - return false; - } - - // Is the parsed value in the range of an int32_t? - const auto result = static_cast(long_value); - if (long_value == LONG_MAX || long_value == LONG_MIN || - // The parsed value overflows as a long. (strtol() returns - // LONG_MAX or LONG_MIN when the input overflows.) - result != long_value - // The parsed value overflows as an int32_t. - ) { - Message msg; - msg << "WARNING: " << src_text - << " is expected to be a 32-bit integer, but actually" - << " has value " << str << ", which overflows.\n"; - printf("%s", msg.GetString().c_str()); - fflush(stdout); - return false; - } - - *value = result; - return true; -} - -// Reads and returns the Boolean environment variable corresponding to -// the given flag; if it's not set, returns default_value. -// -// The value is considered true if and only if it's not "0". -bool BoolFromGTestEnv(const char* flag, bool default_value) { -#if defined(GTEST_GET_BOOL_FROM_ENV_) - return GTEST_GET_BOOL_FROM_ENV_(flag, default_value); -#else - const std::string env_var = FlagToEnvVar(flag); - const char* const string_value = posix::GetEnv(env_var.c_str()); - return string_value == nullptr ? default_value - : strcmp(string_value, "0") != 0; -#endif // defined(GTEST_GET_BOOL_FROM_ENV_) -} - -// Reads and returns a 32-bit integer stored in the environment -// variable corresponding to the given flag; if it isn't set or -// doesn't represent a valid 32-bit integer, returns default_value. -int32_t Int32FromGTestEnv(const char* flag, int32_t default_value) { -#if defined(GTEST_GET_INT32_FROM_ENV_) - return GTEST_GET_INT32_FROM_ENV_(flag, default_value); -#else - const std::string env_var = FlagToEnvVar(flag); - const char* const string_value = posix::GetEnv(env_var.c_str()); - if (string_value == nullptr) { - // The environment variable is not set. - return default_value; - } - - int32_t result = default_value; - if (!ParseInt32(Message() << "Environment variable " << env_var, - string_value, &result)) { - printf("The default value %s is used.\n", - (Message() << default_value).GetString().c_str()); - fflush(stdout); - return default_value; - } - - return result; -#endif // defined(GTEST_GET_INT32_FROM_ENV_) -} - -// As a special case for the 'output' flag, if GTEST_OUTPUT is not -// set, we look for XML_OUTPUT_FILE, which is set by the Bazel build -// system. The value of XML_OUTPUT_FILE is a filename without the -// "xml:" prefix of GTEST_OUTPUT. -// Note that this is meant to be called at the call site so it does -// not check that the flag is 'output' -// In essence this checks an env variable called XML_OUTPUT_FILE -// and if it is set we prepend "xml:" to its value, if it not set we return "" -std::string OutputFlagAlsoCheckEnvVar(){ - std::string default_value_for_output_flag = ""; - const char* xml_output_file_env = posix::GetEnv("XML_OUTPUT_FILE"); - if (nullptr != xml_output_file_env) { - default_value_for_output_flag = std::string("xml:") + xml_output_file_env; - } - return default_value_for_output_flag; -} - -// Reads and returns the string environment variable corresponding to -// the given flag; if it's not set, returns default_value. -const char* StringFromGTestEnv(const char* flag, const char* default_value) { -#if defined(GTEST_GET_STRING_FROM_ENV_) - return GTEST_GET_STRING_FROM_ENV_(flag, default_value); -#else - const std::string env_var = FlagToEnvVar(flag); - const char* const value = posix::GetEnv(env_var.c_str()); - return value == nullptr ? default_value : value; -#endif // defined(GTEST_GET_STRING_FROM_ENV_) -} - -} // namespace internal -} // namespace testing -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Test - The Google C++ Testing and Mocking Framework -// -// This file implements a universal value printer that can print a -// value of any type T: -// -// void ::testing::internal::UniversalPrinter::Print(value, ostream_ptr); -// -// It uses the << operator when possible, and prints the bytes in the -// object otherwise. A user can override its behavior for a class -// type Foo by defining either operator<<(::std::ostream&, const Foo&) -// or void PrintTo(const Foo&, ::std::ostream*) in the namespace that -// defines Foo. - - -#include - -#include -#include -#include -#include // NOLINT -#include -#include - - -namespace testing { - -namespace { - -using ::std::ostream; - -// Prints a segment of bytes in the given object. -GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ -GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ -void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start, - size_t count, ostream* os) { - char text[5] = ""; - for (size_t i = 0; i != count; i++) { - const size_t j = start + i; - if (i != 0) { - // Organizes the bytes into groups of 2 for easy parsing by - // human. - if ((j % 2) == 0) - *os << ' '; - else - *os << '-'; - } - GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]); - *os << text; - } -} - -// Prints the bytes in the given value to the given ostream. -void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count, - ostream* os) { - // Tells the user how big the object is. - *os << count << "-byte object <"; - - const size_t kThreshold = 132; - const size_t kChunkSize = 64; - // If the object size is bigger than kThreshold, we'll have to omit - // some details by printing only the first and the last kChunkSize - // bytes. - if (count < kThreshold) { - PrintByteSegmentInObjectTo(obj_bytes, 0, count, os); - } else { - PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os); - *os << " ... "; - // Rounds up to 2-byte boundary. - const size_t resume_pos = (count - kChunkSize + 1)/2*2; - PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os); - } - *os << ">"; -} - -// Helpers for widening a character to char32_t. Since the standard does not -// specify if char / wchar_t is signed or unsigned, it is important to first -// convert it to the unsigned type of the same width before widening it to -// char32_t. -template -char32_t ToChar32(CharType in) { - return static_cast( - static_cast::type>(in)); -} - -} // namespace - -namespace internal { - -// Delegates to PrintBytesInObjectToImpl() to print the bytes in the -// given object. The delegation simplifies the implementation, which -// uses the << operator and thus is easier done outside of the -// ::testing::internal namespace, which contains a << operator that -// sometimes conflicts with the one in STL. -void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count, - ostream* os) { - PrintBytesInObjectToImpl(obj_bytes, count, os); -} - -// Depending on the value of a char (or wchar_t), we print it in one -// of three formats: -// - as is if it's a printable ASCII (e.g. 'a', '2', ' '), -// - as a hexadecimal escape sequence (e.g. '\x7F'), or -// - as a special escape sequence (e.g. '\r', '\n'). -enum CharFormat { - kAsIs, - kHexEscape, - kSpecialEscape -}; - -// Returns true if c is a printable ASCII character. We test the -// value of c directly instead of calling isprint(), which is buggy on -// Windows Mobile. -inline bool IsPrintableAscii(char32_t c) { return 0x20 <= c && c <= 0x7E; } - -// Prints c (of type char, char8_t, char16_t, char32_t, or wchar_t) as a -// character literal without the quotes, escaping it when necessary; returns how -// c was formatted. -template -static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) { - const char32_t u_c = ToChar32(c); - switch (u_c) { - case L'\0': - *os << "\\0"; - break; - case L'\'': - *os << "\\'"; - break; - case L'\\': - *os << "\\\\"; - break; - case L'\a': - *os << "\\a"; - break; - case L'\b': - *os << "\\b"; - break; - case L'\f': - *os << "\\f"; - break; - case L'\n': - *os << "\\n"; - break; - case L'\r': - *os << "\\r"; - break; - case L'\t': - *os << "\\t"; - break; - case L'\v': - *os << "\\v"; - break; - default: - if (IsPrintableAscii(u_c)) { - *os << static_cast(c); - return kAsIs; - } else { - ostream::fmtflags flags = os->flags(); - *os << "\\x" << std::hex << std::uppercase << static_cast(u_c); - os->flags(flags); - return kHexEscape; - } - } - return kSpecialEscape; -} - -// Prints a char32_t c as if it's part of a string literal, escaping it when -// necessary; returns how c was formatted. -static CharFormat PrintAsStringLiteralTo(char32_t c, ostream* os) { - switch (c) { - case L'\'': - *os << "'"; - return kAsIs; - case L'"': - *os << "\\\""; - return kSpecialEscape; - default: - return PrintAsCharLiteralTo(c, os); - } -} - -static const char* GetCharWidthPrefix(char) { - return ""; -} - -static const char* GetCharWidthPrefix(signed char) { - return ""; -} - -static const char* GetCharWidthPrefix(unsigned char) { - return ""; -} - -#ifdef __cpp_char8_t -static const char* GetCharWidthPrefix(char8_t) { - return "u8"; -} -#endif - -static const char* GetCharWidthPrefix(char16_t) { - return "u"; -} - -static const char* GetCharWidthPrefix(char32_t) { - return "U"; -} - -static const char* GetCharWidthPrefix(wchar_t) { - return "L"; -} - -// Prints a char c as if it's part of a string literal, escaping it when -// necessary; returns how c was formatted. -static CharFormat PrintAsStringLiteralTo(char c, ostream* os) { - return PrintAsStringLiteralTo(ToChar32(c), os); -} - -#ifdef __cpp_char8_t -static CharFormat PrintAsStringLiteralTo(char8_t c, ostream* os) { - return PrintAsStringLiteralTo(ToChar32(c), os); -} -#endif - -static CharFormat PrintAsStringLiteralTo(char16_t c, ostream* os) { - return PrintAsStringLiteralTo(ToChar32(c), os); -} - -static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) { - return PrintAsStringLiteralTo(ToChar32(c), os); -} - -// Prints a character c (of type char, char8_t, char16_t, char32_t, or wchar_t) -// and its code. '\0' is printed as "'\\0'", other unprintable characters are -// also properly escaped using the standard C++ escape sequence. -template -void PrintCharAndCodeTo(Char c, ostream* os) { - // First, print c as a literal in the most readable form we can find. - *os << GetCharWidthPrefix(c) << "'"; - const CharFormat format = PrintAsCharLiteralTo(c, os); - *os << "'"; - - // To aid user debugging, we also print c's code in decimal, unless - // it's 0 (in which case c was printed as '\\0', making the code - // obvious). - if (c == 0) - return; - *os << " (" << static_cast(c); - - // For more convenience, we print c's code again in hexadecimal, - // unless c was already printed in the form '\x##' or the code is in - // [1, 9]. - if (format == kHexEscape || (1 <= c && c <= 9)) { - // Do nothing. - } else { - *os << ", 0x" << String::FormatHexInt(static_cast(c)); - } - *os << ")"; -} - -void PrintTo(unsigned char c, ::std::ostream* os) { PrintCharAndCodeTo(c, os); } -void PrintTo(signed char c, ::std::ostream* os) { PrintCharAndCodeTo(c, os); } - -// Prints a wchar_t as a symbol if it is printable or as its internal -// code otherwise and also as its code. L'\0' is printed as "L'\\0'". -void PrintTo(wchar_t wc, ostream* os) { PrintCharAndCodeTo(wc, os); } - -// TODO(dcheng): Consider making this delegate to PrintCharAndCodeTo() as well. -void PrintTo(char32_t c, ::std::ostream* os) { - *os << std::hex << "U+" << std::uppercase << std::setfill('0') << std::setw(4) - << static_cast(c); -} - -// Prints the given array of characters to the ostream. CharType must be either -// char, char8_t, char16_t, char32_t, or wchar_t. -// The array starts at begin, the length is len, it may include '\0' characters -// and may not be NUL-terminated. -template -GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ -GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ -static CharFormat PrintCharsAsStringTo( - const CharType* begin, size_t len, ostream* os) { - const char* const quote_prefix = GetCharWidthPrefix(*begin); - *os << quote_prefix << "\""; - bool is_previous_hex = false; - CharFormat print_format = kAsIs; - for (size_t index = 0; index < len; ++index) { - const CharType cur = begin[index]; - if (is_previous_hex && IsXDigit(cur)) { - // Previous character is of '\x..' form and this character can be - // interpreted as another hexadecimal digit in its number. Break string to - // disambiguate. - *os << "\" " << quote_prefix << "\""; - } - is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape; - // Remember if any characters required hex escaping. - if (is_previous_hex) { - print_format = kHexEscape; - } - } - *os << "\""; - return print_format; -} - -// Prints a (const) char/wchar_t array of 'len' elements, starting at address -// 'begin'. CharType must be either char or wchar_t. -template -GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ -GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ -static void UniversalPrintCharArray( - const CharType* begin, size_t len, ostream* os) { - // The code - // const char kFoo[] = "foo"; - // generates an array of 4, not 3, elements, with the last one being '\0'. - // - // Therefore when printing a char array, we don't print the last element if - // it's '\0', such that the output matches the string literal as it's - // written in the source code. - if (len > 0 && begin[len - 1] == '\0') { - PrintCharsAsStringTo(begin, len - 1, os); - return; - } - - // If, however, the last element in the array is not '\0', e.g. - // const char kFoo[] = { 'f', 'o', 'o' }; - // we must print the entire array. We also print a message to indicate - // that the array is not NUL-terminated. - PrintCharsAsStringTo(begin, len, os); - *os << " (no terminating NUL)"; -} - -// Prints a (const) char array of 'len' elements, starting at address 'begin'. -void UniversalPrintArray(const char* begin, size_t len, ostream* os) { - UniversalPrintCharArray(begin, len, os); -} - -#ifdef __cpp_char8_t -// Prints a (const) char8_t array of 'len' elements, starting at address -// 'begin'. -void UniversalPrintArray(const char8_t* begin, size_t len, ostream* os) { - UniversalPrintCharArray(begin, len, os); -} -#endif - -// Prints a (const) char16_t array of 'len' elements, starting at address -// 'begin'. -void UniversalPrintArray(const char16_t* begin, size_t len, ostream* os) { - UniversalPrintCharArray(begin, len, os); -} - -// Prints a (const) char32_t array of 'len' elements, starting at address -// 'begin'. -void UniversalPrintArray(const char32_t* begin, size_t len, ostream* os) { - UniversalPrintCharArray(begin, len, os); -} - -// Prints a (const) wchar_t array of 'len' elements, starting at address -// 'begin'. -void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) { - UniversalPrintCharArray(begin, len, os); -} - -namespace { - -// Prints a null-terminated C-style string to the ostream. -template -void PrintCStringTo(const Char* s, ostream* os) { - if (s == nullptr) { - *os << "NULL"; - } else { - *os << ImplicitCast_(s) << " pointing to "; - PrintCharsAsStringTo(s, std::char_traits::length(s), os); - } -} - -} // anonymous namespace - -void PrintTo(const char* s, ostream* os) { PrintCStringTo(s, os); } - -#ifdef __cpp_char8_t -void PrintTo(const char8_t* s, ostream* os) { PrintCStringTo(s, os); } -#endif - -void PrintTo(const char16_t* s, ostream* os) { PrintCStringTo(s, os); } - -void PrintTo(const char32_t* s, ostream* os) { PrintCStringTo(s, os); } - -// MSVC compiler can be configured to define whar_t as a typedef -// of unsigned short. Defining an overload for const wchar_t* in that case -// would cause pointers to unsigned shorts be printed as wide strings, -// possibly accessing more memory than intended and causing invalid -// memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when -// wchar_t is implemented as a native type. -#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) -// Prints the given wide C string to the ostream. -void PrintTo(const wchar_t* s, ostream* os) { PrintCStringTo(s, os); } -#endif // wchar_t is native - -namespace { - -bool ContainsUnprintableControlCodes(const char* str, size_t length) { - const unsigned char *s = reinterpret_cast(str); - - for (size_t i = 0; i < length; i++) { - unsigned char ch = *s++; - if (std::iscntrl(ch)) { - switch (ch) { - case '\t': - case '\n': - case '\r': - break; - default: - return true; - } - } - } - return false; -} - -bool IsUTF8TrailByte(unsigned char t) { return 0x80 <= t && t<= 0xbf; } - -bool IsValidUTF8(const char* str, size_t length) { - const unsigned char *s = reinterpret_cast(str); - - for (size_t i = 0; i < length;) { - unsigned char lead = s[i++]; - - if (lead <= 0x7f) { - continue; // single-byte character (ASCII) 0..7F - } - if (lead < 0xc2) { - return false; // trail byte or non-shortest form - } else if (lead <= 0xdf && (i + 1) <= length && IsUTF8TrailByte(s[i])) { - ++i; // 2-byte character - } else if (0xe0 <= lead && lead <= 0xef && (i + 2) <= length && - IsUTF8TrailByte(s[i]) && - IsUTF8TrailByte(s[i + 1]) && - // check for non-shortest form and surrogate - (lead != 0xe0 || s[i] >= 0xa0) && - (lead != 0xed || s[i] < 0xa0)) { - i += 2; // 3-byte character - } else if (0xf0 <= lead && lead <= 0xf4 && (i + 3) <= length && - IsUTF8TrailByte(s[i]) && - IsUTF8TrailByte(s[i + 1]) && - IsUTF8TrailByte(s[i + 2]) && - // check for non-shortest form - (lead != 0xf0 || s[i] >= 0x90) && - (lead != 0xf4 || s[i] < 0x90)) { - i += 3; // 4-byte character - } else { - return false; - } - } - return true; -} - -void ConditionalPrintAsText(const char* str, size_t length, ostream* os) { - if (!ContainsUnprintableControlCodes(str, length) && - IsValidUTF8(str, length)) { - *os << "\n As Text: \"" << str << "\""; - } -} - -} // anonymous namespace - -void PrintStringTo(const ::std::string& s, ostream* os) { - if (PrintCharsAsStringTo(s.data(), s.size(), os) == kHexEscape) { - if (GTEST_FLAG(print_utf8)) { - ConditionalPrintAsText(s.data(), s.size(), os); - } - } -} - -#ifdef __cpp_char8_t -void PrintU8StringTo(const ::std::u8string& s, ostream* os) { - PrintCharsAsStringTo(s.data(), s.size(), os); -} -#endif - -void PrintU16StringTo(const ::std::u16string& s, ostream* os) { - PrintCharsAsStringTo(s.data(), s.size(), os); -} - -void PrintU32StringTo(const ::std::u32string& s, ostream* os) { - PrintCharsAsStringTo(s.data(), s.size(), os); -} - -#if GTEST_HAS_STD_WSTRING -void PrintWideStringTo(const ::std::wstring& s, ostream* os) { - PrintCharsAsStringTo(s.data(), s.size(), os); -} -#endif // GTEST_HAS_STD_WSTRING - -} // namespace internal - -} // namespace testing -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// The Google C++ Testing and Mocking Framework (Google Test) - - - -namespace testing { - -using internal::GetUnitTestImpl; - -// Gets the summary of the failure message by omitting the stack trace -// in it. -std::string TestPartResult::ExtractSummary(const char* message) { - const char* const stack_trace = strstr(message, internal::kStackTraceMarker); - return stack_trace == nullptr ? message : std::string(message, stack_trace); -} - -// Prints a TestPartResult object. -std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { - return os << internal::FormatFileLocation(result.file_name(), - result.line_number()) - << " " - << (result.type() == TestPartResult::kSuccess - ? "Success" - : result.type() == TestPartResult::kSkip - ? "Skipped" - : result.type() == TestPartResult::kFatalFailure - ? "Fatal failure" - : "Non-fatal failure") - << ":\n" - << result.message() << std::endl; -} - -// Appends a TestPartResult to the array. -void TestPartResultArray::Append(const TestPartResult& result) { - array_.push_back(result); -} - -// Returns the TestPartResult at the given index (0-based). -const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const { - if (index < 0 || index >= size()) { - printf("\nInvalid index (%d) into TestPartResultArray.\n", index); - internal::posix::Abort(); - } - - return array_[static_cast(index)]; -} - -// Returns the number of TestPartResult objects in the array. -int TestPartResultArray::size() const { - return static_cast(array_.size()); -} - -namespace internal { - -HasNewFatalFailureHelper::HasNewFatalFailureHelper() - : has_new_fatal_failure_(false), - original_reporter_(GetUnitTestImpl()-> - GetTestPartResultReporterForCurrentThread()) { - GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this); -} - -HasNewFatalFailureHelper::~HasNewFatalFailureHelper() { - GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread( - original_reporter_); -} - -void HasNewFatalFailureHelper::ReportTestPartResult( - const TestPartResult& result) { - if (result.fatally_failed()) - has_new_fatal_failure_ = true; - original_reporter_->ReportTestPartResult(result); -} - -} // namespace internal - -} // namespace testing -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - -namespace testing { -namespace internal { - -// Skips to the first non-space char in str. Returns an empty string if str -// contains only whitespace characters. -static const char* SkipSpaces(const char* str) { - while (IsSpace(*str)) - str++; - return str; -} - -static std::vector SplitIntoTestNames(const char* src) { - std::vector name_vec; - src = SkipSpaces(src); - for (; src != nullptr; src = SkipComma(src)) { - name_vec.push_back(StripTrailingSpaces(GetPrefixUntilComma(src))); - } - return name_vec; -} - -// Verifies that registered_tests match the test names in -// registered_tests_; returns registered_tests if successful, or -// aborts the program otherwise. -const char* TypedTestSuitePState::VerifyRegisteredTestNames( - const char* test_suite_name, const char* file, int line, - const char* registered_tests) { - RegisterTypeParameterizedTestSuite(test_suite_name, CodeLocation(file, line)); - - typedef RegisteredTestsMap::const_iterator RegisteredTestIter; - registered_ = true; - - std::vector name_vec = SplitIntoTestNames(registered_tests); - - Message errors; - - std::set tests; - for (std::vector::const_iterator name_it = name_vec.begin(); - name_it != name_vec.end(); ++name_it) { - const std::string& name = *name_it; - if (tests.count(name) != 0) { - errors << "Test " << name << " is listed more than once.\n"; - continue; - } - - if (registered_tests_.count(name) != 0) { - tests.insert(name); - } else { - errors << "No test named " << name - << " can be found in this test suite.\n"; - } - } - - for (RegisteredTestIter it = registered_tests_.begin(); - it != registered_tests_.end(); - ++it) { - if (tests.count(it->first) == 0) { - errors << "You forgot to list test " << it->first << ".\n"; - } - } - - const std::string& errors_str = errors.GetString(); - if (errors_str != "") { - fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(), - errors_str.c_str()); - fflush(stderr); - posix::Abort(); - } - - return registered_tests; -} - -} // namespace internal -} // namespace testing -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// Google C++ Mocking Framework (Google Mock) -// -// This file #includes all Google Mock implementation .cc files. The -// purpose is to allow a user to build Google Mock by compiling this -// file alone. - -// This line ensures that gmock.h can be compiled on its own, even -// when it's fused. -#include "gmock/gmock.h" - -// The following lines pull in the real gmock *.cc files. -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements cardinalities. - - -#include -#include // NOLINT -#include -#include - -namespace testing { - -namespace { - -// Implements the Between(m, n) cardinality. -class BetweenCardinalityImpl : public CardinalityInterface { - public: - BetweenCardinalityImpl(int min, int max) - : min_(min >= 0 ? min : 0), - max_(max >= min_ ? max : min_) { - std::stringstream ss; - if (min < 0) { - ss << "The invocation lower bound must be >= 0, " - << "but is actually " << min << "."; - internal::Expect(false, __FILE__, __LINE__, ss.str()); - } else if (max < 0) { - ss << "The invocation upper bound must be >= 0, " - << "but is actually " << max << "."; - internal::Expect(false, __FILE__, __LINE__, ss.str()); - } else if (min > max) { - ss << "The invocation upper bound (" << max - << ") must be >= the invocation lower bound (" << min - << ")."; - internal::Expect(false, __FILE__, __LINE__, ss.str()); - } - } - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - int ConservativeLowerBound() const override { return min_; } - int ConservativeUpperBound() const override { return max_; } - - bool IsSatisfiedByCallCount(int call_count) const override { - return min_ <= call_count && call_count <= max_; - } - - bool IsSaturatedByCallCount(int call_count) const override { - return call_count >= max_; - } - - void DescribeTo(::std::ostream* os) const override; - - private: - const int min_; - const int max_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(BetweenCardinalityImpl); -}; - -// Formats "n times" in a human-friendly way. -inline std::string FormatTimes(int n) { - if (n == 1) { - return "once"; - } else if (n == 2) { - return "twice"; - } else { - std::stringstream ss; - ss << n << " times"; - return ss.str(); - } -} - -// Describes the Between(m, n) cardinality in human-friendly text. -void BetweenCardinalityImpl::DescribeTo(::std::ostream* os) const { - if (min_ == 0) { - if (max_ == 0) { - *os << "never called"; - } else if (max_ == INT_MAX) { - *os << "called any number of times"; - } else { - *os << "called at most " << FormatTimes(max_); - } - } else if (min_ == max_) { - *os << "called " << FormatTimes(min_); - } else if (max_ == INT_MAX) { - *os << "called at least " << FormatTimes(min_); - } else { - // 0 < min_ < max_ < INT_MAX - *os << "called between " << min_ << " and " << max_ << " times"; - } -} - -} // Unnamed namespace - -// Describes the given call count to an ostream. -void Cardinality::DescribeActualCallCountTo(int actual_call_count, - ::std::ostream* os) { - if (actual_call_count > 0) { - *os << "called " << FormatTimes(actual_call_count); - } else { - *os << "never called"; - } -} - -// Creates a cardinality that allows at least n calls. -GTEST_API_ Cardinality AtLeast(int n) { return Between(n, INT_MAX); } - -// Creates a cardinality that allows at most n calls. -GTEST_API_ Cardinality AtMost(int n) { return Between(0, n); } - -// Creates a cardinality that allows any number of calls. -GTEST_API_ Cardinality AnyNumber() { return AtLeast(0); } - -// Creates a cardinality that allows between min and max calls. -GTEST_API_ Cardinality Between(int min, int max) { - return Cardinality(new BetweenCardinalityImpl(min, max)); -} - -// Creates a cardinality that allows exactly n calls. -GTEST_API_ Cardinality Exactly(int n) { return Between(n, n); } - -} // namespace testing -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file defines some utilities useful for implementing Google -// Mock. They are subject to change without notice, so please DO NOT -// USE THEM IN USER CODE. - - -#include -#include // NOLINT -#include - -namespace testing { -namespace internal { - -// Joins a vector of strings as if they are fields of a tuple; returns -// the joined string. -GTEST_API_ std::string JoinAsTuple(const Strings& fields) { - switch (fields.size()) { - case 0: - return ""; - case 1: - return fields[0]; - default: - std::string result = "(" + fields[0]; - for (size_t i = 1; i < fields.size(); i++) { - result += ", "; - result += fields[i]; - } - result += ")"; - return result; - } -} - -// Converts an identifier name to a space-separated list of lower-case -// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is -// treated as one word. For example, both "FooBar123" and -// "foo_bar_123" are converted to "foo bar 123". -GTEST_API_ std::string ConvertIdentifierNameToWords(const char* id_name) { - std::string result; - char prev_char = '\0'; - for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) { - // We don't care about the current locale as the input is - // guaranteed to be a valid C++ identifier name. - const bool starts_new_word = IsUpper(*p) || - (!IsAlpha(prev_char) && IsLower(*p)) || - (!IsDigit(prev_char) && IsDigit(*p)); - - if (IsAlNum(*p)) { - if (starts_new_word && result != "") - result += ' '; - result += ToLower(*p); - } - } - return result; -} - -// This class reports Google Mock failures as Google Test failures. A -// user can define another class in a similar fashion if they intend to -// use Google Mock with a testing framework other than Google Test. -class GoogleTestFailureReporter : public FailureReporterInterface { - public: - void ReportFailure(FailureType type, const char* file, int line, - const std::string& message) override { - AssertHelper(type == kFatal ? - TestPartResult::kFatalFailure : - TestPartResult::kNonFatalFailure, - file, - line, - message.c_str()) = Message(); - if (type == kFatal) { - posix::Abort(); - } - } -}; - -// Returns the global failure reporter. Will create a -// GoogleTestFailureReporter and return it the first time called. -GTEST_API_ FailureReporterInterface* GetFailureReporter() { - // Points to the global failure reporter used by Google Mock. gcc - // guarantees that the following use of failure_reporter is - // thread-safe. We may need to add additional synchronization to - // protect failure_reporter if we port Google Mock to other - // compilers. - static FailureReporterInterface* const failure_reporter = - new GoogleTestFailureReporter(); - return failure_reporter; -} - -// Protects global resources (stdout in particular) used by Log(). -static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex); - -// Returns true if and only if a log with the given severity is visible -// according to the --gmock_verbose flag. -GTEST_API_ bool LogIsVisible(LogSeverity severity) { - if (GMOCK_FLAG(verbose) == kInfoVerbosity) { - // Always show the log if --gmock_verbose=info. - return true; - } else if (GMOCK_FLAG(verbose) == kErrorVerbosity) { - // Always hide it if --gmock_verbose=error. - return false; - } else { - // If --gmock_verbose is neither "info" nor "error", we treat it - // as "warning" (its default value). - return severity == kWarning; - } -} - -// Prints the given message to stdout if and only if 'severity' >= the level -// specified by the --gmock_verbose flag. If stack_frames_to_skip >= -// 0, also prints the stack trace excluding the top -// stack_frames_to_skip frames. In opt mode, any positive -// stack_frames_to_skip is treated as 0, since we don't know which -// function calls will be inlined by the compiler and need to be -// conservative. -GTEST_API_ void Log(LogSeverity severity, const std::string& message, - int stack_frames_to_skip) { - if (!LogIsVisible(severity)) - return; - - // Ensures that logs from different threads don't interleave. - MutexLock l(&g_log_mutex); - - if (severity == kWarning) { - // Prints a GMOCK WARNING marker to make the warnings easily searchable. - std::cout << "\nGMOCK WARNING:"; - } - // Pre-pends a new-line to message if it doesn't start with one. - if (message.empty() || message[0] != '\n') { - std::cout << "\n"; - } - std::cout << message; - if (stack_frames_to_skip >= 0) { -#ifdef NDEBUG - // In opt mode, we have to be conservative and skip no stack frame. - const int actual_to_skip = 0; -#else - // In dbg mode, we can do what the caller tell us to do (plus one - // for skipping this function's stack frame). - const int actual_to_skip = stack_frames_to_skip + 1; -#endif // NDEBUG - - // Appends a new-line to message if it doesn't end with one. - if (!message.empty() && *message.rbegin() != '\n') { - std::cout << "\n"; - } - std::cout << "Stack trace:\n" - << ::testing::internal::GetCurrentOsStackTraceExceptTop( - ::testing::UnitTest::GetInstance(), actual_to_skip); - } - std::cout << ::std::flush; -} - -GTEST_API_ WithoutMatchers GetWithoutMatchers() { return WithoutMatchers(); } - -GTEST_API_ void IllegalDoDefault(const char* file, int line) { - internal::Assert( - false, file, line, - "You are using DoDefault() inside a composite action like " - "DoAll() or WithArgs(). This is not supported for technical " - "reasons. Please instead spell out the default action, or " - "assign the default action to an Action variable and use " - "the variable in various places."); -} - -} // namespace internal -} // namespace testing -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements Matcher, Matcher, and -// utilities for defining matchers. - - -#include -#include -#include -#include - -namespace testing { -namespace internal { - -// Returns the description for a matcher defined using the MATCHER*() -// macro where the user-supplied description string is "", if -// 'negation' is false; otherwise returns the description of the -// negation of the matcher. 'param_values' contains a list of strings -// that are the print-out of the matcher's parameters. -GTEST_API_ std::string FormatMatcherDescription(bool negation, - const char* matcher_name, - const Strings& param_values) { - std::string result = ConvertIdentifierNameToWords(matcher_name); - if (param_values.size() >= 1) result += " " + JoinAsTuple(param_values); - return negation ? "not (" + result + ")" : result; -} - -// FindMaxBipartiteMatching and its helper class. -// -// Uses the well-known Ford-Fulkerson max flow method to find a maximum -// bipartite matching. Flow is considered to be from left to right. -// There is an implicit source node that is connected to all of the left -// nodes, and an implicit sink node that is connected to all of the -// right nodes. All edges have unit capacity. -// -// Neither the flow graph nor the residual flow graph are represented -// explicitly. Instead, they are implied by the information in 'graph' and -// a vector called 'left_' whose elements are initialized to the -// value kUnused. This represents the initial state of the algorithm, -// where the flow graph is empty, and the residual flow graph has the -// following edges: -// - An edge from source to each left_ node -// - An edge from each right_ node to sink -// - An edge from each left_ node to each right_ node, if the -// corresponding edge exists in 'graph'. -// -// When the TryAugment() method adds a flow, it sets left_[l] = r for some -// nodes l and r. This induces the following changes: -// - The edges (source, l), (l, r), and (r, sink) are added to the -// flow graph. -// - The same three edges are removed from the residual flow graph. -// - The reverse edges (l, source), (r, l), and (sink, r) are added -// to the residual flow graph, which is a directional graph -// representing unused flow capacity. -// -// When the method augments a flow (moving left_[l] from some r1 to some -// other r2), this can be thought of as "undoing" the above steps with -// respect to r1 and "redoing" them with respect to r2. -// -// It bears repeating that the flow graph and residual flow graph are -// never represented explicitly, but can be derived by looking at the -// information in 'graph' and in left_. -// -// As an optimization, there is a second vector called right_ which -// does not provide any new information. Instead, it enables more -// efficient queries about edges entering or leaving the right-side nodes -// of the flow or residual flow graphs. The following invariants are -// maintained: -// -// left[l] == kUnused or right[left[l]] == l -// right[r] == kUnused or left[right[r]] == r -// -// . [ source ] . -// . ||| . -// . ||| . -// . ||\--> left[0]=1 ---\ right[0]=-1 ----\ . -// . || | | . -// . |\---> left[1]=-1 \--> right[1]=0 ---\| . -// . | || . -// . \----> left[2]=2 ------> right[2]=2 --\|| . -// . ||| . -// . elements matchers vvv . -// . [ sink ] . -// -// See Also: -// [1] Cormen, et al (2001). "Section 26.2: The Ford-Fulkerson method". -// "Introduction to Algorithms (Second ed.)", pp. 651-664. -// [2] "Ford-Fulkerson algorithm", Wikipedia, -// 'http://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm' -class MaxBipartiteMatchState { - public: - explicit MaxBipartiteMatchState(const MatchMatrix& graph) - : graph_(&graph), - left_(graph_->LhsSize(), kUnused), - right_(graph_->RhsSize(), kUnused) {} - - // Returns the edges of a maximal match, each in the form {left, right}. - ElementMatcherPairs Compute() { - // 'seen' is used for path finding { 0: unseen, 1: seen }. - ::std::vector seen; - // Searches the residual flow graph for a path from each left node to - // the sink in the residual flow graph, and if one is found, add flow - // to the graph. It's okay to search through the left nodes once. The - // edge from the implicit source node to each previously-visited left - // node will have flow if that left node has any path to the sink - // whatsoever. Subsequent augmentations can only add flow to the - // network, and cannot take away that previous flow unit from the source. - // Since the source-to-left edge can only carry one flow unit (or, - // each element can be matched to only one matcher), there is no need - // to visit the left nodes more than once looking for augmented paths. - // The flow is known to be possible or impossible by looking at the - // node once. - for (size_t ilhs = 0; ilhs < graph_->LhsSize(); ++ilhs) { - // Reset the path-marking vector and try to find a path from - // source to sink starting at the left_[ilhs] node. - GTEST_CHECK_(left_[ilhs] == kUnused) - << "ilhs: " << ilhs << ", left_[ilhs]: " << left_[ilhs]; - // 'seen' initialized to 'graph_->RhsSize()' copies of 0. - seen.assign(graph_->RhsSize(), 0); - TryAugment(ilhs, &seen); - } - ElementMatcherPairs result; - for (size_t ilhs = 0; ilhs < left_.size(); ++ilhs) { - size_t irhs = left_[ilhs]; - if (irhs == kUnused) continue; - result.push_back(ElementMatcherPair(ilhs, irhs)); - } - return result; - } - - private: - static const size_t kUnused = static_cast(-1); - - // Perform a depth-first search from left node ilhs to the sink. If a - // path is found, flow is added to the network by linking the left and - // right vector elements corresponding each segment of the path. - // Returns true if a path to sink was found, which means that a unit of - // flow was added to the network. The 'seen' vector elements correspond - // to right nodes and are marked to eliminate cycles from the search. - // - // Left nodes will only be explored at most once because they - // are accessible from at most one right node in the residual flow - // graph. - // - // Note that left_[ilhs] is the only element of left_ that TryAugment will - // potentially transition from kUnused to another value. Any other - // left_ element holding kUnused before TryAugment will be holding it - // when TryAugment returns. - // - bool TryAugment(size_t ilhs, ::std::vector* seen) { - for (size_t irhs = 0; irhs < graph_->RhsSize(); ++irhs) { - if ((*seen)[irhs]) continue; - if (!graph_->HasEdge(ilhs, irhs)) continue; - // There's an available edge from ilhs to irhs. - (*seen)[irhs] = 1; - // Next a search is performed to determine whether - // this edge is a dead end or leads to the sink. - // - // right_[irhs] == kUnused means that there is residual flow from - // right node irhs to the sink, so we can use that to finish this - // flow path and return success. - // - // Otherwise there is residual flow to some ilhs. We push flow - // along that path and call ourselves recursively to see if this - // ultimately leads to sink. - if (right_[irhs] == kUnused || TryAugment(right_[irhs], seen)) { - // Add flow from left_[ilhs] to right_[irhs]. - left_[ilhs] = irhs; - right_[irhs] = ilhs; - return true; - } - } - return false; - } - - const MatchMatrix* graph_; // not owned - // Each element of the left_ vector represents a left hand side node - // (i.e. an element) and each element of right_ is a right hand side - // node (i.e. a matcher). The values in the left_ vector indicate - // outflow from that node to a node on the right_ side. The values - // in the right_ indicate inflow, and specify which left_ node is - // feeding that right_ node, if any. For example, left_[3] == 1 means - // there's a flow from element #3 to matcher #1. Such a flow would also - // be redundantly represented in the right_ vector as right_[1] == 3. - // Elements of left_ and right_ are either kUnused or mutually - // referent. Mutually referent means that left_[right_[i]] = i and - // right_[left_[i]] = i. - ::std::vector left_; - ::std::vector right_; -}; - -const size_t MaxBipartiteMatchState::kUnused; - -GTEST_API_ ElementMatcherPairs FindMaxBipartiteMatching(const MatchMatrix& g) { - return MaxBipartiteMatchState(g).Compute(); -} - -static void LogElementMatcherPairVec(const ElementMatcherPairs& pairs, - ::std::ostream* stream) { - typedef ElementMatcherPairs::const_iterator Iter; - ::std::ostream& os = *stream; - os << "{"; - const char* sep = ""; - for (Iter it = pairs.begin(); it != pairs.end(); ++it) { - os << sep << "\n (" - << "element #" << it->first << ", " - << "matcher #" << it->second << ")"; - sep = ","; - } - os << "\n}"; -} - -bool MatchMatrix::NextGraph() { - for (size_t ilhs = 0; ilhs < LhsSize(); ++ilhs) { - for (size_t irhs = 0; irhs < RhsSize(); ++irhs) { - char& b = matched_[SpaceIndex(ilhs, irhs)]; - if (!b) { - b = 1; - return true; - } - b = 0; - } - } - return false; -} - -void MatchMatrix::Randomize() { - for (size_t ilhs = 0; ilhs < LhsSize(); ++ilhs) { - for (size_t irhs = 0; irhs < RhsSize(); ++irhs) { - char& b = matched_[SpaceIndex(ilhs, irhs)]; - b = static_cast(rand() & 1); // NOLINT - } - } -} - -std::string MatchMatrix::DebugString() const { - ::std::stringstream ss; - const char* sep = ""; - for (size_t i = 0; i < LhsSize(); ++i) { - ss << sep; - for (size_t j = 0; j < RhsSize(); ++j) { - ss << HasEdge(i, j); - } - sep = ";"; - } - return ss.str(); -} - -void UnorderedElementsAreMatcherImplBase::DescribeToImpl( - ::std::ostream* os) const { - switch (match_flags()) { - case UnorderedMatcherRequire::ExactMatch: - if (matcher_describers_.empty()) { - *os << "is empty"; - return; - } - if (matcher_describers_.size() == 1) { - *os << "has " << Elements(1) << " and that element "; - matcher_describers_[0]->DescribeTo(os); - return; - } - *os << "has " << Elements(matcher_describers_.size()) - << " and there exists some permutation of elements such that:\n"; - break; - case UnorderedMatcherRequire::Superset: - *os << "a surjection from elements to requirements exists such that:\n"; - break; - case UnorderedMatcherRequire::Subset: - *os << "an injection from elements to requirements exists such that:\n"; - break; - } - - const char* sep = ""; - for (size_t i = 0; i != matcher_describers_.size(); ++i) { - *os << sep; - if (match_flags() == UnorderedMatcherRequire::ExactMatch) { - *os << " - element #" << i << " "; - } else { - *os << " - an element "; - } - matcher_describers_[i]->DescribeTo(os); - if (match_flags() == UnorderedMatcherRequire::ExactMatch) { - sep = ", and\n"; - } else { - sep = "\n"; - } - } -} - -void UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl( - ::std::ostream* os) const { - switch (match_flags()) { - case UnorderedMatcherRequire::ExactMatch: - if (matcher_describers_.empty()) { - *os << "isn't empty"; - return; - } - if (matcher_describers_.size() == 1) { - *os << "doesn't have " << Elements(1) << ", or has " << Elements(1) - << " that "; - matcher_describers_[0]->DescribeNegationTo(os); - return; - } - *os << "doesn't have " << Elements(matcher_describers_.size()) - << ", or there exists no permutation of elements such that:\n"; - break; - case UnorderedMatcherRequire::Superset: - *os << "no surjection from elements to requirements exists such that:\n"; - break; - case UnorderedMatcherRequire::Subset: - *os << "no injection from elements to requirements exists such that:\n"; - break; - } - const char* sep = ""; - for (size_t i = 0; i != matcher_describers_.size(); ++i) { - *os << sep; - if (match_flags() == UnorderedMatcherRequire::ExactMatch) { - *os << " - element #" << i << " "; - } else { - *os << " - an element "; - } - matcher_describers_[i]->DescribeTo(os); - if (match_flags() == UnorderedMatcherRequire::ExactMatch) { - sep = ", and\n"; - } else { - sep = "\n"; - } - } -} - -// Checks that all matchers match at least one element, and that all -// elements match at least one matcher. This enables faster matching -// and better error reporting. -// Returns false, writing an explanation to 'listener', if and only -// if the success criteria are not met. -bool UnorderedElementsAreMatcherImplBase::VerifyMatchMatrix( - const ::std::vector& element_printouts, - const MatchMatrix& matrix, MatchResultListener* listener) const { - bool result = true; - ::std::vector element_matched(matrix.LhsSize(), 0); - ::std::vector matcher_matched(matrix.RhsSize(), 0); - - for (size_t ilhs = 0; ilhs < matrix.LhsSize(); ilhs++) { - for (size_t irhs = 0; irhs < matrix.RhsSize(); irhs++) { - char matched = matrix.HasEdge(ilhs, irhs); - element_matched[ilhs] |= matched; - matcher_matched[irhs] |= matched; - } - } - - if (match_flags() & UnorderedMatcherRequire::Superset) { - const char* sep = - "where the following matchers don't match any elements:\n"; - for (size_t mi = 0; mi < matcher_matched.size(); ++mi) { - if (matcher_matched[mi]) continue; - result = false; - if (listener->IsInterested()) { - *listener << sep << "matcher #" << mi << ": "; - matcher_describers_[mi]->DescribeTo(listener->stream()); - sep = ",\n"; - } - } - } - - if (match_flags() & UnorderedMatcherRequire::Subset) { - const char* sep = - "where the following elements don't match any matchers:\n"; - const char* outer_sep = ""; - if (!result) { - outer_sep = "\nand "; - } - for (size_t ei = 0; ei < element_matched.size(); ++ei) { - if (element_matched[ei]) continue; - result = false; - if (listener->IsInterested()) { - *listener << outer_sep << sep << "element #" << ei << ": " - << element_printouts[ei]; - sep = ",\n"; - outer_sep = ""; - } - } - } - return result; -} - -bool UnorderedElementsAreMatcherImplBase::FindPairing( - const MatchMatrix& matrix, MatchResultListener* listener) const { - ElementMatcherPairs matches = FindMaxBipartiteMatching(matrix); - - size_t max_flow = matches.size(); - if ((match_flags() & UnorderedMatcherRequire::Superset) && - max_flow < matrix.RhsSize()) { - if (listener->IsInterested()) { - *listener << "where no permutation of the elements can satisfy all " - "matchers, and the closest match is " - << max_flow << " of " << matrix.RhsSize() - << " matchers with the pairings:\n"; - LogElementMatcherPairVec(matches, listener->stream()); - } - return false; - } - if ((match_flags() & UnorderedMatcherRequire::Subset) && - max_flow < matrix.LhsSize()) { - if (listener->IsInterested()) { - *listener - << "where not all elements can be matched, and the closest match is " - << max_flow << " of " << matrix.RhsSize() - << " matchers with the pairings:\n"; - LogElementMatcherPairVec(matches, listener->stream()); - } - return false; - } - - if (matches.size() > 1) { - if (listener->IsInterested()) { - const char* sep = "where:\n"; - for (size_t mi = 0; mi < matches.size(); ++mi) { - *listener << sep << " - element #" << matches[mi].first - << " is matched by matcher #" << matches[mi].second; - sep = ",\n"; - } - } - } - return true; -} - -} // namespace internal -} // namespace testing -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements the spec builder syntax (ON_CALL and -// EXPECT_CALL). - - -#include - -#include // NOLINT -#include -#include -#include -#include -#include - - -#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC -# include // NOLINT -#endif - -// Silence C4800 (C4800: 'int *const ': forcing value -// to bool 'true' or 'false') for MSVC 15 -#ifdef _MSC_VER -#if _MSC_VER == 1900 -# pragma warning(push) -# pragma warning(disable:4800) -#endif -#endif - -namespace testing { -namespace internal { - -// Protects the mock object registry (in class Mock), all function -// mockers, and all expectations. -GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_gmock_mutex); - -// Logs a message including file and line number information. -GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, - const char* file, int line, - const std::string& message) { - ::std::ostringstream s; - s << internal::FormatFileLocation(file, line) << " " << message - << ::std::endl; - Log(severity, s.str(), 0); -} - -// Constructs an ExpectationBase object. -ExpectationBase::ExpectationBase(const char* a_file, int a_line, - const std::string& a_source_text) - : file_(a_file), - line_(a_line), - source_text_(a_source_text), - cardinality_specified_(false), - cardinality_(Exactly(1)), - call_count_(0), - retired_(false), - extra_matcher_specified_(false), - repeated_action_specified_(false), - retires_on_saturation_(false), - last_clause_(kNone), - action_count_checked_(false) {} - -// Destructs an ExpectationBase object. -ExpectationBase::~ExpectationBase() {} - -// Explicitly specifies the cardinality of this expectation. Used by -// the subclasses to implement the .Times() clause. -void ExpectationBase::SpecifyCardinality(const Cardinality& a_cardinality) { - cardinality_specified_ = true; - cardinality_ = a_cardinality; -} - -// Retires all pre-requisites of this expectation. -void ExpectationBase::RetireAllPreRequisites() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - if (is_retired()) { - // We can take this short-cut as we never retire an expectation - // until we have retired all its pre-requisites. - return; - } - - ::std::vector expectations(1, this); - while (!expectations.empty()) { - ExpectationBase* exp = expectations.back(); - expectations.pop_back(); - - for (ExpectationSet::const_iterator it = - exp->immediate_prerequisites_.begin(); - it != exp->immediate_prerequisites_.end(); ++it) { - ExpectationBase* next = it->expectation_base().get(); - if (!next->is_retired()) { - next->Retire(); - expectations.push_back(next); - } - } - } -} - -// Returns true if and only if all pre-requisites of this expectation -// have been satisfied. -bool ExpectationBase::AllPrerequisitesAreSatisfied() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - ::std::vector expectations(1, this); - while (!expectations.empty()) { - const ExpectationBase* exp = expectations.back(); - expectations.pop_back(); - - for (ExpectationSet::const_iterator it = - exp->immediate_prerequisites_.begin(); - it != exp->immediate_prerequisites_.end(); ++it) { - const ExpectationBase* next = it->expectation_base().get(); - if (!next->IsSatisfied()) return false; - expectations.push_back(next); - } - } - return true; -} - -// Adds unsatisfied pre-requisites of this expectation to 'result'. -void ExpectationBase::FindUnsatisfiedPrerequisites(ExpectationSet* result) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - ::std::vector expectations(1, this); - while (!expectations.empty()) { - const ExpectationBase* exp = expectations.back(); - expectations.pop_back(); - - for (ExpectationSet::const_iterator it = - exp->immediate_prerequisites_.begin(); - it != exp->immediate_prerequisites_.end(); ++it) { - const ExpectationBase* next = it->expectation_base().get(); - - if (next->IsSatisfied()) { - // If *it is satisfied and has a call count of 0, some of its - // pre-requisites may not be satisfied yet. - if (next->call_count_ == 0) { - expectations.push_back(next); - } - } else { - // Now that we know next is unsatisfied, we are not so interested - // in whether its pre-requisites are satisfied. Therefore we - // don't iterate into it here. - *result += *it; - } - } - } -} - -// Describes how many times a function call matching this -// expectation has occurred. -void ExpectationBase::DescribeCallCountTo(::std::ostream* os) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - - // Describes how many times the function is expected to be called. - *os << " Expected: to be "; - cardinality().DescribeTo(os); - *os << "\n Actual: "; - Cardinality::DescribeActualCallCountTo(call_count(), os); - - // Describes the state of the expectation (e.g. is it satisfied? - // is it active?). - *os << " - " << (IsOverSaturated() ? "over-saturated" : - IsSaturated() ? "saturated" : - IsSatisfied() ? "satisfied" : "unsatisfied") - << " and " - << (is_retired() ? "retired" : "active"); -} - -// Checks the action count (i.e. the number of WillOnce() and -// WillRepeatedly() clauses) against the cardinality if this hasn't -// been done before. Prints a warning if there are too many or too -// few actions. -void ExpectationBase::CheckActionCountIfNotDone() const - GTEST_LOCK_EXCLUDED_(mutex_) { - bool should_check = false; - { - MutexLock l(&mutex_); - if (!action_count_checked_) { - action_count_checked_ = true; - should_check = true; - } - } - - if (should_check) { - if (!cardinality_specified_) { - // The cardinality was inferred - no need to check the action - // count against it. - return; - } - - // The cardinality was explicitly specified. - const int action_count = static_cast(untyped_actions_.size()); - const int upper_bound = cardinality().ConservativeUpperBound(); - const int lower_bound = cardinality().ConservativeLowerBound(); - bool too_many; // True if there are too many actions, or false - // if there are too few. - if (action_count > upper_bound || - (action_count == upper_bound && repeated_action_specified_)) { - too_many = true; - } else if (0 < action_count && action_count < lower_bound && - !repeated_action_specified_) { - too_many = false; - } else { - return; - } - - ::std::stringstream ss; - DescribeLocationTo(&ss); - ss << "Too " << (too_many ? "many" : "few") - << " actions specified in " << source_text() << "...\n" - << "Expected to be "; - cardinality().DescribeTo(&ss); - ss << ", but has " << (too_many ? "" : "only ") - << action_count << " WillOnce()" - << (action_count == 1 ? "" : "s"); - if (repeated_action_specified_) { - ss << " and a WillRepeatedly()"; - } - ss << "."; - Log(kWarning, ss.str(), -1); // -1 means "don't print stack trace". - } -} - -// Implements the .Times() clause. -void ExpectationBase::UntypedTimes(const Cardinality& a_cardinality) { - if (last_clause_ == kTimes) { - ExpectSpecProperty(false, - ".Times() cannot appear " - "more than once in an EXPECT_CALL()."); - } else { - ExpectSpecProperty(last_clause_ < kTimes, - ".Times() cannot appear after " - ".InSequence(), .WillOnce(), .WillRepeatedly(), " - "or .RetiresOnSaturation()."); - } - last_clause_ = kTimes; - - SpecifyCardinality(a_cardinality); -} - -// Points to the implicit sequence introduced by a living InSequence -// object (if any) in the current thread or NULL. -GTEST_API_ ThreadLocal g_gmock_implicit_sequence; - -// Reports an uninteresting call (whose description is in msg) in the -// manner specified by 'reaction'. -void ReportUninterestingCall(CallReaction reaction, const std::string& msg) { - // Include a stack trace only if --gmock_verbose=info is specified. - const int stack_frames_to_skip = - GMOCK_FLAG(verbose) == kInfoVerbosity ? 3 : -1; - switch (reaction) { - case kAllow: - Log(kInfo, msg, stack_frames_to_skip); - break; - case kWarn: - Log(kWarning, - msg + - "\nNOTE: You can safely ignore the above warning unless this " - "call should not happen. Do not suppress it by blindly adding " - "an EXPECT_CALL() if you don't mean to enforce the call. " - "See " - "https://github.com/google/googletest/blob/master/docs/" - "gmock_cook_book.md#" - "knowing-when-to-expect for details.\n", - stack_frames_to_skip); - break; - default: // FAIL - Expect(false, nullptr, -1, msg); - } -} - -UntypedFunctionMockerBase::UntypedFunctionMockerBase() - : mock_obj_(nullptr), name_("") {} - -UntypedFunctionMockerBase::~UntypedFunctionMockerBase() {} - -// Sets the mock object this mock method belongs to, and registers -// this information in the global mock registry. Will be called -// whenever an EXPECT_CALL() or ON_CALL() is executed on this mock -// method. -void UntypedFunctionMockerBase::RegisterOwner(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - { - MutexLock l(&g_gmock_mutex); - mock_obj_ = mock_obj; - } - Mock::Register(mock_obj, this); -} - -// Sets the mock object this mock method belongs to, and sets the name -// of the mock function. Will be called upon each invocation of this -// mock function. -void UntypedFunctionMockerBase::SetOwnerAndName(const void* mock_obj, - const char* name) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - // We protect name_ under g_gmock_mutex in case this mock function - // is called from two threads concurrently. - MutexLock l(&g_gmock_mutex); - mock_obj_ = mock_obj; - name_ = name; -} - -// Returns the name of the function being mocked. Must be called -// after RegisterOwner() or SetOwnerAndName() has been called. -const void* UntypedFunctionMockerBase::MockObject() const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - const void* mock_obj; - { - // We protect mock_obj_ under g_gmock_mutex in case this mock - // function is called from two threads concurrently. - MutexLock l(&g_gmock_mutex); - Assert(mock_obj_ != nullptr, __FILE__, __LINE__, - "MockObject() must not be called before RegisterOwner() or " - "SetOwnerAndName() has been called."); - mock_obj = mock_obj_; - } - return mock_obj; -} - -// Returns the name of this mock method. Must be called after -// SetOwnerAndName() has been called. -const char* UntypedFunctionMockerBase::Name() const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - const char* name; - { - // We protect name_ under g_gmock_mutex in case this mock - // function is called from two threads concurrently. - MutexLock l(&g_gmock_mutex); - Assert(name_ != nullptr, __FILE__, __LINE__, - "Name() must not be called before SetOwnerAndName() has " - "been called."); - name = name_; - } - return name; -} - -// Calculates the result of invoking this mock function with the given -// arguments, prints it, and returns it. The caller is responsible -// for deleting the result. -UntypedActionResultHolderBase* UntypedFunctionMockerBase::UntypedInvokeWith( - void* const untyped_args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - // See the definition of untyped_expectations_ for why access to it - // is unprotected here. - if (untyped_expectations_.size() == 0) { - // No expectation is set on this mock method - we have an - // uninteresting call. - - // We must get Google Mock's reaction on uninteresting calls - // made on this mock object BEFORE performing the action, - // because the action may DELETE the mock object and make the - // following expression meaningless. - const CallReaction reaction = - Mock::GetReactionOnUninterestingCalls(MockObject()); - - // True if and only if we need to print this call's arguments and return - // value. This definition must be kept in sync with - // the behavior of ReportUninterestingCall(). - const bool need_to_report_uninteresting_call = - // If the user allows this uninteresting call, we print it - // only when they want informational messages. - reaction == kAllow ? LogIsVisible(kInfo) : - // If the user wants this to be a warning, we print - // it only when they want to see warnings. - reaction == kWarn - ? LogIsVisible(kWarning) - : - // Otherwise, the user wants this to be an error, and we - // should always print detailed information in the error. - true; - - if (!need_to_report_uninteresting_call) { - // Perform the action without printing the call information. - return this->UntypedPerformDefaultAction( - untyped_args, "Function call: " + std::string(Name())); - } - - // Warns about the uninteresting call. - ::std::stringstream ss; - this->UntypedDescribeUninterestingCall(untyped_args, &ss); - - // Calculates the function result. - UntypedActionResultHolderBase* const result = - this->UntypedPerformDefaultAction(untyped_args, ss.str()); - - // Prints the function result. - if (result != nullptr) result->PrintAsActionResult(&ss); - - ReportUninterestingCall(reaction, ss.str()); - return result; - } - - bool is_excessive = false; - ::std::stringstream ss; - ::std::stringstream why; - ::std::stringstream loc; - const void* untyped_action = nullptr; - - // The UntypedFindMatchingExpectation() function acquires and - // releases g_gmock_mutex. - - const ExpectationBase* const untyped_expectation = - this->UntypedFindMatchingExpectation(untyped_args, &untyped_action, - &is_excessive, &ss, &why); - const bool found = untyped_expectation != nullptr; - - // True if and only if we need to print the call's arguments - // and return value. - // This definition must be kept in sync with the uses of Expect() - // and Log() in this function. - const bool need_to_report_call = - !found || is_excessive || LogIsVisible(kInfo); - if (!need_to_report_call) { - // Perform the action without printing the call information. - return untyped_action == nullptr - ? this->UntypedPerformDefaultAction(untyped_args, "") - : this->UntypedPerformAction(untyped_action, untyped_args); - } - - ss << " Function call: " << Name(); - this->UntypedPrintArgs(untyped_args, &ss); - - // In case the action deletes a piece of the expectation, we - // generate the message beforehand. - if (found && !is_excessive) { - untyped_expectation->DescribeLocationTo(&loc); - } - - UntypedActionResultHolderBase* result = nullptr; - - auto perform_action = [&] { - return untyped_action == nullptr - ? this->UntypedPerformDefaultAction(untyped_args, ss.str()) - : this->UntypedPerformAction(untyped_action, untyped_args); - }; - auto handle_failures = [&] { - ss << "\n" << why.str(); - - if (!found) { - // No expectation matches this call - reports a failure. - Expect(false, nullptr, -1, ss.str()); - } else if (is_excessive) { - // We had an upper-bound violation and the failure message is in ss. - Expect(false, untyped_expectation->file(), untyped_expectation->line(), - ss.str()); - } else { - // We had an expected call and the matching expectation is - // described in ss. - Log(kInfo, loc.str() + ss.str(), 2); - } - }; -#if GTEST_HAS_EXCEPTIONS - try { - result = perform_action(); - } catch (...) { - handle_failures(); - throw; - } -#else - result = perform_action(); -#endif - - if (result != nullptr) result->PrintAsActionResult(&ss); - handle_failures(); - return result; -} - -// Returns an Expectation object that references and co-owns exp, -// which must be an expectation on this mock function. -Expectation UntypedFunctionMockerBase::GetHandleOf(ExpectationBase* exp) { - // See the definition of untyped_expectations_ for why access to it - // is unprotected here. - for (UntypedExpectations::const_iterator it = - untyped_expectations_.begin(); - it != untyped_expectations_.end(); ++it) { - if (it->get() == exp) { - return Expectation(*it); - } - } - - Assert(false, __FILE__, __LINE__, "Cannot find expectation."); - return Expectation(); - // The above statement is just to make the code compile, and will - // never be executed. -} - -// Verifies that all expectations on this mock function have been -// satisfied. Reports one or more Google Test non-fatal failures -// and returns false if not. -bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - bool expectations_met = true; - for (UntypedExpectations::const_iterator it = - untyped_expectations_.begin(); - it != untyped_expectations_.end(); ++it) { - ExpectationBase* const untyped_expectation = it->get(); - if (untyped_expectation->IsOverSaturated()) { - // There was an upper-bound violation. Since the error was - // already reported when it occurred, there is no need to do - // anything here. - expectations_met = false; - } else if (!untyped_expectation->IsSatisfied()) { - expectations_met = false; - ::std::stringstream ss; - ss << "Actual function call count doesn't match " - << untyped_expectation->source_text() << "...\n"; - // No need to show the source file location of the expectation - // in the description, as the Expect() call that follows already - // takes care of it. - untyped_expectation->MaybeDescribeExtraMatcherTo(&ss); - untyped_expectation->DescribeCallCountTo(&ss); - Expect(false, untyped_expectation->file(), - untyped_expectation->line(), ss.str()); - } - } - - // Deleting our expectations may trigger other mock objects to be deleted, for - // example if an action contains a reference counted smart pointer to that - // mock object, and that is the last reference. So if we delete our - // expectations within the context of the global mutex we may deadlock when - // this method is called again. Instead, make a copy of the set of - // expectations to delete, clear our set within the mutex, and then clear the - // copied set outside of it. - UntypedExpectations expectations_to_delete; - untyped_expectations_.swap(expectations_to_delete); - - g_gmock_mutex.Unlock(); - expectations_to_delete.clear(); - g_gmock_mutex.Lock(); - - return expectations_met; -} - -CallReaction intToCallReaction(int mock_behavior) { - if (mock_behavior >= kAllow && mock_behavior <= kFail) { - return static_cast(mock_behavior); - } - return kWarn; -} - -} // namespace internal - -// Class Mock. - -namespace { - -typedef std::set FunctionMockers; - -// The current state of a mock object. Such information is needed for -// detecting leaked mock objects and explicitly verifying a mock's -// expectations. -struct MockObjectState { - MockObjectState() - : first_used_file(nullptr), first_used_line(-1), leakable(false) {} - - // Where in the source file an ON_CALL or EXPECT_CALL is first - // invoked on this mock object. - const char* first_used_file; - int first_used_line; - ::std::string first_used_test_suite; - ::std::string first_used_test; - bool leakable; // true if and only if it's OK to leak the object. - FunctionMockers function_mockers; // All registered methods of the object. -}; - -// A global registry holding the state of all mock objects that are -// alive. A mock object is added to this registry the first time -// Mock::AllowLeak(), ON_CALL(), or EXPECT_CALL() is called on it. It -// is removed from the registry in the mock object's destructor. -class MockObjectRegistry { - public: - // Maps a mock object (identified by its address) to its state. - typedef std::map StateMap; - - // This destructor will be called when a program exits, after all - // tests in it have been run. By then, there should be no mock - // object alive. Therefore we report any living object as test - // failure, unless the user explicitly asked us to ignore it. - ~MockObjectRegistry() { - if (!GMOCK_FLAG(catch_leaked_mocks)) - return; - - int leaked_count = 0; - for (StateMap::const_iterator it = states_.begin(); it != states_.end(); - ++it) { - if (it->second.leakable) // The user said it's fine to leak this object. - continue; - - // FIXME: Print the type of the leaked object. - // This can help the user identify the leaked object. - std::cout << "\n"; - const MockObjectState& state = it->second; - std::cout << internal::FormatFileLocation(state.first_used_file, - state.first_used_line); - std::cout << " ERROR: this mock object"; - if (state.first_used_test != "") { - std::cout << " (used in test " << state.first_used_test_suite << "." - << state.first_used_test << ")"; - } - std::cout << " should be deleted but never is. Its address is @" - << it->first << "."; - leaked_count++; - } - if (leaked_count > 0) { - std::cout << "\nERROR: " << leaked_count << " leaked mock " - << (leaked_count == 1 ? "object" : "objects") - << " found at program exit. Expectations on a mock object are " - "verified when the object is destructed. Leaking a mock " - "means that its expectations aren't verified, which is " - "usually a test bug. If you really intend to leak a mock, " - "you can suppress this error using " - "testing::Mock::AllowLeak(mock_object), or you may use a " - "fake or stub instead of a mock.\n"; - std::cout.flush(); - ::std::cerr.flush(); - // RUN_ALL_TESTS() has already returned when this destructor is - // called. Therefore we cannot use the normal Google Test - // failure reporting mechanism. - _exit(1); // We cannot call exit() as it is not reentrant and - // may already have been called. - } - } - - StateMap& states() { return states_; } - - private: - StateMap states_; -}; - -// Protected by g_gmock_mutex. -MockObjectRegistry g_mock_object_registry; - -// Maps a mock object to the reaction Google Mock should have when an -// uninteresting method is called. Protected by g_gmock_mutex. -std::map g_uninteresting_call_reaction; - -// Sets the reaction Google Mock should have when an uninteresting -// method of the given mock object is called. -void SetReactionOnUninterestingCalls(const void* mock_obj, - internal::CallReaction reaction) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - g_uninteresting_call_reaction[mock_obj] = reaction; -} - -} // namespace - -// Tells Google Mock to allow uninteresting calls on the given mock -// object. -void Mock::AllowUninterestingCalls(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - SetReactionOnUninterestingCalls(mock_obj, internal::kAllow); -} - -// Tells Google Mock to warn the user about uninteresting calls on the -// given mock object. -void Mock::WarnUninterestingCalls(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - SetReactionOnUninterestingCalls(mock_obj, internal::kWarn); -} - -// Tells Google Mock to fail uninteresting calls on the given mock -// object. -void Mock::FailUninterestingCalls(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - SetReactionOnUninterestingCalls(mock_obj, internal::kFail); -} - -// Tells Google Mock the given mock object is being destroyed and its -// entry in the call-reaction table should be removed. -void Mock::UnregisterCallReaction(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - g_uninteresting_call_reaction.erase(mock_obj); -} - -// Returns the reaction Google Mock will have on uninteresting calls -// made on the given mock object. -internal::CallReaction Mock::GetReactionOnUninterestingCalls( - const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - return (g_uninteresting_call_reaction.count(mock_obj) == 0) ? - internal::intToCallReaction(GMOCK_FLAG(default_mock_behavior)) : - g_uninteresting_call_reaction[mock_obj]; -} - -// Tells Google Mock to ignore mock_obj when checking for leaked mock -// objects. -void Mock::AllowLeak(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - g_mock_object_registry.states()[mock_obj].leakable = true; -} - -// Verifies and clears all expectations on the given mock object. If -// the expectations aren't satisfied, generates one or more Google -// Test non-fatal failures and returns false. -bool Mock::VerifyAndClearExpectations(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - return VerifyAndClearExpectationsLocked(mock_obj); -} - -// Verifies all expectations on the given mock object and clears its -// default actions and expectations. Returns true if and only if the -// verification was successful. -bool Mock::VerifyAndClear(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - ClearDefaultActionsLocked(mock_obj); - return VerifyAndClearExpectationsLocked(mock_obj); -} - -// Verifies and clears all expectations on the given mock object. If -// the expectations aren't satisfied, generates one or more Google -// Test non-fatal failures and returns false. -bool Mock::VerifyAndClearExpectationsLocked(void* mock_obj) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) { - internal::g_gmock_mutex.AssertHeld(); - if (g_mock_object_registry.states().count(mock_obj) == 0) { - // No EXPECT_CALL() was set on the given mock object. - return true; - } - - // Verifies and clears the expectations on each mock method in the - // given mock object. - bool expectations_met = true; - FunctionMockers& mockers = - g_mock_object_registry.states()[mock_obj].function_mockers; - for (FunctionMockers::const_iterator it = mockers.begin(); - it != mockers.end(); ++it) { - if (!(*it)->VerifyAndClearExpectationsLocked()) { - expectations_met = false; - } - } - - // We don't clear the content of mockers, as they may still be - // needed by ClearDefaultActionsLocked(). - return expectations_met; -} - -bool Mock::IsNaggy(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - return Mock::GetReactionOnUninterestingCalls(mock_obj) == internal::kWarn; -} -bool Mock::IsNice(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - return Mock::GetReactionOnUninterestingCalls(mock_obj) == internal::kAllow; -} -bool Mock::IsStrict(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - return Mock::GetReactionOnUninterestingCalls(mock_obj) == internal::kFail; -} - -// Registers a mock object and a mock method it owns. -void Mock::Register(const void* mock_obj, - internal::UntypedFunctionMockerBase* mocker) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - g_mock_object_registry.states()[mock_obj].function_mockers.insert(mocker); -} - -// Tells Google Mock where in the source code mock_obj is used in an -// ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this -// information helps the user identify which object it is. -void Mock::RegisterUseByOnCallOrExpectCall(const void* mock_obj, - const char* file, int line) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - MockObjectState& state = g_mock_object_registry.states()[mock_obj]; - if (state.first_used_file == nullptr) { - state.first_used_file = file; - state.first_used_line = line; - const TestInfo* const test_info = - UnitTest::GetInstance()->current_test_info(); - if (test_info != nullptr) { - state.first_used_test_suite = test_info->test_suite_name(); - state.first_used_test = test_info->name(); - } - } -} - -// Unregisters a mock method; removes the owning mock object from the -// registry when the last mock method associated with it has been -// unregistered. This is called only in the destructor of -// FunctionMockerBase. -void Mock::UnregisterLocked(internal::UntypedFunctionMockerBase* mocker) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) { - internal::g_gmock_mutex.AssertHeld(); - for (MockObjectRegistry::StateMap::iterator it = - g_mock_object_registry.states().begin(); - it != g_mock_object_registry.states().end(); ++it) { - FunctionMockers& mockers = it->second.function_mockers; - if (mockers.erase(mocker) > 0) { - // mocker was in mockers and has been just removed. - if (mockers.empty()) { - g_mock_object_registry.states().erase(it); - } - return; - } - } -} - -// Clears all ON_CALL()s set on the given mock object. -void Mock::ClearDefaultActionsLocked(void* mock_obj) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) { - internal::g_gmock_mutex.AssertHeld(); - - if (g_mock_object_registry.states().count(mock_obj) == 0) { - // No ON_CALL() was set on the given mock object. - return; - } - - // Clears the default actions for each mock method in the given mock - // object. - FunctionMockers& mockers = - g_mock_object_registry.states()[mock_obj].function_mockers; - for (FunctionMockers::const_iterator it = mockers.begin(); - it != mockers.end(); ++it) { - (*it)->ClearDefaultActionsLocked(); - } - - // We don't clear the content of mockers, as they may still be - // needed by VerifyAndClearExpectationsLocked(). -} - -Expectation::Expectation() {} - -Expectation::Expectation( - const std::shared_ptr& an_expectation_base) - : expectation_base_(an_expectation_base) {} - -Expectation::~Expectation() {} - -// Adds an expectation to a sequence. -void Sequence::AddExpectation(const Expectation& expectation) const { - if (*last_expectation_ != expectation) { - if (last_expectation_->expectation_base() != nullptr) { - expectation.expectation_base()->immediate_prerequisites_ - += *last_expectation_; - } - *last_expectation_ = expectation; - } -} - -// Creates the implicit sequence if there isn't one. -InSequence::InSequence() { - if (internal::g_gmock_implicit_sequence.get() == nullptr) { - internal::g_gmock_implicit_sequence.set(new Sequence); - sequence_created_ = true; - } else { - sequence_created_ = false; - } -} - -// Deletes the implicit sequence if it was created by the constructor -// of this object. -InSequence::~InSequence() { - if (sequence_created_) { - delete internal::g_gmock_implicit_sequence.get(); - internal::g_gmock_implicit_sequence.set(nullptr); - } -} - -} // namespace testing - -#ifdef _MSC_VER -#if _MSC_VER == 1900 -# pragma warning(pop) -#endif -#endif -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -namespace testing { - -GMOCK_DEFINE_bool_(catch_leaked_mocks, true, - "true if and only if Google Mock should report leaked " - "mock objects as failures."); - -GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity, - "Controls how verbose Google Mock's output is." - " Valid values:\n" - " info - prints all messages.\n" - " warning - prints warnings and errors.\n" - " error - prints errors only."); - -GMOCK_DEFINE_int32_(default_mock_behavior, 1, - "Controls the default behavior of mocks." - " Valid values:\n" - " 0 - by default, mocks act as NiceMocks.\n" - " 1 - by default, mocks act as NaggyMocks.\n" - " 2 - by default, mocks act as StrictMocks."); - -namespace internal { - -// Parses a string as a command line flag. The string should have the -// format "--gmock_flag=value". When def_optional is true, the -// "=value" part can be omitted. -// -// Returns the value of the flag, or NULL if the parsing failed. -static const char* ParseGoogleMockFlagValue(const char* str, - const char* flag, - bool def_optional) { - // str and flag must not be NULL. - if (str == nullptr || flag == nullptr) return nullptr; - - // The flag must start with "--gmock_". - const std::string flag_str = std::string("--gmock_") + flag; - const size_t flag_len = flag_str.length(); - if (strncmp(str, flag_str.c_str(), flag_len) != 0) return nullptr; - - // Skips the flag name. - const char* flag_end = str + flag_len; - - // When def_optional is true, it's OK to not have a "=value" part. - if (def_optional && (flag_end[0] == '\0')) { - return flag_end; - } - - // If def_optional is true and there are more characters after the - // flag name, or if def_optional is false, there must be a '=' after - // the flag name. - if (flag_end[0] != '=') return nullptr; - - // Returns the string after "=". - return flag_end + 1; -} - -// Parses a string for a Google Mock bool flag, in the form of -// "--gmock_flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -static bool ParseGoogleMockBoolFlag(const char* str, const char* flag, - bool* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseGoogleMockFlagValue(str, flag, true); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Converts the string value to a bool. - *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F'); - return true; -} - -// Parses a string for a Google Mock string flag, in the form of -// "--gmock_flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -template -static bool ParseGoogleMockStringFlag(const char* str, const char* flag, - String* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseGoogleMockFlagValue(str, flag, false); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Sets *value to the value of the flag. - *value = value_str; - return true; -} - -static bool ParseGoogleMockIntFlag(const char* str, const char* flag, - int32_t* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseGoogleMockFlagValue(str, flag, true); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Sets *value to the value of the flag. - return ParseInt32(Message() << "The value of flag --" << flag, - value_str, value); -} - -// The internal implementation of InitGoogleMock(). -// -// The type parameter CharType can be instantiated to either char or -// wchar_t. -template -void InitGoogleMockImpl(int* argc, CharType** argv) { - // Makes sure Google Test is initialized. InitGoogleTest() is - // idempotent, so it's fine if the user has already called it. - InitGoogleTest(argc, argv); - if (*argc <= 0) return; - - for (int i = 1; i != *argc; i++) { - const std::string arg_string = StreamableToString(argv[i]); - const char* const arg = arg_string.c_str(); - - // Do we see a Google Mock flag? - if (ParseGoogleMockBoolFlag(arg, "catch_leaked_mocks", - &GMOCK_FLAG(catch_leaked_mocks)) || - ParseGoogleMockStringFlag(arg, "verbose", &GMOCK_FLAG(verbose)) || - ParseGoogleMockIntFlag(arg, "default_mock_behavior", - &GMOCK_FLAG(default_mock_behavior))) { - // Yes. Shift the remainder of the argv list left by one. Note - // that argv has (*argc + 1) elements, the last one always being - // NULL. The following loop moves the trailing NULL element as - // well. - for (int j = i; j != *argc; j++) { - argv[j] = argv[j + 1]; - } - - // Decrements the argument count. - (*argc)--; - - // We also need to decrement the iterator as we just removed - // an element. - i--; - } - } -} - -} // namespace internal - -// Initializes Google Mock. This must be called before running the -// tests. In particular, it parses a command line for the flags that -// Google Mock recognizes. Whenever a Google Mock flag is seen, it is -// removed from argv, and *argc is decremented. -// -// No value is returned. Instead, the Google Mock flag variables are -// updated. -// -// Since Google Test is needed for Google Mock to work, this function -// also initializes Google Test and parses its flags, if that hasn't -// been done. -GTEST_API_ void InitGoogleMock(int* argc, char** argv) { - internal::InitGoogleMockImpl(argc, argv); -} - -// This overloaded version can be used in Windows programs compiled in -// UNICODE mode. -GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv) { - internal::InitGoogleMockImpl(argc, argv); -} - -// This overloaded version can be used on Arduino/embedded platforms where -// there is no argc/argv. -GTEST_API_ void InitGoogleMock() { - // Since Arduino doesn't have a command line, fake out the argc/argv arguments - int argc = 1; - const auto arg0 = "dummy"; - char* argv0 = const_cast(arg0); - char** argv = &argv0; - - internal::InitGoogleMockImpl(&argc, argv); -} - -} // namespace testing diff --git a/lib/c-ares-1.19.1/test/gmock-1.11.0/gmock/gmock.h b/lib/c-ares-1.19.1/test/gmock-1.11.0/gmock/gmock.h deleted file mode 100644 index 9bb49d08069..00000000000 --- a/lib/c-ares-1.19.1/test/gmock-1.11.0/gmock/gmock.h +++ /dev/null @@ -1,11647 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This is the main header file a user should include. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_ - -// This file implements the following syntax: -// -// ON_CALL(mock_object, Method(...)) -// .With(...) ? -// .WillByDefault(...); -// -// where With() is optional and WillByDefault() must appear exactly -// once. -// -// EXPECT_CALL(mock_object, Method(...)) -// .With(...) ? -// .Times(...) ? -// .InSequence(...) * -// .WillOnce(...) * -// .WillRepeatedly(...) ? -// .RetiresOnSaturation() ? ; -// -// where all clauses are optional and WillOnce() can be repeated. - -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// The ACTION* family of macros can be used in a namespace scope to -// define custom actions easily. The syntax: -// -// ACTION(name) { statements; } -// -// will define an action with the given name that executes the -// statements. The value returned by the statements will be used as -// the return value of the action. Inside the statements, you can -// refer to the K-th (0-based) argument of the mock function by -// 'argK', and refer to its type by 'argK_type'. For example: -// -// ACTION(IncrementArg1) { -// arg1_type temp = arg1; -// return ++(*temp); -// } -// -// allows you to write -// -// ...WillOnce(IncrementArg1()); -// -// You can also refer to the entire argument tuple and its type by -// 'args' and 'args_type', and refer to the mock function type and its -// return type by 'function_type' and 'return_type'. -// -// Note that you don't need to specify the types of the mock function -// arguments. However rest assured that your code is still type-safe: -// you'll get a compiler error if *arg1 doesn't support the ++ -// operator, or if the type of ++(*arg1) isn't compatible with the -// mock function's return type, for example. -// -// Sometimes you'll want to parameterize the action. For that you can use -// another macro: -// -// ACTION_P(name, param_name) { statements; } -// -// For example: -// -// ACTION_P(Add, n) { return arg0 + n; } -// -// will allow you to write: -// -// ...WillOnce(Add(5)); -// -// Note that you don't need to provide the type of the parameter -// either. If you need to reference the type of a parameter named -// 'foo', you can write 'foo_type'. For example, in the body of -// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type -// of 'n'. -// -// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support -// multi-parameter actions. -// -// For the purpose of typing, you can view -// -// ACTION_Pk(Foo, p1, ..., pk) { ... } -// -// as shorthand for -// -// template -// FooActionPk Foo(p1_type p1, ..., pk_type pk) { ... } -// -// In particular, you can provide the template type arguments -// explicitly when invoking Foo(), as in Foo(5, false); -// although usually you can rely on the compiler to infer the types -// for you automatically. You can assign the result of expression -// Foo(p1, ..., pk) to a variable of type FooActionPk. This can be useful when composing actions. -// -// You can also overload actions with different numbers of parameters: -// -// ACTION_P(Plus, a) { ... } -// ACTION_P2(Plus, a, b) { ... } -// -// While it's tempting to always use the ACTION* macros when defining -// a new action, you should also consider implementing ActionInterface -// or using MakePolymorphicAction() instead, especially if you need to -// use the action a lot. While these approaches require more work, -// they give you more control on the types of the mock function -// arguments and the action parameters, which in general leads to -// better compiler error messages that pay off in the long run. They -// also allow overloading actions based on parameter types (as opposed -// to just based on the number of parameters). -// -// CAVEAT: -// -// ACTION*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// Users can, however, define any local functors (e.g. a lambda) that -// can be used as actions. -// -// MORE INFORMATION: -// -// To learn more about using these macros, please search for 'ACTION' on -// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ - -#ifndef _WIN32_WCE -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file defines some utilities useful for implementing Google -// Mock. They are subject to change without notice, so please DO NOT -// USE THEM IN USER CODE. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ - -#include -#include // NOLINT -#include -#include -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// Low-level types and utilities for porting Google Mock to various -// platforms. All macros ending with _ and symbols defined in an -// internal namespace are subject to change without notice. Code -// outside Google Mock MUST NOT USE THEM DIRECTLY. Macros that don't -// end with _ are part of Google Mock's public API and can be used by -// code outside Google Mock. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ - -#include -#include -#include -#include - -// Most of the utilities needed for porting Google Mock are also -// required for Google Test and are defined in gtest-port.h. -// -// Note to maintainers: to reduce code duplication, prefer adding -// portability utilities to Google Test's gtest-port.h instead of -// here, as Google Mock depends on Google Test. Only add a utility -// here if it's truly specific to Google Mock. - -#include "gtest/gtest.h" -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Injection point for custom user configurations. See README for details -// -// ** Custom implementation starts here ** - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ - -#endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ - -// For MS Visual C++, check the compiler version. At least VS 2015 is -// required to compile Google Mock. -#if defined(_MSC_VER) && _MSC_VER < 1900 -# error "At least Visual C++ 2015 (14.0) is required to compile Google Mock." -#endif - -// Macro for referencing flags. This is public as we want the user to -// use this syntax to reference Google Mock flags. -#define GMOCK_FLAG(name) FLAGS_gmock_##name - -#if !defined(GMOCK_DECLARE_bool_) - -// Macros for declaring flags. -# define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name) -# define GMOCK_DECLARE_int32_(name) extern GTEST_API_ int32_t GMOCK_FLAG(name) -# define GMOCK_DECLARE_string_(name) \ - extern GTEST_API_ ::std::string GMOCK_FLAG(name) - -// Macros for defining flags. -# define GMOCK_DEFINE_bool_(name, default_val, doc) \ - GTEST_API_ bool GMOCK_FLAG(name) = (default_val) -# define GMOCK_DEFINE_int32_(name, default_val, doc) \ - GTEST_API_ int32_t GMOCK_FLAG(name) = (default_val) -# define GMOCK_DEFINE_string_(name, default_val, doc) \ - GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val) - -#endif // !defined(GMOCK_DECLARE_bool_) - -#endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ - -namespace testing { - -template -class Matcher; - -namespace internal { - -// Silence MSVC C4100 (unreferenced formal parameter) and -// C4805('==': unsafe mix of type 'const int' and type 'const bool') -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -# pragma warning(disable:4805) -#endif - -// Joins a vector of strings as if they are fields of a tuple; returns -// the joined string. -GTEST_API_ std::string JoinAsTuple(const Strings& fields); - -// Converts an identifier name to a space-separated list of lower-case -// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is -// treated as one word. For example, both "FooBar123" and -// "foo_bar_123" are converted to "foo bar 123". -GTEST_API_ std::string ConvertIdentifierNameToWords(const char* id_name); - -// GetRawPointer(p) returns the raw pointer underlying p when p is a -// smart pointer, or returns p itself when p is already a raw pointer. -// The following default implementation is for the smart pointer case. -template -inline const typename Pointer::element_type* GetRawPointer(const Pointer& p) { - return p.get(); -} -// This overloaded version is for the raw pointer case. -template -inline Element* GetRawPointer(Element* p) { return p; } - -// MSVC treats wchar_t as a native type usually, but treats it as the -// same as unsigned short when the compiler option /Zc:wchar_t- is -// specified. It defines _NATIVE_WCHAR_T_DEFINED symbol when wchar_t -// is a native type. -#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED) -// wchar_t is a typedef. -#else -# define GMOCK_WCHAR_T_IS_NATIVE_ 1 -#endif - -// In what follows, we use the term "kind" to indicate whether a type -// is bool, an integer type (excluding bool), a floating-point type, -// or none of them. This categorization is useful for determining -// when a matcher argument type can be safely converted to another -// type in the implementation of SafeMatcherCast. -enum TypeKind { - kBool, kInteger, kFloatingPoint, kOther -}; - -// KindOf::value is the kind of type T. -template struct KindOf { - enum { value = kOther }; // The default kind. -}; - -// This macro declares that the kind of 'type' is 'kind'. -#define GMOCK_DECLARE_KIND_(type, kind) \ - template <> struct KindOf { enum { value = kind }; } - -GMOCK_DECLARE_KIND_(bool, kBool); - -// All standard integer types. -GMOCK_DECLARE_KIND_(char, kInteger); -GMOCK_DECLARE_KIND_(signed char, kInteger); -GMOCK_DECLARE_KIND_(unsigned char, kInteger); -GMOCK_DECLARE_KIND_(short, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(unsigned short, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(int, kInteger); -GMOCK_DECLARE_KIND_(unsigned int, kInteger); -GMOCK_DECLARE_KIND_(long, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(unsigned long, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(long long, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(unsigned long long, kInteger); // NOLINT - -#if GMOCK_WCHAR_T_IS_NATIVE_ -GMOCK_DECLARE_KIND_(wchar_t, kInteger); -#endif - -// All standard floating-point types. -GMOCK_DECLARE_KIND_(float, kFloatingPoint); -GMOCK_DECLARE_KIND_(double, kFloatingPoint); -GMOCK_DECLARE_KIND_(long double, kFloatingPoint); - -#undef GMOCK_DECLARE_KIND_ - -// Evaluates to the kind of 'type'. -#define GMOCK_KIND_OF_(type) \ - static_cast< ::testing::internal::TypeKind>( \ - ::testing::internal::KindOf::value) - -// LosslessArithmeticConvertibleImpl::value -// is true if and only if arithmetic type From can be losslessly converted to -// arithmetic type To. -// -// It's the user's responsibility to ensure that both From and To are -// raw (i.e. has no CV modifier, is not a pointer, and is not a -// reference) built-in arithmetic types, kFromKind is the kind of -// From, and kToKind is the kind of To; the value is -// implementation-defined when the above pre-condition is violated. -template -using LosslessArithmeticConvertibleImpl = std::integral_constant< - bool, - // clang-format off - // Converting from bool is always lossless - (kFromKind == kBool) ? true - // Converting between any other type kinds will be lossy if the type - // kinds are not the same. - : (kFromKind != kToKind) ? false - : (kFromKind == kInteger && - // Converting between integers of different widths is allowed so long - // as the conversion does not go from signed to unsigned. - (((sizeof(From) < sizeof(To)) && - !(std::is_signed::value && !std::is_signed::value)) || - // Converting between integers of the same width only requires the - // two types to have the same signedness. - ((sizeof(From) == sizeof(To)) && - (std::is_signed::value == std::is_signed::value))) - ) ? true - // Floating point conversions are lossless if and only if `To` is at least - // as wide as `From`. - : (kFromKind == kFloatingPoint && (sizeof(From) <= sizeof(To))) ? true - : false - // clang-format on - >; - -// LosslessArithmeticConvertible::value is true if and only if -// arithmetic type From can be losslessly converted to arithmetic type To. -// -// It's the user's responsibility to ensure that both From and To are -// raw (i.e. has no CV modifier, is not a pointer, and is not a -// reference) built-in arithmetic types; the value is -// implementation-defined when the above pre-condition is violated. -template -using LosslessArithmeticConvertible = - LosslessArithmeticConvertibleImpl; - -// This interface knows how to report a Google Mock failure (either -// non-fatal or fatal). -class FailureReporterInterface { - public: - // The type of a failure (either non-fatal or fatal). - enum FailureType { - kNonfatal, kFatal - }; - - virtual ~FailureReporterInterface() {} - - // Reports a failure that occurred at the given source file location. - virtual void ReportFailure(FailureType type, const char* file, int line, - const std::string& message) = 0; -}; - -// Returns the failure reporter used by Google Mock. -GTEST_API_ FailureReporterInterface* GetFailureReporter(); - -// Asserts that condition is true; aborts the process with the given -// message if condition is false. We cannot use LOG(FATAL) or CHECK() -// as Google Mock might be used to mock the log sink itself. We -// inline this function to prevent it from showing up in the stack -// trace. -inline void Assert(bool condition, const char* file, int line, - const std::string& msg) { - if (!condition) { - GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal, - file, line, msg); - } -} -inline void Assert(bool condition, const char* file, int line) { - Assert(condition, file, line, "Assertion failed."); -} - -// Verifies that condition is true; generates a non-fatal failure if -// condition is false. -inline void Expect(bool condition, const char* file, int line, - const std::string& msg) { - if (!condition) { - GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal, - file, line, msg); - } -} -inline void Expect(bool condition, const char* file, int line) { - Expect(condition, file, line, "Expectation failed."); -} - -// Severity level of a log. -enum LogSeverity { - kInfo = 0, - kWarning = 1 -}; - -// Valid values for the --gmock_verbose flag. - -// All logs (informational and warnings) are printed. -const char kInfoVerbosity[] = "info"; -// Only warnings are printed. -const char kWarningVerbosity[] = "warning"; -// No logs are printed. -const char kErrorVerbosity[] = "error"; - -// Returns true if and only if a log with the given severity is visible -// according to the --gmock_verbose flag. -GTEST_API_ bool LogIsVisible(LogSeverity severity); - -// Prints the given message to stdout if and only if 'severity' >= the level -// specified by the --gmock_verbose flag. If stack_frames_to_skip >= -// 0, also prints the stack trace excluding the top -// stack_frames_to_skip frames. In opt mode, any positive -// stack_frames_to_skip is treated as 0, since we don't know which -// function calls will be inlined by the compiler and need to be -// conservative. -GTEST_API_ void Log(LogSeverity severity, const std::string& message, - int stack_frames_to_skip); - -// A marker class that is used to resolve parameterless expectations to the -// correct overload. This must not be instantiable, to prevent client code from -// accidentally resolving to the overload; for example: -// -// ON_CALL(mock, Method({}, nullptr))... -// -class WithoutMatchers { - private: - WithoutMatchers() {} - friend GTEST_API_ WithoutMatchers GetWithoutMatchers(); -}; - -// Internal use only: access the singleton instance of WithoutMatchers. -GTEST_API_ WithoutMatchers GetWithoutMatchers(); - -// Disable MSVC warnings for infinite recursion, since in this case the -// the recursion is unreachable. -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4717) -#endif - -// Invalid() is usable as an expression of type T, but will terminate -// the program with an assertion failure if actually run. This is useful -// when a value of type T is needed for compilation, but the statement -// will not really be executed (or we don't care if the statement -// crashes). -template -inline T Invalid() { - Assert(false, "", -1, "Internal error: attempt to return invalid value"); - // This statement is unreachable, and would never terminate even if it - // could be reached. It is provided only to placate compiler warnings - // about missing return statements. - return Invalid(); -} - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -// Given a raw type (i.e. having no top-level reference or const -// modifier) RawContainer that's either an STL-style container or a -// native array, class StlContainerView has the -// following members: -// -// - type is a type that provides an STL-style container view to -// (i.e. implements the STL container concept for) RawContainer; -// - const_reference is a type that provides a reference to a const -// RawContainer; -// - ConstReference(raw_container) returns a const reference to an STL-style -// container view to raw_container, which is a RawContainer. -// - Copy(raw_container) returns an STL-style container view of a -// copy of raw_container, which is a RawContainer. -// -// This generic version is used when RawContainer itself is already an -// STL-style container. -template -class StlContainerView { - public: - typedef RawContainer type; - typedef const type& const_reference; - - static const_reference ConstReference(const RawContainer& container) { - static_assert(!std::is_const::value, - "RawContainer type must not be const"); - return container; - } - static type Copy(const RawContainer& container) { return container; } -}; - -// This specialization is used when RawContainer is a native array type. -template -class StlContainerView { - public: - typedef typename std::remove_const::type RawElement; - typedef internal::NativeArray type; - // NativeArray can represent a native array either by value or by - // reference (selected by a constructor argument), so 'const type' - // can be used to reference a const native array. We cannot - // 'typedef const type& const_reference' here, as that would mean - // ConstReference() has to return a reference to a local variable. - typedef const type const_reference; - - static const_reference ConstReference(const Element (&array)[N]) { - static_assert(std::is_same::value, - "Element type must not be const"); - return type(array, N, RelationToSourceReference()); - } - static type Copy(const Element (&array)[N]) { - return type(array, N, RelationToSourceCopy()); - } -}; - -// This specialization is used when RawContainer is a native array -// represented as a (pointer, size) tuple. -template -class StlContainerView< ::std::tuple > { - public: - typedef typename std::remove_const< - typename std::pointer_traits::element_type>::type - RawElement; - typedef internal::NativeArray type; - typedef const type const_reference; - - static const_reference ConstReference( - const ::std::tuple& array) { - return type(std::get<0>(array), std::get<1>(array), - RelationToSourceReference()); - } - static type Copy(const ::std::tuple& array) { - return type(std::get<0>(array), std::get<1>(array), RelationToSourceCopy()); - } -}; - -// The following specialization prevents the user from instantiating -// StlContainer with a reference type. -template class StlContainerView; - -// A type transform to remove constness from the first part of a pair. -// Pairs like that are used as the value_type of associative containers, -// and this transform produces a similar but assignable pair. -template -struct RemoveConstFromKey { - typedef T type; -}; - -// Partially specialized to remove constness from std::pair. -template -struct RemoveConstFromKey > { - typedef std::pair type; -}; - -// Emit an assertion failure due to incorrect DoDefault() usage. Out-of-lined to -// reduce code size. -GTEST_API_ void IllegalDoDefault(const char* file, int line); - -template -auto ApplyImpl(F&& f, Tuple&& args, IndexSequence) -> decltype( - std::forward(f)(std::get(std::forward(args))...)) { - return std::forward(f)(std::get(std::forward(args))...); -} - -// Apply the function to a tuple of arguments. -template -auto Apply(F&& f, Tuple&& args) -> decltype( - ApplyImpl(std::forward(f), std::forward(args), - MakeIndexSequence::type>::value>())) { - return ApplyImpl(std::forward(f), std::forward(args), - MakeIndexSequence::type>::value>()); -} - -// Template struct Function, where F must be a function type, contains -// the following typedefs: -// -// Result: the function's return type. -// Arg: the type of the N-th argument, where N starts with 0. -// ArgumentTuple: the tuple type consisting of all parameters of F. -// ArgumentMatcherTuple: the tuple type consisting of Matchers for all -// parameters of F. -// MakeResultVoid: the function type obtained by substituting void -// for the return type of F. -// MakeResultIgnoredValue: -// the function type obtained by substituting Something -// for the return type of F. -template -struct Function; - -template -struct Function { - using Result = R; - static constexpr size_t ArgumentCount = sizeof...(Args); - template - using Arg = ElemFromList; - using ArgumentTuple = std::tuple; - using ArgumentMatcherTuple = std::tuple...>; - using MakeResultVoid = void(Args...); - using MakeResultIgnoredValue = IgnoredValue(Args...); -}; - -template -constexpr size_t Function::ArgumentCount; - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -} // namespace internal -} // namespace testing - -#endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PP_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PP_H_ - -// Expands and concatenates the arguments. Constructed macros reevaluate. -#define GMOCK_PP_CAT(_1, _2) GMOCK_PP_INTERNAL_CAT(_1, _2) - -// Expands and stringifies the only argument. -#define GMOCK_PP_STRINGIZE(...) GMOCK_PP_INTERNAL_STRINGIZE(__VA_ARGS__) - -// Returns empty. Given a variadic number of arguments. -#define GMOCK_PP_EMPTY(...) - -// Returns a comma. Given a variadic number of arguments. -#define GMOCK_PP_COMMA(...) , - -// Returns the only argument. -#define GMOCK_PP_IDENTITY(_1) _1 - -// Evaluates to the number of arguments after expansion. -// -// #define PAIR x, y -// -// GMOCK_PP_NARG() => 1 -// GMOCK_PP_NARG(x) => 1 -// GMOCK_PP_NARG(x, y) => 2 -// GMOCK_PP_NARG(PAIR) => 2 -// -// Requires: the number of arguments after expansion is at most 15. -#define GMOCK_PP_NARG(...) \ - GMOCK_PP_INTERNAL_16TH( \ - (__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) - -// Returns 1 if the expansion of arguments has an unprotected comma. Otherwise -// returns 0. Requires no more than 15 unprotected commas. -#define GMOCK_PP_HAS_COMMA(...) \ - GMOCK_PP_INTERNAL_16TH( \ - (__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0)) - -// Returns the first argument. -#define GMOCK_PP_HEAD(...) GMOCK_PP_INTERNAL_HEAD((__VA_ARGS__, unusedArg)) - -// Returns the tail. A variadic list of all arguments minus the first. Requires -// at least one argument. -#define GMOCK_PP_TAIL(...) GMOCK_PP_INTERNAL_TAIL((__VA_ARGS__)) - -// Calls CAT(_Macro, NARG(__VA_ARGS__))(__VA_ARGS__) -#define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \ - GMOCK_PP_IDENTITY( \ - GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__)) - -// If the arguments after expansion have no tokens, evaluates to `1`. Otherwise -// evaluates to `0`. -// -// Requires: * the number of arguments after expansion is at most 15. -// * If the argument is a macro, it must be able to be called with one -// argument. -// -// Implementation details: -// -// There is one case when it generates a compile error: if the argument is macro -// that cannot be called with one argument. -// -// #define M(a, b) // it doesn't matter what it expands to -// -// // Expected: expands to `0`. -// // Actual: compile error. -// GMOCK_PP_IS_EMPTY(M) -// -// There are 4 cases tested: -// -// * __VA_ARGS__ possible expansion has no unparen'd commas. Expected 0. -// * __VA_ARGS__ possible expansion is not enclosed in parenthesis. Expected 0. -// * __VA_ARGS__ possible expansion is not a macro that ()-evaluates to a comma. -// Expected 0 -// * __VA_ARGS__ is empty, or has unparen'd commas, or is enclosed in -// parenthesis, or is a macro that ()-evaluates to comma. Expected 1. -// -// We trigger detection on '0001', i.e. on empty. -#define GMOCK_PP_IS_EMPTY(...) \ - GMOCK_PP_INTERNAL_IS_EMPTY(GMOCK_PP_HAS_COMMA(__VA_ARGS__), \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_COMMA __VA_ARGS__), \ - GMOCK_PP_HAS_COMMA(__VA_ARGS__()), \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_COMMA __VA_ARGS__())) - -// Evaluates to _Then if _Cond is 1 and _Else if _Cond is 0. -#define GMOCK_PP_IF(_Cond, _Then, _Else) \ - GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IF_, _Cond)(_Then, _Else) - -// Similar to GMOCK_PP_IF but takes _Then and _Else in parentheses. -// -// GMOCK_PP_GENERIC_IF(1, (a, b, c), (d, e, f)) => a, b, c -// GMOCK_PP_GENERIC_IF(0, (a, b, c), (d, e, f)) => d, e, f -// -#define GMOCK_PP_GENERIC_IF(_Cond, _Then, _Else) \ - GMOCK_PP_REMOVE_PARENS(GMOCK_PP_IF(_Cond, _Then, _Else)) - -// Evaluates to the number of arguments after expansion. Identifies 'empty' as -// 0. -// -// #define PAIR x, y -// -// GMOCK_PP_NARG0() => 0 -// GMOCK_PP_NARG0(x) => 1 -// GMOCK_PP_NARG0(x, y) => 2 -// GMOCK_PP_NARG0(PAIR) => 2 -// -// Requires: * the number of arguments after expansion is at most 15. -// * If the argument is a macro, it must be able to be called with one -// argument. -#define GMOCK_PP_NARG0(...) \ - GMOCK_PP_IF(GMOCK_PP_IS_EMPTY(__VA_ARGS__), 0, GMOCK_PP_NARG(__VA_ARGS__)) - -// Expands to 1 if the first argument starts with something in parentheses, -// otherwise to 0. -#define GMOCK_PP_IS_BEGIN_PARENS(...) \ - GMOCK_PP_HEAD(GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_, \ - GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C __VA_ARGS__)) - -// Expands to 1 is there is only one argument and it is enclosed in parentheses. -#define GMOCK_PP_IS_ENCLOSED_PARENS(...) \ - GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(__VA_ARGS__), \ - GMOCK_PP_IS_EMPTY(GMOCK_PP_EMPTY __VA_ARGS__), 0) - -// Remove the parens, requires GMOCK_PP_IS_ENCLOSED_PARENS(args) => 1. -#define GMOCK_PP_REMOVE_PARENS(...) GMOCK_PP_INTERNAL_REMOVE_PARENS __VA_ARGS__ - -// Expands to _Macro(0, _Data, e1) _Macro(1, _Data, e2) ... _Macro(K -1, _Data, -// eK) as many of GMOCK_INTERNAL_NARG0 _Tuple. -// Requires: * |_Macro| can be called with 3 arguments. -// * |_Tuple| expansion has no more than 15 elements. -#define GMOCK_PP_FOR_EACH(_Macro, _Data, _Tuple) \ - GMOCK_PP_CAT(GMOCK_PP_INTERNAL_FOR_EACH_IMPL_, GMOCK_PP_NARG0 _Tuple) \ - (0, _Macro, _Data, _Tuple) - -// Expands to _Macro(0, _Data, ) _Macro(1, _Data, ) ... _Macro(K - 1, _Data, ) -// Empty if _K = 0. -// Requires: * |_Macro| can be called with 3 arguments. -// * |_K| literal between 0 and 15 -#define GMOCK_PP_REPEAT(_Macro, _Data, _N) \ - GMOCK_PP_CAT(GMOCK_PP_INTERNAL_FOR_EACH_IMPL_, _N) \ - (0, _Macro, _Data, GMOCK_PP_INTENRAL_EMPTY_TUPLE) - -// Increments the argument, requires the argument to be between 0 and 15. -#define GMOCK_PP_INC(_i) GMOCK_PP_CAT(GMOCK_PP_INTERNAL_INC_, _i) - -// Returns comma if _i != 0. Requires _i to be between 0 and 15. -#define GMOCK_PP_COMMA_IF(_i) GMOCK_PP_CAT(GMOCK_PP_INTERNAL_COMMA_IF_, _i) - -// Internal details follow. Do not use any of these symbols outside of this -// file or we will break your code. -#define GMOCK_PP_INTENRAL_EMPTY_TUPLE (, , , , , , , , , , , , , , , ) -#define GMOCK_PP_INTERNAL_CAT(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_STRINGIZE(...) #__VA_ARGS__ -#define GMOCK_PP_INTERNAL_CAT_5(_1, _2, _3, _4, _5) _1##_2##_3##_4##_5 -#define GMOCK_PP_INTERNAL_IS_EMPTY(_1, _2, _3, _4) \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_INTERNAL_CAT_5(GMOCK_PP_INTERNAL_IS_EMPTY_CASE_, \ - _1, _2, _3, _4)) -#define GMOCK_PP_INTERNAL_IS_EMPTY_CASE_0001 , -#define GMOCK_PP_INTERNAL_IF_1(_Then, _Else) _Then -#define GMOCK_PP_INTERNAL_IF_0(_Then, _Else) _Else - -// Because of MSVC treating a token with a comma in it as a single token when -// passed to another macro, we need to force it to evaluate it as multiple -// tokens. We do that by using a "IDENTITY(MACRO PARENTHESIZED_ARGS)" macro. We -// define one per possible macro that relies on this behavior. Note "_Args" must -// be parenthesized. -#define GMOCK_PP_INTERNAL_INTERNAL_16TH(_1, _2, _3, _4, _5, _6, _7, _8, _9, \ - _10, _11, _12, _13, _14, _15, _16, \ - ...) \ - _16 -#define GMOCK_PP_INTERNAL_16TH(_Args) \ - GMOCK_PP_IDENTITY(GMOCK_PP_INTERNAL_INTERNAL_16TH _Args) -#define GMOCK_PP_INTERNAL_INTERNAL_HEAD(_1, ...) _1 -#define GMOCK_PP_INTERNAL_HEAD(_Args) \ - GMOCK_PP_IDENTITY(GMOCK_PP_INTERNAL_INTERNAL_HEAD _Args) -#define GMOCK_PP_INTERNAL_INTERNAL_TAIL(_1, ...) __VA_ARGS__ -#define GMOCK_PP_INTERNAL_TAIL(_Args) \ - GMOCK_PP_IDENTITY(GMOCK_PP_INTERNAL_INTERNAL_TAIL _Args) - -#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C(...) 1 _ -#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_1 1, -#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C \ - 0, -#define GMOCK_PP_INTERNAL_REMOVE_PARENS(...) __VA_ARGS__ -#define GMOCK_PP_INTERNAL_INC_0 1 -#define GMOCK_PP_INTERNAL_INC_1 2 -#define GMOCK_PP_INTERNAL_INC_2 3 -#define GMOCK_PP_INTERNAL_INC_3 4 -#define GMOCK_PP_INTERNAL_INC_4 5 -#define GMOCK_PP_INTERNAL_INC_5 6 -#define GMOCK_PP_INTERNAL_INC_6 7 -#define GMOCK_PP_INTERNAL_INC_7 8 -#define GMOCK_PP_INTERNAL_INC_8 9 -#define GMOCK_PP_INTERNAL_INC_9 10 -#define GMOCK_PP_INTERNAL_INC_10 11 -#define GMOCK_PP_INTERNAL_INC_11 12 -#define GMOCK_PP_INTERNAL_INC_12 13 -#define GMOCK_PP_INTERNAL_INC_13 14 -#define GMOCK_PP_INTERNAL_INC_14 15 -#define GMOCK_PP_INTERNAL_INC_15 16 -#define GMOCK_PP_INTERNAL_COMMA_IF_0 -#define GMOCK_PP_INTERNAL_COMMA_IF_1 , -#define GMOCK_PP_INTERNAL_COMMA_IF_2 , -#define GMOCK_PP_INTERNAL_COMMA_IF_3 , -#define GMOCK_PP_INTERNAL_COMMA_IF_4 , -#define GMOCK_PP_INTERNAL_COMMA_IF_5 , -#define GMOCK_PP_INTERNAL_COMMA_IF_6 , -#define GMOCK_PP_INTERNAL_COMMA_IF_7 , -#define GMOCK_PP_INTERNAL_COMMA_IF_8 , -#define GMOCK_PP_INTERNAL_COMMA_IF_9 , -#define GMOCK_PP_INTERNAL_COMMA_IF_10 , -#define GMOCK_PP_INTERNAL_COMMA_IF_11 , -#define GMOCK_PP_INTERNAL_COMMA_IF_12 , -#define GMOCK_PP_INTERNAL_COMMA_IF_13 , -#define GMOCK_PP_INTERNAL_COMMA_IF_14 , -#define GMOCK_PP_INTERNAL_COMMA_IF_15 , -#define GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, _element) \ - _Macro(_i, _Data, _element) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_0(_i, _Macro, _Data, _Tuple) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_1(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_2(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_1(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_3(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_2(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_4(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_3(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_5(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_4(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_6(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_5(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_7(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_6(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_8(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_7(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_9(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_8(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_10(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_9(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_11(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_10(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_12(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_11(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_13(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_12(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_14(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_13(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_15(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_14(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) - -#endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PP_H_ - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -#endif - -namespace testing { - -// To implement an action Foo, define: -// 1. a class FooAction that implements the ActionInterface interface, and -// 2. a factory function that creates an Action object from a -// const FooAction*. -// -// The two-level delegation design follows that of Matcher, providing -// consistency for extension developers. It also eases ownership -// management as Action objects can now be copied like plain values. - -namespace internal { - -// BuiltInDefaultValueGetter::Get() returns a -// default-constructed T value. BuiltInDefaultValueGetter::Get() crashes with an error. -// -// This primary template is used when kDefaultConstructible is true. -template -struct BuiltInDefaultValueGetter { - static T Get() { return T(); } -}; -template -struct BuiltInDefaultValueGetter { - static T Get() { - Assert(false, __FILE__, __LINE__, - "Default action undefined for the function return type."); - return internal::Invalid(); - // The above statement will never be reached, but is required in - // order for this function to compile. - } -}; - -// BuiltInDefaultValue::Get() returns the "built-in" default value -// for type T, which is NULL when T is a raw pointer type, 0 when T is -// a numeric type, false when T is bool, or "" when T is string or -// std::string. In addition, in C++11 and above, it turns a -// default-constructed T value if T is default constructible. For any -// other type T, the built-in default T value is undefined, and the -// function will abort the process. -template -class BuiltInDefaultValue { - public: - // This function returns true if and only if type T has a built-in default - // value. - static bool Exists() { - return ::std::is_default_constructible::value; - } - - static T Get() { - return BuiltInDefaultValueGetter< - T, ::std::is_default_constructible::value>::Get(); - } -}; - -// This partial specialization says that we use the same built-in -// default value for T and const T. -template -class BuiltInDefaultValue { - public: - static bool Exists() { return BuiltInDefaultValue::Exists(); } - static T Get() { return BuiltInDefaultValue::Get(); } -}; - -// This partial specialization defines the default values for pointer -// types. -template -class BuiltInDefaultValue { - public: - static bool Exists() { return true; } - static T* Get() { return nullptr; } -}; - -// The following specializations define the default values for -// specific types we care about. -#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \ - template <> \ - class BuiltInDefaultValue { \ - public: \ - static bool Exists() { return true; } \ - static type Get() { return value; } \ - } - -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, ""); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0'); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0'); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0'); - -// There's no need for a default action for signed wchar_t, as that -// type is the same as wchar_t for gcc, and invalid for MSVC. -// -// There's also no need for a default action for unsigned wchar_t, as -// that type is the same as unsigned int for gcc, and invalid for -// MSVC. -#if GMOCK_WCHAR_T_IS_NATIVE_ -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT -#endif - -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long long, 0); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long long, 0); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0); - -#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ - -// Simple two-arg form of std::disjunction. -template -using disjunction = typename ::std::conditional::type; - -} // namespace internal - -// When an unexpected function call is encountered, Google Mock will -// let it return a default value if the user has specified one for its -// return type, or if the return type has a built-in default value; -// otherwise Google Mock won't know what value to return and will have -// to abort the process. -// -// The DefaultValue class allows a user to specify the -// default value for a type T that is both copyable and publicly -// destructible (i.e. anything that can be used as a function return -// type). The usage is: -// -// // Sets the default value for type T to be foo. -// DefaultValue::Set(foo); -template -class DefaultValue { - public: - // Sets the default value for type T; requires T to be - // copy-constructable and have a public destructor. - static void Set(T x) { - delete producer_; - producer_ = new FixedValueProducer(x); - } - - // Provides a factory function to be called to generate the default value. - // This method can be used even if T is only move-constructible, but it is not - // limited to that case. - typedef T (*FactoryFunction)(); - static void SetFactory(FactoryFunction factory) { - delete producer_; - producer_ = new FactoryValueProducer(factory); - } - - // Unsets the default value for type T. - static void Clear() { - delete producer_; - producer_ = nullptr; - } - - // Returns true if and only if the user has set the default value for type T. - static bool IsSet() { return producer_ != nullptr; } - - // Returns true if T has a default return value set by the user or there - // exists a built-in default value. - static bool Exists() { - return IsSet() || internal::BuiltInDefaultValue::Exists(); - } - - // Returns the default value for type T if the user has set one; - // otherwise returns the built-in default value. Requires that Exists() - // is true, which ensures that the return value is well-defined. - static T Get() { - return producer_ == nullptr ? internal::BuiltInDefaultValue::Get() - : producer_->Produce(); - } - - private: - class ValueProducer { - public: - virtual ~ValueProducer() {} - virtual T Produce() = 0; - }; - - class FixedValueProducer : public ValueProducer { - public: - explicit FixedValueProducer(T value) : value_(value) {} - T Produce() override { return value_; } - - private: - const T value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(FixedValueProducer); - }; - - class FactoryValueProducer : public ValueProducer { - public: - explicit FactoryValueProducer(FactoryFunction factory) - : factory_(factory) {} - T Produce() override { return factory_(); } - - private: - const FactoryFunction factory_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(FactoryValueProducer); - }; - - static ValueProducer* producer_; -}; - -// This partial specialization allows a user to set default values for -// reference types. -template -class DefaultValue { - public: - // Sets the default value for type T&. - static void Set(T& x) { // NOLINT - address_ = &x; - } - - // Unsets the default value for type T&. - static void Clear() { address_ = nullptr; } - - // Returns true if and only if the user has set the default value for type T&. - static bool IsSet() { return address_ != nullptr; } - - // Returns true if T has a default return value set by the user or there - // exists a built-in default value. - static bool Exists() { - return IsSet() || internal::BuiltInDefaultValue::Exists(); - } - - // Returns the default value for type T& if the user has set one; - // otherwise returns the built-in default value if there is one; - // otherwise aborts the process. - static T& Get() { - return address_ == nullptr ? internal::BuiltInDefaultValue::Get() - : *address_; - } - - private: - static T* address_; -}; - -// This specialization allows DefaultValue::Get() to -// compile. -template <> -class DefaultValue { - public: - static bool Exists() { return true; } - static void Get() {} -}; - -// Points to the user-set default value for type T. -template -typename DefaultValue::ValueProducer* DefaultValue::producer_ = nullptr; - -// Points to the user-set default value for type T&. -template -T* DefaultValue::address_ = nullptr; - -// Implement this interface to define an action for function type F. -template -class ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - ActionInterface() {} - virtual ~ActionInterface() {} - - // Performs the action. This method is not const, as in general an - // action can have side effects and be stateful. For example, a - // get-the-next-element-from-the-collection action will need to - // remember the current element. - virtual Result Perform(const ArgumentTuple& args) = 0; - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface); -}; - -// An Action is a copyable and IMMUTABLE (except by assignment) -// object that represents an action to be taken when a mock function -// of type F is called. The implementation of Action is just a -// std::shared_ptr to const ActionInterface. Don't inherit from Action! -// You can view an object implementing ActionInterface as a -// concrete action (including its current state), and an Action -// object as a handle to it. -template -class Action { - // Adapter class to allow constructing Action from a legacy ActionInterface. - // New code should create Actions from functors instead. - struct ActionAdapter { - // Adapter must be copyable to satisfy std::function requirements. - ::std::shared_ptr> impl_; - - template - typename internal::Function::Result operator()(Args&&... args) { - return impl_->Perform( - ::std::forward_as_tuple(::std::forward(args)...)); - } - }; - - template - using IsCompatibleFunctor = std::is_constructible, G>; - - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - // Constructs a null Action. Needed for storing Action objects in - // STL containers. - Action() {} - - // Construct an Action from a specified callable. - // This cannot take std::function directly, because then Action would not be - // directly constructible from lambda (it would require two conversions). - template < - typename G, - typename = typename std::enable_if, std::is_constructible, - G>>::value>::type> - Action(G&& fun) { // NOLINT - Init(::std::forward(fun), IsCompatibleFunctor()); - } - - // Constructs an Action from its implementation. - explicit Action(ActionInterface* impl) - : fun_(ActionAdapter{::std::shared_ptr>(impl)}) {} - - // This constructor allows us to turn an Action object into an - // Action, as long as F's arguments can be implicitly converted - // to Func's and Func's return type can be implicitly converted to F's. - template - explicit Action(const Action& action) : fun_(action.fun_) {} - - // Returns true if and only if this is the DoDefault() action. - bool IsDoDefault() const { return fun_ == nullptr; } - - // Performs the action. Note that this method is const even though - // the corresponding method in ActionInterface is not. The reason - // is that a const Action means that it cannot be re-bound to - // another concrete action, not that the concrete action it binds to - // cannot change state. (Think of the difference between a const - // pointer and a pointer to const.) - Result Perform(ArgumentTuple args) const { - if (IsDoDefault()) { - internal::IllegalDoDefault(__FILE__, __LINE__); - } - return internal::Apply(fun_, ::std::move(args)); - } - - private: - template - friend class Action; - - template - void Init(G&& g, ::std::true_type) { - fun_ = ::std::forward(g); - } - - template - void Init(G&& g, ::std::false_type) { - fun_ = IgnoreArgs::type>{::std::forward(g)}; - } - - template - struct IgnoreArgs { - template - Result operator()(const Args&...) const { - return function_impl(); - } - - FunctionImpl function_impl; - }; - - // fun_ is an empty function if and only if this is the DoDefault() action. - ::std::function fun_; -}; - -// The PolymorphicAction class template makes it easy to implement a -// polymorphic action (i.e. an action that can be used in mock -// functions of than one type, e.g. Return()). -// -// To define a polymorphic action, a user first provides a COPYABLE -// implementation class that has a Perform() method template: -// -// class FooAction { -// public: -// template -// Result Perform(const ArgumentTuple& args) const { -// // Processes the arguments and returns a result, using -// // std::get(args) to get the N-th (0-based) argument in the tuple. -// } -// ... -// }; -// -// Then the user creates the polymorphic action using -// MakePolymorphicAction(object) where object has type FooAction. See -// the definition of Return(void) and SetArgumentPointee(value) for -// complete examples. -template -class PolymorphicAction { - public: - explicit PolymorphicAction(const Impl& impl) : impl_(impl) {} - - template - operator Action() const { - return Action(new MonomorphicImpl(impl_)); - } - - private: - template - class MonomorphicImpl : public ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} - - Result Perform(const ArgumentTuple& args) override { - return impl_.template Perform(args); - } - - private: - Impl impl_; - }; - - Impl impl_; -}; - -// Creates an Action from its implementation and returns it. The -// created Action object owns the implementation. -template -Action MakeAction(ActionInterface* impl) { - return Action(impl); -} - -// Creates a polymorphic action from its implementation. This is -// easier to use than the PolymorphicAction constructor as it -// doesn't require you to explicitly write the template argument, e.g. -// -// MakePolymorphicAction(foo); -// vs -// PolymorphicAction(foo); -template -inline PolymorphicAction MakePolymorphicAction(const Impl& impl) { - return PolymorphicAction(impl); -} - -namespace internal { - -// Helper struct to specialize ReturnAction to execute a move instead of a copy -// on return. Useful for move-only types, but could be used on any type. -template -struct ByMoveWrapper { - explicit ByMoveWrapper(T value) : payload(std::move(value)) {} - T payload; -}; - -// Implements the polymorphic Return(x) action, which can be used in -// any function that returns the type of x, regardless of the argument -// types. -// -// Note: The value passed into Return must be converted into -// Function::Result when this action is cast to Action rather than -// when that action is performed. This is important in scenarios like -// -// MOCK_METHOD1(Method, T(U)); -// ... -// { -// Foo foo; -// X x(&foo); -// EXPECT_CALL(mock, Method(_)).WillOnce(Return(x)); -// } -// -// In the example above the variable x holds reference to foo which leaves -// scope and gets destroyed. If copying X just copies a reference to foo, -// that copy will be left with a hanging reference. If conversion to T -// makes a copy of foo, the above code is safe. To support that scenario, we -// need to make sure that the type conversion happens inside the EXPECT_CALL -// statement, and conversion of the result of Return to Action is a -// good place for that. -// -// The real life example of the above scenario happens when an invocation -// of gtl::Container() is passed into Return. -// -template -class ReturnAction { - public: - // Constructs a ReturnAction object from the value to be returned. - // 'value' is passed by value instead of by const reference in order - // to allow Return("string literal") to compile. - explicit ReturnAction(R value) : value_(new R(std::move(value))) {} - - // This template type conversion operator allows Return(x) to be - // used in ANY function that returns x's type. - template - operator Action() const { // NOLINT - // Assert statement belongs here because this is the best place to verify - // conditions on F. It produces the clearest error messages - // in most compilers. - // Impl really belongs in this scope as a local class but can't - // because MSVC produces duplicate symbols in different translation units - // in this case. Until MS fixes that bug we put Impl into the class scope - // and put the typedef both here (for use in assert statement) and - // in the Impl class. But both definitions must be the same. - typedef typename Function::Result Result; - GTEST_COMPILE_ASSERT_( - !std::is_reference::value, - use_ReturnRef_instead_of_Return_to_return_a_reference); - static_assert(!std::is_void::value, - "Can't use Return() on an action expected to return `void`."); - return Action(new Impl(value_)); - } - - private: - // Implements the Return(x) action for a particular function type F. - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - // The implicit cast is necessary when Result has more than one - // single-argument constructor (e.g. Result is std::vector) and R - // has a type conversion operator template. In that case, value_(value) - // won't compile as the compiler doesn't known which constructor of - // Result to call. ImplicitCast_ forces the compiler to convert R to - // Result without considering explicit constructors, thus resolving the - // ambiguity. value_ is then initialized using its copy constructor. - explicit Impl(const std::shared_ptr& value) - : value_before_cast_(*value), - value_(ImplicitCast_(value_before_cast_)) {} - - Result Perform(const ArgumentTuple&) override { return value_; } - - private: - GTEST_COMPILE_ASSERT_(!std::is_reference::value, - Result_cannot_be_a_reference_type); - // We save the value before casting just in case it is being cast to a - // wrapper type. - R value_before_cast_; - Result value_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl); - }; - - // Partially specialize for ByMoveWrapper. This version of ReturnAction will - // move its contents instead. - template - class Impl, F> : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const std::shared_ptr& wrapper) - : performed_(false), wrapper_(wrapper) {} - - Result Perform(const ArgumentTuple&) override { - GTEST_CHECK_(!performed_) - << "A ByMove() action should only be performed once."; - performed_ = true; - return std::move(wrapper_->payload); - } - - private: - bool performed_; - const std::shared_ptr wrapper_; - }; - - const std::shared_ptr value_; -}; - -// Implements the ReturnNull() action. -class ReturnNullAction { - public: - // Allows ReturnNull() to be used in any pointer-returning function. In C++11 - // this is enforced by returning nullptr, and in non-C++11 by asserting a - // pointer type on compile time. - template - static Result Perform(const ArgumentTuple&) { - return nullptr; - } -}; - -// Implements the Return() action. -class ReturnVoidAction { - public: - // Allows Return() to be used in any void-returning function. - template - static void Perform(const ArgumentTuple&) { - static_assert(std::is_void::value, "Result should be void."); - } -}; - -// Implements the polymorphic ReturnRef(x) action, which can be used -// in any function that returns a reference to the type of x, -// regardless of the argument types. -template -class ReturnRefAction { - public: - // Constructs a ReturnRefAction object from the reference to be returned. - explicit ReturnRefAction(T& ref) : ref_(ref) {} // NOLINT - - // This template type conversion operator allows ReturnRef(x) to be - // used in ANY function that returns a reference to x's type. - template - operator Action() const { - typedef typename Function::Result Result; - // Asserts that the function return type is a reference. This - // catches the user error of using ReturnRef(x) when Return(x) - // should be used, and generates some helpful error message. - GTEST_COMPILE_ASSERT_(std::is_reference::value, - use_Return_instead_of_ReturnRef_to_return_a_value); - return Action(new Impl(ref_)); - } - - private: - // Implements the ReturnRef(x) action for a particular function type F. - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(T& ref) : ref_(ref) {} // NOLINT - - Result Perform(const ArgumentTuple&) override { return ref_; } - - private: - T& ref_; - }; - - T& ref_; -}; - -// Implements the polymorphic ReturnRefOfCopy(x) action, which can be -// used in any function that returns a reference to the type of x, -// regardless of the argument types. -template -class ReturnRefOfCopyAction { - public: - // Constructs a ReturnRefOfCopyAction object from the reference to - // be returned. - explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} // NOLINT - - // This template type conversion operator allows ReturnRefOfCopy(x) to be - // used in ANY function that returns a reference to x's type. - template - operator Action() const { - typedef typename Function::Result Result; - // Asserts that the function return type is a reference. This - // catches the user error of using ReturnRefOfCopy(x) when Return(x) - // should be used, and generates some helpful error message. - GTEST_COMPILE_ASSERT_( - std::is_reference::value, - use_Return_instead_of_ReturnRefOfCopy_to_return_a_value); - return Action(new Impl(value_)); - } - - private: - // Implements the ReturnRefOfCopy(x) action for a particular function type F. - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const T& value) : value_(value) {} // NOLINT - - Result Perform(const ArgumentTuple&) override { return value_; } - - private: - T value_; - }; - - const T value_; -}; - -// Implements the polymorphic ReturnRoundRobin(v) action, which can be -// used in any function that returns the element_type of v. -template -class ReturnRoundRobinAction { - public: - explicit ReturnRoundRobinAction(std::vector values) { - GTEST_CHECK_(!values.empty()) - << "ReturnRoundRobin requires at least one element."; - state_->values = std::move(values); - } - - template - T operator()(Args&&...) const { - return state_->Next(); - } - - private: - struct State { - T Next() { - T ret_val = values[i++]; - if (i == values.size()) i = 0; - return ret_val; - } - - std::vector values; - size_t i = 0; - }; - std::shared_ptr state_ = std::make_shared(); -}; - -// Implements the polymorphic DoDefault() action. -class DoDefaultAction { - public: - // This template type conversion operator allows DoDefault() to be - // used in any function. - template - operator Action() const { return Action(); } // NOLINT -}; - -// Implements the Assign action to set a given pointer referent to a -// particular value. -template -class AssignAction { - public: - AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {} - - template - void Perform(const ArgumentTuple& /* args */) const { - *ptr_ = value_; - } - - private: - T1* const ptr_; - const T2 value_; -}; - -#if !GTEST_OS_WINDOWS_MOBILE - -// Implements the SetErrnoAndReturn action to simulate return from -// various system calls and libc functions. -template -class SetErrnoAndReturnAction { - public: - SetErrnoAndReturnAction(int errno_value, T result) - : errno_(errno_value), - result_(result) {} - template - Result Perform(const ArgumentTuple& /* args */) const { - errno = errno_; - return result_; - } - - private: - const int errno_; - const T result_; -}; - -#endif // !GTEST_OS_WINDOWS_MOBILE - -// Implements the SetArgumentPointee(x) action for any function -// whose N-th argument (0-based) is a pointer to x's type. -template -struct SetArgumentPointeeAction { - A value; - - template - void operator()(const Args&... args) const { - *::std::get(std::tie(args...)) = value; - } -}; - -// Implements the Invoke(object_ptr, &Class::Method) action. -template -struct InvokeMethodAction { - Class* const obj_ptr; - const MethodPtr method_ptr; - - template - auto operator()(Args&&... args) const - -> decltype((obj_ptr->*method_ptr)(std::forward(args)...)) { - return (obj_ptr->*method_ptr)(std::forward(args)...); - } -}; - -// Implements the InvokeWithoutArgs(f) action. The template argument -// FunctionImpl is the implementation type of f, which can be either a -// function pointer or a functor. InvokeWithoutArgs(f) can be used as an -// Action as long as f's type is compatible with F. -template -struct InvokeWithoutArgsAction { - FunctionImpl function_impl; - - // Allows InvokeWithoutArgs(f) to be used as any action whose type is - // compatible with f. - template - auto operator()(const Args&...) -> decltype(function_impl()) { - return function_impl(); - } -}; - -// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action. -template -struct InvokeMethodWithoutArgsAction { - Class* const obj_ptr; - const MethodPtr method_ptr; - - using ReturnType = - decltype((std::declval()->*std::declval())()); - - template - ReturnType operator()(const Args&...) const { - return (obj_ptr->*method_ptr)(); - } -}; - -// Implements the IgnoreResult(action) action. -template -class IgnoreResultAction { - public: - explicit IgnoreResultAction(const A& action) : action_(action) {} - - template - operator Action() const { - // Assert statement belongs here because this is the best place to verify - // conditions on F. It produces the clearest error messages - // in most compilers. - // Impl really belongs in this scope as a local class but can't - // because MSVC produces duplicate symbols in different translation units - // in this case. Until MS fixes that bug we put Impl into the class scope - // and put the typedef both here (for use in assert statement) and - // in the Impl class. But both definitions must be the same. - typedef typename internal::Function::Result Result; - - // Asserts at compile time that F returns void. - static_assert(std::is_void::value, "Result type should be void."); - - return Action(new Impl(action_)); - } - - private: - template - class Impl : public ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const A& action) : action_(action) {} - - void Perform(const ArgumentTuple& args) override { - // Performs the action and ignores its result. - action_.Perform(args); - } - - private: - // Type OriginalFunction is the same as F except that its return - // type is IgnoredValue. - typedef typename internal::Function::MakeResultIgnoredValue - OriginalFunction; - - const Action action_; - }; - - const A action_; -}; - -template -struct WithArgsAction { - InnerAction action; - - // The inner action could be anything convertible to Action. - // We use the conversion operator to detect the signature of the inner Action. - template - operator Action() const { // NOLINT - using TupleType = std::tuple; - Action::type...)> - converted(action); - - return [converted](Args... args) -> R { - return converted.Perform(std::forward_as_tuple( - std::get(std::forward_as_tuple(std::forward(args)...))...)); - }; - } -}; - -template -struct DoAllAction { - private: - template - using NonFinalType = - typename std::conditional::value, T, const T&>::type; - - template - std::vector Convert(IndexSequence) const { - return {ActionT(std::get(actions))...}; - } - - public: - std::tuple actions; - - template - operator Action() const { // NOLINT - struct Op { - std::vector...)>> converted; - Action last; - R operator()(Args... args) const { - auto tuple_args = std::forward_as_tuple(std::forward(args)...); - for (auto& a : converted) { - a.Perform(tuple_args); - } - return last.Perform(std::move(tuple_args)); - } - }; - return Op{Convert...)>>( - MakeIndexSequence()), - std::get(actions)}; - } -}; - -template -struct ReturnNewAction { - T* operator()() const { - return internal::Apply( - [](const Params&... unpacked_params) { - return new T(unpacked_params...); - }, - params); - } - std::tuple params; -}; - -template -struct ReturnArgAction { - template - auto operator()(const Args&... args) const -> - typename std::tuple_element>::type { - return std::get(std::tie(args...)); - } -}; - -template -struct SaveArgAction { - Ptr pointer; - - template - void operator()(const Args&... args) const { - *pointer = std::get(std::tie(args...)); - } -}; - -template -struct SaveArgPointeeAction { - Ptr pointer; - - template - void operator()(const Args&... args) const { - *pointer = *std::get(std::tie(args...)); - } -}; - -template -struct SetArgRefereeAction { - T value; - - template - void operator()(Args&&... args) const { - using argk_type = - typename ::std::tuple_element>::type; - static_assert(std::is_lvalue_reference::value, - "Argument must be a reference type."); - std::get(std::tie(args...)) = value; - } -}; - -template -struct SetArrayArgumentAction { - I1 first; - I2 last; - - template - void operator()(const Args&... args) const { - auto value = std::get(std::tie(args...)); - for (auto it = first; it != last; ++it, (void)++value) { - *value = *it; - } - } -}; - -template -struct DeleteArgAction { - template - void operator()(const Args&... args) const { - delete std::get(std::tie(args...)); - } -}; - -template -struct ReturnPointeeAction { - Ptr pointer; - template - auto operator()(const Args&...) const -> decltype(*pointer) { - return *pointer; - } -}; - -#if GTEST_HAS_EXCEPTIONS -template -struct ThrowAction { - T exception; - // We use a conversion operator to adapt to any return type. - template - operator Action() const { // NOLINT - T copy = exception; - return [copy](Args...) -> R { throw copy; }; - } -}; -#endif // GTEST_HAS_EXCEPTIONS - -} // namespace internal - -// An Unused object can be implicitly constructed from ANY value. -// This is handy when defining actions that ignore some or all of the -// mock function arguments. For example, given -// -// MOCK_METHOD3(Foo, double(const string& label, double x, double y)); -// MOCK_METHOD3(Bar, double(int index, double x, double y)); -// -// instead of -// -// double DistanceToOriginWithLabel(const string& label, double x, double y) { -// return sqrt(x*x + y*y); -// } -// double DistanceToOriginWithIndex(int index, double x, double y) { -// return sqrt(x*x + y*y); -// } -// ... -// EXPECT_CALL(mock, Foo("abc", _, _)) -// .WillOnce(Invoke(DistanceToOriginWithLabel)); -// EXPECT_CALL(mock, Bar(5, _, _)) -// .WillOnce(Invoke(DistanceToOriginWithIndex)); -// -// you could write -// -// // We can declare any uninteresting argument as Unused. -// double DistanceToOrigin(Unused, double x, double y) { -// return sqrt(x*x + y*y); -// } -// ... -// EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); -// EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); -typedef internal::IgnoredValue Unused; - -// Creates an action that does actions a1, a2, ..., sequentially in -// each invocation. All but the last action will have a readonly view of the -// arguments. -template -internal::DoAllAction::type...> DoAll( - Action&&... action) { - return {std::forward_as_tuple(std::forward(action)...)}; -} - -// WithArg(an_action) creates an action that passes the k-th -// (0-based) argument of the mock function to an_action and performs -// it. It adapts an action accepting one argument to one that accepts -// multiple arguments. For convenience, we also provide -// WithArgs(an_action) (defined below) as a synonym. -template -internal::WithArgsAction::type, k> -WithArg(InnerAction&& action) { - return {std::forward(action)}; -} - -// WithArgs(an_action) creates an action that passes -// the selected arguments of the mock function to an_action and -// performs it. It serves as an adaptor between actions with -// different argument lists. -template -internal::WithArgsAction::type, k, ks...> -WithArgs(InnerAction&& action) { - return {std::forward(action)}; -} - -// WithoutArgs(inner_action) can be used in a mock function with a -// non-empty argument list to perform inner_action, which takes no -// argument. In other words, it adapts an action accepting no -// argument to one that accepts (and ignores) arguments. -template -internal::WithArgsAction::type> -WithoutArgs(InnerAction&& action) { - return {std::forward(action)}; -} - -// Creates an action that returns 'value'. 'value' is passed by value -// instead of const reference - otherwise Return("string literal") -// will trigger a compiler error about using array as initializer. -template -internal::ReturnAction Return(R value) { - return internal::ReturnAction(std::move(value)); -} - -// Creates an action that returns NULL. -inline PolymorphicAction ReturnNull() { - return MakePolymorphicAction(internal::ReturnNullAction()); -} - -// Creates an action that returns from a void function. -inline PolymorphicAction Return() { - return MakePolymorphicAction(internal::ReturnVoidAction()); -} - -// Creates an action that returns the reference to a variable. -template -inline internal::ReturnRefAction ReturnRef(R& x) { // NOLINT - return internal::ReturnRefAction(x); -} - -// Prevent using ReturnRef on reference to temporary. -template -internal::ReturnRefAction ReturnRef(R&&) = delete; - -// Creates an action that returns the reference to a copy of the -// argument. The copy is created when the action is constructed and -// lives as long as the action. -template -inline internal::ReturnRefOfCopyAction ReturnRefOfCopy(const R& x) { - return internal::ReturnRefOfCopyAction(x); -} - -// Modifies the parent action (a Return() action) to perform a move of the -// argument instead of a copy. -// Return(ByMove()) actions can only be executed once and will assert this -// invariant. -template -internal::ByMoveWrapper ByMove(R x) { - return internal::ByMoveWrapper(std::move(x)); -} - -// Creates an action that returns an element of `vals`. Calling this action will -// repeatedly return the next value from `vals` until it reaches the end and -// will restart from the beginning. -template -internal::ReturnRoundRobinAction ReturnRoundRobin(std::vector vals) { - return internal::ReturnRoundRobinAction(std::move(vals)); -} - -// Creates an action that returns an element of `vals`. Calling this action will -// repeatedly return the next value from `vals` until it reaches the end and -// will restart from the beginning. -template -internal::ReturnRoundRobinAction ReturnRoundRobin( - std::initializer_list vals) { - return internal::ReturnRoundRobinAction(std::vector(vals)); -} - -// Creates an action that does the default action for the give mock function. -inline internal::DoDefaultAction DoDefault() { - return internal::DoDefaultAction(); -} - -// Creates an action that sets the variable pointed by the N-th -// (0-based) function argument to 'value'. -template -internal::SetArgumentPointeeAction SetArgPointee(T value) { - return {std::move(value)}; -} - -// The following version is DEPRECATED. -template -internal::SetArgumentPointeeAction SetArgumentPointee(T value) { - return {std::move(value)}; -} - -// Creates an action that sets a pointer referent to a given value. -template -PolymorphicAction > Assign(T1* ptr, T2 val) { - return MakePolymorphicAction(internal::AssignAction(ptr, val)); -} - -#if !GTEST_OS_WINDOWS_MOBILE - -// Creates an action that sets errno and returns the appropriate error. -template -PolymorphicAction > -SetErrnoAndReturn(int errval, T result) { - return MakePolymorphicAction( - internal::SetErrnoAndReturnAction(errval, result)); -} - -#endif // !GTEST_OS_WINDOWS_MOBILE - -// Various overloads for Invoke(). - -// Legacy function. -// Actions can now be implicitly constructed from callables. No need to create -// wrapper objects. -// This function exists for backwards compatibility. -template -typename std::decay::type Invoke(FunctionImpl&& function_impl) { - return std::forward(function_impl); -} - -// Creates an action that invokes the given method on the given object -// with the mock function's arguments. -template -internal::InvokeMethodAction Invoke(Class* obj_ptr, - MethodPtr method_ptr) { - return {obj_ptr, method_ptr}; -} - -// Creates an action that invokes 'function_impl' with no argument. -template -internal::InvokeWithoutArgsAction::type> -InvokeWithoutArgs(FunctionImpl function_impl) { - return {std::move(function_impl)}; -} - -// Creates an action that invokes the given method on the given object -// with no argument. -template -internal::InvokeMethodWithoutArgsAction InvokeWithoutArgs( - Class* obj_ptr, MethodPtr method_ptr) { - return {obj_ptr, method_ptr}; -} - -// Creates an action that performs an_action and throws away its -// result. In other words, it changes the return type of an_action to -// void. an_action MUST NOT return void, or the code won't compile. -template -inline internal::IgnoreResultAction IgnoreResult(const A& an_action) { - return internal::IgnoreResultAction(an_action); -} - -// Creates a reference wrapper for the given L-value. If necessary, -// you can explicitly specify the type of the reference. For example, -// suppose 'derived' is an object of type Derived, ByRef(derived) -// would wrap a Derived&. If you want to wrap a const Base& instead, -// where Base is a base class of Derived, just write: -// -// ByRef(derived) -// -// N.B. ByRef is redundant with std::ref, std::cref and std::reference_wrapper. -// However, it may still be used for consistency with ByMove(). -template -inline ::std::reference_wrapper ByRef(T& l_value) { // NOLINT - return ::std::reference_wrapper(l_value); -} - -// The ReturnNew(a1, a2, ..., a_k) action returns a pointer to a new -// instance of type T, constructed on the heap with constructor arguments -// a1, a2, ..., and a_k. The caller assumes ownership of the returned value. -template -internal::ReturnNewAction::type...> ReturnNew( - Params&&... params) { - return {std::forward_as_tuple(std::forward(params)...)}; -} - -// Action ReturnArg() returns the k-th argument of the mock function. -template -internal::ReturnArgAction ReturnArg() { - return {}; -} - -// Action SaveArg(pointer) saves the k-th (0-based) argument of the -// mock function to *pointer. -template -internal::SaveArgAction SaveArg(Ptr pointer) { - return {pointer}; -} - -// Action SaveArgPointee(pointer) saves the value pointed to -// by the k-th (0-based) argument of the mock function to *pointer. -template -internal::SaveArgPointeeAction SaveArgPointee(Ptr pointer) { - return {pointer}; -} - -// Action SetArgReferee(value) assigns 'value' to the variable -// referenced by the k-th (0-based) argument of the mock function. -template -internal::SetArgRefereeAction::type> SetArgReferee( - T&& value) { - return {std::forward(value)}; -} - -// Action SetArrayArgument(first, last) copies the elements in -// source range [first, last) to the array pointed to by the k-th -// (0-based) argument, which can be either a pointer or an -// iterator. The action does not take ownership of the elements in the -// source range. -template -internal::SetArrayArgumentAction SetArrayArgument(I1 first, - I2 last) { - return {first, last}; -} - -// Action DeleteArg() deletes the k-th (0-based) argument of the mock -// function. -template -internal::DeleteArgAction DeleteArg() { - return {}; -} - -// This action returns the value pointed to by 'pointer'. -template -internal::ReturnPointeeAction ReturnPointee(Ptr pointer) { - return {pointer}; -} - -// Action Throw(exception) can be used in a mock function of any type -// to throw the given exception. Any copyable value can be thrown. -#if GTEST_HAS_EXCEPTIONS -template -internal::ThrowAction::type> Throw(T&& exception) { - return {std::forward(exception)}; -} -#endif // GTEST_HAS_EXCEPTIONS - -namespace internal { - -// A macro from the ACTION* family (defined later in gmock-generated-actions.h) -// defines an action that can be used in a mock function. Typically, -// these actions only care about a subset of the arguments of the mock -// function. For example, if such an action only uses the second -// argument, it can be used in any mock function that takes >= 2 -// arguments where the type of the second argument is compatible. -// -// Therefore, the action implementation must be prepared to take more -// arguments than it needs. The ExcessiveArg type is used to -// represent those excessive arguments. In order to keep the compiler -// error messages tractable, we define it in the testing namespace -// instead of testing::internal. However, this is an INTERNAL TYPE -// and subject to change without notice, so a user MUST NOT USE THIS -// TYPE DIRECTLY. -struct ExcessiveArg {}; - -// Builds an implementation of an Action<> for some particular signature, using -// a class defined by an ACTION* macro. -template struct ActionImpl; - -template -struct ImplBase { - struct Holder { - // Allows each copy of the Action<> to get to the Impl. - explicit operator const Impl&() const { return *ptr; } - std::shared_ptr ptr; - }; - using type = typename std::conditional::value, - Impl, Holder>::type; -}; - -template -struct ActionImpl : ImplBase::type { - using Base = typename ImplBase::type; - using function_type = R(Args...); - using args_type = std::tuple; - - ActionImpl() = default; // Only defined if appropriate for Base. - explicit ActionImpl(std::shared_ptr impl) : Base{std::move(impl)} { } - - R operator()(Args&&... arg) const { - static constexpr size_t kMaxArgs = - sizeof...(Args) <= 10 ? sizeof...(Args) : 10; - return Apply(MakeIndexSequence{}, - MakeIndexSequence<10 - kMaxArgs>{}, - args_type{std::forward(arg)...}); - } - - template - R Apply(IndexSequence, IndexSequence, - const args_type& args) const { - // Impl need not be specific to the signature of action being implemented; - // only the implementing function body needs to have all of the specific - // types instantiated. Up to 10 of the args that are provided by the - // args_type get passed, followed by a dummy of unspecified type for the - // remainder up to 10 explicit args. - static constexpr ExcessiveArg kExcessArg{}; - return static_cast(*this).template gmock_PerformImpl< - /*function_type=*/function_type, /*return_type=*/R, - /*args_type=*/args_type, - /*argN_type=*/typename std::tuple_element::type...>( - /*args=*/args, std::get(args)..., - ((void)excess_id, kExcessArg)...); - } -}; - -// Stores a default-constructed Impl as part of the Action<>'s -// std::function<>. The Impl should be trivial to copy. -template -::testing::Action MakeAction() { - return ::testing::Action(ActionImpl()); -} - -// Stores just the one given instance of Impl. -template -::testing::Action MakeAction(std::shared_ptr impl) { - return ::testing::Action(ActionImpl(std::move(impl))); -} - -#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el) \ - , const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_ -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ \ - const args_type& args GTEST_ATTRIBUTE_UNUSED_ GMOCK_PP_REPEAT( \ - GMOCK_INTERNAL_ARG_UNUSED, , 10) - -#define GMOCK_INTERNAL_ARG(i, data, el) , const arg##i##_type& arg##i -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_ \ - const args_type& args GMOCK_PP_REPEAT(GMOCK_INTERNAL_ARG, , 10) - -#define GMOCK_INTERNAL_TEMPLATE_ARG(i, data, el) , typename arg##i##_type -#define GMOCK_ACTION_TEMPLATE_ARGS_NAMES_ \ - GMOCK_PP_TAIL(GMOCK_PP_REPEAT(GMOCK_INTERNAL_TEMPLATE_ARG, , 10)) - -#define GMOCK_INTERNAL_TYPENAME_PARAM(i, data, param) , typename param##_type -#define GMOCK_ACTION_TYPENAME_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPENAME_PARAM, , params)) - -#define GMOCK_INTERNAL_TYPE_PARAM(i, data, param) , param##_type -#define GMOCK_ACTION_TYPE_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_PARAM, , params)) - -#define GMOCK_INTERNAL_TYPE_GVALUE_PARAM(i, data, param) \ - , param##_type gmock_p##i -#define GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_GVALUE_PARAM, , params)) - -#define GMOCK_INTERNAL_GVALUE_PARAM(i, data, param) \ - , std::forward(gmock_p##i) -#define GMOCK_ACTION_GVALUE_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GVALUE_PARAM, , params)) - -#define GMOCK_INTERNAL_INIT_PARAM(i, data, param) \ - , param(::std::forward(gmock_p##i)) -#define GMOCK_ACTION_INIT_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_INIT_PARAM, , params)) - -#define GMOCK_INTERNAL_FIELD_PARAM(i, data, param) param##_type param; -#define GMOCK_ACTION_FIELD_PARAMS_(params) \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_FIELD_PARAM, , params) - -#define GMOCK_INTERNAL_ACTION(name, full_name, params) \ - template \ - class full_name { \ - public: \ - explicit full_name(GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) \ - : impl_(std::make_shared( \ - GMOCK_ACTION_GVALUE_PARAMS_(params))) { } \ - full_name(const full_name&) = default; \ - full_name(full_name&&) noexcept = default; \ - template \ - operator ::testing::Action() const { \ - return ::testing::internal::MakeAction(impl_); \ - } \ - private: \ - class gmock_Impl { \ - public: \ - explicit gmock_Impl(GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) \ - : GMOCK_ACTION_INIT_PARAMS_(params) {} \ - template \ - return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ - GMOCK_ACTION_FIELD_PARAMS_(params) \ - }; \ - std::shared_ptr impl_; \ - }; \ - template \ - inline full_name name( \ - GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) { \ - return full_name( \ - GMOCK_ACTION_GVALUE_PARAMS_(params)); \ - } \ - template \ - template \ - return_type full_name::gmock_Impl:: \ - gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -} // namespace internal - -// Similar to GMOCK_INTERNAL_ACTION, but no bound parameters are stored. -#define ACTION(name) \ - class name##Action { \ - public: \ - explicit name##Action() noexcept {} \ - name##Action(const name##Action&) noexcept {} \ - template \ - operator ::testing::Action() const { \ - return ::testing::internal::MakeAction(); \ - } \ - private: \ - class gmock_Impl { \ - public: \ - template \ - return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ - }; \ - }; \ - inline name##Action name() GTEST_MUST_USE_RESULT_; \ - inline name##Action name() { return name##Action(); } \ - template \ - return_type name##Action::gmock_Impl::gmock_PerformImpl( \ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP, (__VA_ARGS__)) - -#define ACTION_P2(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP2, (__VA_ARGS__)) - -#define ACTION_P3(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP3, (__VA_ARGS__)) - -#define ACTION_P4(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP4, (__VA_ARGS__)) - -#define ACTION_P5(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP5, (__VA_ARGS__)) - -#define ACTION_P6(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP6, (__VA_ARGS__)) - -#define ACTION_P7(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP7, (__VA_ARGS__)) - -#define ACTION_P8(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP8, (__VA_ARGS__)) - -#define ACTION_P9(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP9, (__VA_ARGS__)) - -#define ACTION_P10(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP10, (__VA_ARGS__)) - -} // namespace testing - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used cardinalities. More -// cardinalities can be defined by the user implementing the -// CardinalityInterface interface if necessary. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ - -#include -#include -#include // NOLINT - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// To implement a cardinality Foo, define: -// 1. a class FooCardinality that implements the -// CardinalityInterface interface, and -// 2. a factory function that creates a Cardinality object from a -// const FooCardinality*. -// -// The two-level delegation design follows that of Matcher, providing -// consistency for extension developers. It also eases ownership -// management as Cardinality objects can now be copied like plain values. - -// The implementation of a cardinality. -class CardinalityInterface { - public: - virtual ~CardinalityInterface() {} - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - virtual int ConservativeLowerBound() const { return 0; } - virtual int ConservativeUpperBound() const { return INT_MAX; } - - // Returns true if and only if call_count calls will satisfy this - // cardinality. - virtual bool IsSatisfiedByCallCount(int call_count) const = 0; - - // Returns true if and only if call_count calls will saturate this - // cardinality. - virtual bool IsSaturatedByCallCount(int call_count) const = 0; - - // Describes self to an ostream. - virtual void DescribeTo(::std::ostream* os) const = 0; -}; - -// A Cardinality is a copyable and IMMUTABLE (except by assignment) -// object that specifies how many times a mock function is expected to -// be called. The implementation of Cardinality is just a std::shared_ptr -// to const CardinalityInterface. Don't inherit from Cardinality! -class GTEST_API_ Cardinality { - public: - // Constructs a null cardinality. Needed for storing Cardinality - // objects in STL containers. - Cardinality() {} - - // Constructs a Cardinality from its implementation. - explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {} - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); } - int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); } - - // Returns true if and only if call_count calls will satisfy this - // cardinality. - bool IsSatisfiedByCallCount(int call_count) const { - return impl_->IsSatisfiedByCallCount(call_count); - } - - // Returns true if and only if call_count calls will saturate this - // cardinality. - bool IsSaturatedByCallCount(int call_count) const { - return impl_->IsSaturatedByCallCount(call_count); - } - - // Returns true if and only if call_count calls will over-saturate this - // cardinality, i.e. exceed the maximum number of allowed calls. - bool IsOverSaturatedByCallCount(int call_count) const { - return impl_->IsSaturatedByCallCount(call_count) && - !impl_->IsSatisfiedByCallCount(call_count); - } - - // Describes self to an ostream - void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } - - // Describes the given actual call count to an ostream. - static void DescribeActualCallCountTo(int actual_call_count, - ::std::ostream* os); - - private: - std::shared_ptr impl_; -}; - -// Creates a cardinality that allows at least n calls. -GTEST_API_ Cardinality AtLeast(int n); - -// Creates a cardinality that allows at most n calls. -GTEST_API_ Cardinality AtMost(int n); - -// Creates a cardinality that allows any number of calls. -GTEST_API_ Cardinality AnyNumber(); - -// Creates a cardinality that allows between min and max calls. -GTEST_API_ Cardinality Between(int min, int max); - -// Creates a cardinality that allows exactly n calls. -GTEST_API_ Cardinality Exactly(int n); - -// Creates a cardinality from its implementation. -inline Cardinality MakeCardinality(const CardinalityInterface* c) { - return Cardinality(c); -} - -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements MOCK_METHOD. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT -#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT - -#include // IWYU pragma: keep -#include // IWYU pragma: keep - -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements the ON_CALL() and EXPECT_CALL() macros. -// -// A user can use the ON_CALL() macro to specify the default action of -// a mock method. The syntax is: -// -// ON_CALL(mock_object, Method(argument-matchers)) -// .With(multi-argument-matcher) -// .WillByDefault(action); -// -// where the .With() clause is optional. -// -// A user can use the EXPECT_CALL() macro to specify an expectation on -// a mock method. The syntax is: -// -// EXPECT_CALL(mock_object, Method(argument-matchers)) -// .With(multi-argument-matchers) -// .Times(cardinality) -// .InSequence(sequences) -// .After(expectations) -// .WillOnce(action) -// .WillRepeatedly(action) -// .RetiresOnSaturation(); -// -// where all clauses are optional, and .InSequence()/.After()/ -// .WillOnce() can appear any number of times. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// The MATCHER* family of macros can be used in a namespace scope to -// define custom matchers easily. -// -// Basic Usage -// =========== -// -// The syntax -// -// MATCHER(name, description_string) { statements; } -// -// defines a matcher with the given name that executes the statements, -// which must return a bool to indicate if the match succeeds. Inside -// the statements, you can refer to the value being matched by 'arg', -// and refer to its type by 'arg_type'. -// -// The description string documents what the matcher does, and is used -// to generate the failure message when the match fails. Since a -// MATCHER() is usually defined in a header file shared by multiple -// C++ source files, we require the description to be a C-string -// literal to avoid possible side effects. It can be empty, in which -// case we'll use the sequence of words in the matcher name as the -// description. -// -// For example: -// -// MATCHER(IsEven, "") { return (arg % 2) == 0; } -// -// allows you to write -// -// // Expects mock_foo.Bar(n) to be called where n is even. -// EXPECT_CALL(mock_foo, Bar(IsEven())); -// -// or, -// -// // Verifies that the value of some_expression is even. -// EXPECT_THAT(some_expression, IsEven()); -// -// If the above assertion fails, it will print something like: -// -// Value of: some_expression -// Expected: is even -// Actual: 7 -// -// where the description "is even" is automatically calculated from the -// matcher name IsEven. -// -// Argument Type -// ============= -// -// Note that the type of the value being matched (arg_type) is -// determined by the context in which you use the matcher and is -// supplied to you by the compiler, so you don't need to worry about -// declaring it (nor can you). This allows the matcher to be -// polymorphic. For example, IsEven() can be used to match any type -// where the value of "(arg % 2) == 0" can be implicitly converted to -// a bool. In the "Bar(IsEven())" example above, if method Bar() -// takes an int, 'arg_type' will be int; if it takes an unsigned long, -// 'arg_type' will be unsigned long; and so on. -// -// Parameterizing Matchers -// ======================= -// -// Sometimes you'll want to parameterize the matcher. For that you -// can use another macro: -// -// MATCHER_P(name, param_name, description_string) { statements; } -// -// For example: -// -// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } -// -// will allow you to write: -// -// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); -// -// which may lead to this message (assuming n is 10): -// -// Value of: Blah("a") -// Expected: has absolute value 10 -// Actual: -9 -// -// Note that both the matcher description and its parameter are -// printed, making the message human-friendly. -// -// In the matcher definition body, you can write 'foo_type' to -// reference the type of a parameter named 'foo'. For example, in the -// body of MATCHER_P(HasAbsoluteValue, value) above, you can write -// 'value_type' to refer to the type of 'value'. -// -// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P$n to -// support multi-parameter matchers. -// -// Describing Parameterized Matchers -// ================================= -// -// The last argument to MATCHER*() is a string-typed expression. The -// expression can reference all of the matcher's parameters and a -// special bool-typed variable named 'negation'. When 'negation' is -// false, the expression should evaluate to the matcher's description; -// otherwise it should evaluate to the description of the negation of -// the matcher. For example, -// -// using testing::PrintToString; -// -// MATCHER_P2(InClosedRange, low, hi, -// std::string(negation ? "is not" : "is") + " in range [" + -// PrintToString(low) + ", " + PrintToString(hi) + "]") { -// return low <= arg && arg <= hi; -// } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: is in range [4, 6] -// ... -// Expected: is not in range [2, 4] -// -// If you specify "" as the description, the failure message will -// contain the sequence of words in the matcher name followed by the -// parameter values printed as a tuple. For example, -// -// MATCHER_P2(InClosedRange, low, hi, "") { ... } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: in closed range (4, 6) -// ... -// Expected: not (in closed range (2, 4)) -// -// Types of Matcher Parameters -// =========================== -// -// For the purpose of typing, you can view -// -// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } -// -// as shorthand for -// -// template -// FooMatcherPk -// Foo(p1_type p1, ..., pk_type pk) { ... } -// -// When you write Foo(v1, ..., vk), the compiler infers the types of -// the parameters v1, ..., and vk for you. If you are not happy with -// the result of the type inference, you can specify the types by -// explicitly instantiating the template, as in Foo(5, -// false). As said earlier, you don't get to (or need to) specify -// 'arg_type' as that's determined by the context in which the matcher -// is used. You can assign the result of expression Foo(p1, ..., pk) -// to a variable of type FooMatcherPk. This -// can be useful when composing matchers. -// -// While you can instantiate a matcher template with reference types, -// passing the parameters by pointer usually makes your code more -// readable. If, however, you still want to pass a parameter by -// reference, be aware that in the failure message generated by the -// matcher you will see the value of the referenced object but not its -// address. -// -// Explaining Match Results -// ======================== -// -// Sometimes the matcher description alone isn't enough to explain why -// the match has failed or succeeded. For example, when expecting a -// long string, it can be very helpful to also print the diff between -// the expected string and the actual one. To achieve that, you can -// optionally stream additional information to a special variable -// named result_listener, whose type is a pointer to class -// MatchResultListener: -// -// MATCHER_P(EqualsLongString, str, "") { -// if (arg == str) return true; -// -// *result_listener << "the difference: " -/// << DiffStrings(str, arg); -// return false; -// } -// -// Overloading Matchers -// ==================== -// -// You can overload matchers with different numbers of parameters: -// -// MATCHER_P(Blah, a, description_string1) { ... } -// MATCHER_P2(Blah, a, b, description_string2) { ... } -// -// Caveats -// ======= -// -// When defining a new matcher, you should also consider implementing -// MatcherInterface or using MakePolymorphicMatcher(). These -// approaches require more work than the MATCHER* macros, but also -// give you more control on the types of the value being matched and -// the matcher parameters, which may leads to better compiler error -// messages when the matcher is used wrong. They also allow -// overloading matchers based on parameter types (as opposed to just -// based on the number of parameters). -// -// MATCHER*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// -// More Information -// ================ -// -// To learn more about using these macros, please search for 'MATCHER' -// on -// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md -// -// This file also implements some commonly used argument matchers. More -// matchers can be defined by the user implementing the -// MatcherInterface interface if necessary. -// -// See googletest/include/gtest/gtest-matchers.h for the definition of class -// Matcher, class MatcherInterface, and others. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ - -#include -#include -#include -#include -#include -#include -#include // NOLINT -#include -#include -#include -#include -#include - - -// MSVC warning C5046 is new as of VS2017 version 15.8. -#if defined(_MSC_VER) && _MSC_VER >= 1915 -#define GMOCK_MAYBE_5046_ 5046 -#else -#define GMOCK_MAYBE_5046_ -#endif - -GTEST_DISABLE_MSC_WARNINGS_PUSH_( - 4251 GMOCK_MAYBE_5046_ /* class A needs to have dll-interface to be used by - clients of class B */ - /* Symbol involving type with internal linkage not defined */) - -namespace testing { - -// To implement a matcher Foo for type T, define: -// 1. a class FooMatcherImpl that implements the -// MatcherInterface interface, and -// 2. a factory function that creates a Matcher object from a -// FooMatcherImpl*. -// -// The two-level delegation design makes it possible to allow a user -// to write "v" instead of "Eq(v)" where a Matcher is expected, which -// is impossible if we pass matchers by pointers. It also eases -// ownership management as Matcher objects can now be copied like -// plain values. - -// A match result listener that stores the explanation in a string. -class StringMatchResultListener : public MatchResultListener { - public: - StringMatchResultListener() : MatchResultListener(&ss_) {} - - // Returns the explanation accumulated so far. - std::string str() const { return ss_.str(); } - - // Clears the explanation accumulated so far. - void Clear() { ss_.str(""); } - - private: - ::std::stringstream ss_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener); -}; - -// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION -// and MUST NOT BE USED IN USER CODE!!! -namespace internal { - -// The MatcherCastImpl class template is a helper for implementing -// MatcherCast(). We need this helper in order to partially -// specialize the implementation of MatcherCast() (C++ allows -// class/struct templates to be partially specialized, but not -// function templates.). - -// This general version is used when MatcherCast()'s argument is a -// polymorphic matcher (i.e. something that can be converted to a -// Matcher but is not one yet; for example, Eq(value)) or a value (for -// example, "hello"). -template -class MatcherCastImpl { - public: - static Matcher Cast(const M& polymorphic_matcher_or_value) { - // M can be a polymorphic matcher, in which case we want to use - // its conversion operator to create Matcher. Or it can be a value - // that should be passed to the Matcher's constructor. - // - // We can't call Matcher(polymorphic_matcher_or_value) when M is a - // polymorphic matcher because it'll be ambiguous if T has an implicit - // constructor from M (this usually happens when T has an implicit - // constructor from any type). - // - // It won't work to unconditionally implicit_cast - // polymorphic_matcher_or_value to Matcher because it won't trigger - // a user-defined conversion from M to T if one exists (assuming M is - // a value). - return CastImpl(polymorphic_matcher_or_value, - std::is_convertible>{}, - std::is_convertible{}); - } - - private: - template - static Matcher CastImpl(const M& polymorphic_matcher_or_value, - std::true_type /* convertible_to_matcher */, - std::integral_constant) { - // M is implicitly convertible to Matcher, which means that either - // M is a polymorphic matcher or Matcher has an implicit constructor - // from M. In both cases using the implicit conversion will produce a - // matcher. - // - // Even if T has an implicit constructor from M, it won't be called because - // creating Matcher would require a chain of two user-defined conversions - // (first to create T from M and then to create Matcher from T). - return polymorphic_matcher_or_value; - } - - // M can't be implicitly converted to Matcher, so M isn't a polymorphic - // matcher. It's a value of a type implicitly convertible to T. Use direct - // initialization to create a matcher. - static Matcher CastImpl(const M& value, - std::false_type /* convertible_to_matcher */, - std::true_type /* convertible_to_T */) { - return Matcher(ImplicitCast_(value)); - } - - // M can't be implicitly converted to either Matcher or T. Attempt to use - // polymorphic matcher Eq(value) in this case. - // - // Note that we first attempt to perform an implicit cast on the value and - // only fall back to the polymorphic Eq() matcher afterwards because the - // latter calls bool operator==(const Lhs& lhs, const Rhs& rhs) in the end - // which might be undefined even when Rhs is implicitly convertible to Lhs - // (e.g. std::pair vs. std::pair). - // - // We don't define this method inline as we need the declaration of Eq(). - static Matcher CastImpl(const M& value, - std::false_type /* convertible_to_matcher */, - std::false_type /* convertible_to_T */); -}; - -// This more specialized version is used when MatcherCast()'s argument -// is already a Matcher. This only compiles when type T can be -// statically converted to type U. -template -class MatcherCastImpl > { - public: - static Matcher Cast(const Matcher& source_matcher) { - return Matcher(new Impl(source_matcher)); - } - - private: - class Impl : public MatcherInterface { - public: - explicit Impl(const Matcher& source_matcher) - : source_matcher_(source_matcher) {} - - // We delegate the matching logic to the source matcher. - bool MatchAndExplain(T x, MatchResultListener* listener) const override { - using FromType = typename std::remove_cv::type>::type>::type; - using ToType = typename std::remove_cv::type>::type>::type; - // Do not allow implicitly converting base*/& to derived*/&. - static_assert( - // Do not trigger if only one of them is a pointer. That implies a - // regular conversion and not a down_cast. - (std::is_pointer::type>::value != - std::is_pointer::type>::value) || - std::is_same::value || - !std::is_base_of::value, - "Can't implicitly convert from to "); - - // Do the cast to `U` explicitly if necessary. - // Otherwise, let implicit conversions do the trick. - using CastType = - typename std::conditional::value, - T&, U>::type; - - return source_matcher_.MatchAndExplain(static_cast(x), - listener); - } - - void DescribeTo(::std::ostream* os) const override { - source_matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - source_matcher_.DescribeNegationTo(os); - } - - private: - const Matcher source_matcher_; - }; -}; - -// This even more specialized version is used for efficiently casting -// a matcher to its own type. -template -class MatcherCastImpl > { - public: - static Matcher Cast(const Matcher& matcher) { return matcher; } -}; - -// Template specialization for parameterless Matcher. -template -class MatcherBaseImpl { - public: - MatcherBaseImpl() = default; - - template - operator ::testing::Matcher() const { // NOLINT(runtime/explicit) - return ::testing::Matcher(new - typename Derived::template gmock_Impl()); - } -}; - -// Template specialization for Matcher with parameters. -template