2 * Copyright (C) 2009, 2014 Internet Systems Consortium, Inc. ("ISC")
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 * PERFORMANCE OF THIS SOFTWARE.
17 /* $Id: resconf.h,v 1.3 2009/09/02 23:48:02 tbox Exp $ */
20 #define IRS_RESCONF_H 1
25 * The IRS resconf module parses the legacy "/etc/resolv.conf" file and
26 * creates the corresponding configuration objects for the DNS library
30 #include <irs/types.h>
33 * A DNS search list specified in the 'domain' or 'search' statements
34 * in the "resolv.conf" file.
36 typedef struct irs_resconf_search {
38 ISC_LINK(struct irs_resconf_search) link;
39 } irs_resconf_search_t;
41 typedef ISC_LIST(irs_resconf_search_t) irs_resconf_searchlist_t;
46 irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp);
48 * Load the resolver configuration file 'filename' in the "resolv.conf" format,
49 * and create a new irs_resconf_t object from the configuration. If the file
50 * is not found ISC_R_FILENOTFOUND is returned with the structure initialized
51 * as if file contained only:
54 * nameserver 127.0.0.1
58 *\li Currently, only the following options are supported:
59 * nameserver, domain, search, sortlist, ndots, and options.
60 * In addition, 'sortlist' is not actually effective; it's parsed, but
61 * the application cannot use the configuration.
64 * \li ISC_R_SUCCESS on success
65 * \li ISC_R_FILENOTFOUND if the file was not found. *confp will be valid.
70 *\li 'mctx' is a valid memory context.
72 *\li 'filename' != NULL
74 *\li 'confp' != NULL && '*confp' == NULL
78 irs_resconf_destroy(irs_resconf_t **confp);
80 * Destroy the resconf object.
84 *\li '*confp' is a valid resconf object.
92 irs_resconf_getnameservers(irs_resconf_t *conf);
94 * Return a list of name server addresses stored in 'conf'.
98 *\li 'conf' is a valid resconf object.
101 irs_resconf_searchlist_t *
102 irs_resconf_getsearchlist(irs_resconf_t *conf);
104 * Return the search list stored in 'conf'.
108 *\li 'conf' is a valid resconf object.
112 irs_resconf_getndots(irs_resconf_t *conf);
114 * Return the 'ndots' value stored in 'conf'.
118 *\li 'conf' is a valid resconf object.
123 #endif /* IRS_RESCONF_H */