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