Lines Matching full:options
39 void ares_destroy_options(struct ares_options *options) in ares_destroy_options() argument
43 ares_free(options->servers); in ares_destroy_options()
45 for (i = 0; options->domains && i < options->ndomains; i++) { in ares_destroy_options()
46 ares_free(options->domains[i]); in ares_destroy_options()
49 ares_free(options->domains); in ares_destroy_options()
50 ares_free(options->sortlist); in ares_destroy_options()
51 ares_free(options->lookups); in ares_destroy_options()
52 ares_free(options->resolvconf_path); in ares_destroy_options()
53 ares_free(options->hosts_path); in ares_destroy_options()
84 /* Save options from initialized channel */
85 int ares_save_options(ares_channel_t *channel, struct ares_options *options, in ares_save_options() argument
94 * here, as they could have only set options they knew about. in ares_save_options()
100 options->servers = NULL; in ares_save_options()
101 options->domains = NULL; in ares_save_options()
102 options->sortlist = NULL; in ares_save_options()
103 options->lookups = NULL; in ares_save_options()
104 options->resolvconf_path = NULL; in ares_save_options()
105 options->hosts_path = NULL; in ares_save_options()
112 options->flags = (int)channel->flags; in ares_save_options()
118 options->timeout = (int)channel->timeout; in ares_save_options()
122 options->tries = (int)channel->tries; in ares_save_options()
126 options->ndots = (int)channel->ndots; in ares_save_options()
130 options->maxtimeout = (int)channel->maxtimeout; in ares_save_options()
134 options->udp_port = channel->udp_port; in ares_save_options()
137 options->tcp_port = channel->tcp_port; in ares_save_options()
141 options->sock_state_cb = channel->sock_state_cb; in ares_save_options()
142 options->sock_state_cb_data = channel->sock_state_cb_data; in ares_save_options()
146 options->servers = ares_save_opt_servers(channel, &options->nservers); in ares_save_options()
147 if (options->servers == NULL) { in ares_save_options()
153 options->domains = NULL; in ares_save_options()
155 options->domains = ares_malloc(channel->ndomains * sizeof(char *)); in ares_save_options()
156 if (!options->domains) { in ares_save_options()
161 options->domains[i] = ares_strdup(channel->domains[i]); in ares_save_options()
162 if (!options->domains[i]) { in ares_save_options()
163 options->ndomains = (int)i; in ares_save_options()
168 options->ndomains = (int)channel->ndomains; in ares_save_options()
172 options->lookups = ares_strdup(channel->lookups); in ares_save_options()
173 if (!options->lookups && channel->lookups) { in ares_save_options()
179 options->sortlist = NULL; in ares_save_options()
181 options->sortlist = ares_malloc(channel->nsort * sizeof(struct apattern)); in ares_save_options()
182 if (!options->sortlist) { in ares_save_options()
186 options->sortlist[i] = channel->sortlist[i]; in ares_save_options()
189 options->nsort = (int)channel->nsort; in ares_save_options()
193 options->resolvconf_path = ares_strdup(channel->resolvconf_path); in ares_save_options()
194 if (!options->resolvconf_path) { in ares_save_options()
200 options->hosts_path = ares_strdup(channel->hosts_path); in ares_save_options()
201 if (!options->hosts_path) { in ares_save_options()
208 options->socket_send_buffer_size = channel->socket_send_buffer_size; in ares_save_options()
213 options->socket_receive_buffer_size = channel->socket_receive_buffer_size; in ares_save_options()
217 options->ednspsz = (int)channel->ednspsz; in ares_save_options()
221 options->udp_max_queries = (int)channel->udp_max_queries; in ares_save_options()
225 options->qcache_max_ttl = channel->qcache_max_ttl; in ares_save_options()
229 options->evsys = channel->evsys; in ares_save_options()
257 const struct ares_options *options, in ares__init_by_options() argument
266 if (options == NULL) { in ares__init_by_options()
284 channel->evsys = options->evsys; in ares__init_by_options()
288 channel->flags = (unsigned int)options->flags; in ares__init_by_options()
294 if (options->timeout <= 0) { in ares__init_by_options()
297 channel->timeout = (unsigned int)options->timeout; in ares__init_by_options()
303 if (options->timeout > 0) { in ares__init_by_options()
306 channel->timeout = (unsigned int)options->timeout * 1000; in ares__init_by_options()
311 if (options->tries <= 0) { in ares__init_by_options()
314 channel->tries = (size_t)options->tries; in ares__init_by_options()
319 if (options->ndots <= 0) { in ares__init_by_options()
322 channel->ndots = (size_t)options->ndots; in ares__init_by_options()
327 if (options->maxtimeout <= 0) { in ares__init_by_options()
330 channel->maxtimeout = (size_t)options->maxtimeout; in ares__init_by_options()
343 channel->udp_port = options->udp_port; in ares__init_by_options()
347 channel->tcp_port = options->tcp_port; in ares__init_by_options()
351 channel->sock_state_cb = options->sock_state_cb; in ares__init_by_options()
352 channel->sock_state_cb_data = options->sock_state_cb_data; in ares__init_by_options()
356 if (options->socket_send_buffer_size <= 0) { in ares__init_by_options()
359 channel->socket_send_buffer_size = options->socket_send_buffer_size; in ares__init_by_options()
364 if (options->socket_receive_buffer_size <= 0) { in ares__init_by_options()
367 channel->socket_receive_buffer_size = options->socket_receive_buffer_size; in ares__init_by_options()
372 if (options->ednspsz <= 0) { in ares__init_by_options()
375 channel->ednspsz = (size_t)options->ednspsz; in ares__init_by_options()
382 if (optmask & ARES_OPT_DOMAINS && options->ndomains > 0) { in ares__init_by_options()
384 ares_malloc_zero((size_t)options->ndomains * sizeof(char *)); in ares__init_by_options()
388 channel->ndomains = (size_t)options->ndomains; in ares__init_by_options()
389 for (i = 0; i < (size_t)options->ndomains; i++) { in ares__init_by_options()
390 channel->domains[i] = ares_strdup(options->domains[i]); in ares__init_by_options()
399 if (options->lookups == NULL) { in ares__init_by_options()
402 channel->lookups = ares_strdup(options->lookups); in ares__init_by_options()
410 if (optmask & ARES_OPT_SORTLIST && options->nsort > 0) { in ares__init_by_options()
411 channel->nsort = (size_t)options->nsort; in ares__init_by_options()
413 ares_malloc((size_t)options->nsort * sizeof(struct apattern)); in ares__init_by_options()
417 for (i = 0; i < (size_t)options->nsort; i++) { in ares__init_by_options()
418 channel->sortlist[i] = options->sortlist[i]; in ares__init_by_options()
424 if (options->resolvconf_path == NULL) { in ares__init_by_options()
427 channel->resolvconf_path = ares_strdup(options->resolvconf_path); in ares__init_by_options()
436 if (options->hosts_path == NULL) { in ares__init_by_options()
439 channel->hosts_path = ares_strdup(options->hosts_path); in ares__init_by_options()
447 if (options->udp_max_queries <= 0) { in ares__init_by_options()
450 channel->udp_max_queries = (size_t)options->udp_max_queries; in ares__init_by_options()
456 if (options->qcache_max_ttl == 0) { in ares__init_by_options()
459 channel->qcache_max_ttl = options->qcache_max_ttl; in ares__init_by_options()
465 if (options->nservers <= 0) { in ares__init_by_options()
469 status = ares__init_options_servers(channel, options->servers, in ares__init_by_options()
470 (size_t)options->nservers); in ares__init_by_options()