X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-ares;a=blobdiff_plain;f=php_ares.c;h=54b0f4cbbd2bf2517eb6d2f89e2b6e6bd24708ff;hp=680c4d9c8cf9cead446a1bb4155f7e7fc8679e48;hb=d200b6a8f6372b2954d330f46dc6814377defe74;hpb=9aea024d8b1de196394cf6b5dc868628d92154b4 diff --git a/php_ares.c b/php_ares.c index 680c4d9..54b0f4c 100644 --- a/php_ares.c +++ b/php_ares.c @@ -553,11 +553,19 @@ local php_ares_options *php_ares_options_ctor(php_ares_options *options, HashTab } if ((SUCCESS == zend_hash_find(ht, "udp_port", sizeof("udp_port"), (void *) &opt)) && is_numeric(opt, &lval)) { options->flags |= ARES_OPT_UDP_PORT; +#ifdef PHP_ARES_CARES + options->strct.udp_port = (unsigned short) lval; +#else options->strct.udp_port = htons((unsigned short) lval); +#endif } if ((SUCCESS == zend_hash_find(ht, "tcp_port", sizeof("tcp_port"), (void *) &opt)) && is_numeric(opt, &lval)) { options->flags |= ARES_OPT_TCP_PORT; +#ifdef PHP_ARES_CARES + options->strct.tcp_port = (unsigned short) lval; +#else options->strct.tcp_port = htons((unsigned short) lval); +#endif } if ((SUCCESS == zend_hash_find(ht, "servers", sizeof("servers"), (void *) &opt)) && (Z_TYPE_PP(opt) == IS_ARRAY) && (i = zend_hash_num_elements(Z_ARRVAL_PP(opt)))) { options->strct.servers = ecalloc(i, sizeof(struct in_addr)); @@ -1097,7 +1105,7 @@ static PHP_FUNCTION(ares_init) RETURN_FALSE; } - ares = emalloc(sizeof(php_ares)); + ares = ecalloc(1, sizeof(php_ares)); TSRMLS_SET_CTX(ares->tsrm_ls); zend_llist_init(&ares->queries, sizeof(php_ares_query *), (llist_dtor_func_t) php_ares_query_llist_dtor, 0); php_ares_options_ctor(&ares->options, opt_array ? Z_ARRVAL_P(opt_array) : NULL); @@ -1829,6 +1837,9 @@ static PHP_MINIT_FUNCTION(ares) REGISTER_LONG_CONSTANT("ARES_FLAG_NOSEARCH", ARES_FLAG_NOSEARCH, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("ARES_FLAG_NOALIASES", ARES_FLAG_NOALIASES, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("ARES_FLAG_NOCHECKRESP", ARES_FLAG_NOCHECKRESP, CONST_PERSISTENT|CONST_CS); +#ifdef ARES_FLAG_EDNS + REGISTER_LONG_CONSTANT("ARES_FLAG_EDNS", ARES_FLAG_EDNS, CONST_PERSISTENT|CONST_CS); +#endif /* * Address Family Constants @@ -2245,6 +2256,15 @@ zend_function_entry ares_functions[] = { PHP_FE(ares_select, ai_ares_select) PHP_FE(ares_fds, ai_ares_fds) PHP_FE(ares_timeout, NULL) +#ifdef HAVE_ARES_SET_LOCAL_DEV + PHP_FE(ares_set_local_dev, NULL) +#endif +#ifdef HAVE_ARES_SET_LOCAL_IP4 + PHP_FE(ares_set_local_ip4, NULL) +#endif +#ifdef HAVE_ARES_SET_LOCAL_IP6 + PHP_FE(ares_set_local_ip6, NULL) +#endif {NULL, NULL, NULL} }; /* }}} */