ares_save_options(3)

ares_save_options3

Save configuration values obtained from initialized ares_channel

Usage

#include <ares.h>
int ares_save_options(const ares_channel_t *channel,
                      struct ares_options *options, int *optmask)

Overview

The ares_save_options(3) function saves the channel data identified by channel, into the options struct identified by options, and saves the mask of options which are set to the integer pointer (passed by reference) identified by optmask.

The resultant options and optmask are then able to be passed directly to ares_init_options. When the options are no longer needed, ares_destroy_options should be called to free any associated memory.

Return values

ares_save_options(3) can return any of the following values:

ARES_SUCCESS

The channel data was successfully stored

ARES_ENOMEM

The memory was exhausted

ARES_ENODATA

The channel data identified by channel were invalid.

Note

Since c-ares 1.6.0 the ares_options struct has been "locked" meaning that it won't be extended to cover new functions. This function will remain functioning, but it can only return config data that can be represented in this config struct, which may no longer be the complete set of config options. ares_dup(3) will not have that restriction.

The ares_options struct can not handle potential IPv6 name servers the ares channel might be configured to use. The ares_save_options(3) function will only return IPv4 servers, if any. In order to retrieve all name servers an ares channel might be using, the ares_get_servers(3) function must be used instead.

Releases

10 releases since Debian 5.0 (Lenny); the text changed 3 times.

  1. 5.0
  2. 6.0–8
  3. 9–12
  4. 13–Arch

Availability

ares_save_options(3) was added in c-ares 1.4.0

From c-ares 1.34.9-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.