1/* 2 * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") 3 * 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. 7 * 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. 15 */ 16 17/* $Id: resconf.h,v 1.3 2009/09/02 23:48:02 tbox Exp $ */ 18 19#ifndef IRS_RESCONF_H 20#define IRS_RESCONF_H 1 21 22/*! \file 23 * 24 * \brief 25 * The IRS resconf module parses the legacy "/etc/resolv.conf" file and 26 * creates the corresponding configuration objects for the DNS library 27 * modules. 28 */ 29 30#include <irs/types.h> 31 32/*% 33 * A DNS search list specified in the 'domain' or 'search' statements 34 * in the "resolv.conf" file. 35 */ 36typedef struct irs_resconf_search { 37 char *domain; 38 ISC_LINK(struct irs_resconf_search) link; 39} irs_resconf_search_t; 40 41typedef ISC_LIST(irs_resconf_search_t) irs_resconf_searchlist_t; 42 43ISC_LANG_BEGINDECLS 44 45isc_result_t 46irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp); 47/*%< 48 * Load the resolver configuration file 'filename' in the "resolv.conf" format, 49 * and create a new irs_resconf_t object from the configuration. 50 * 51 * Notes: 52 * 53 *\li Currently, only the following options are supported: 54 * nameserver, domain, search, sortlist, ndots, and options. 55 * In addition, 'sortlist' is not actually effective; it's parsed, but 56 * the application cannot use the configuration. 57 * 58 * Requires: 59 * 60 *\li 'mctx' is a valid memory context. 61 * 62 *\li 'filename' != NULL 63 * 64 *\li 'confp' != NULL && '*confp' == NULL 65 */ 66 67void 68irs_resconf_destroy(irs_resconf_t **confp); 69/*%< 70 * Destroy the resconf object. 71 * 72 * Requires: 73 * 74 *\li '*confp' is a valid resconf object. 75 * 76 * Ensures: 77 * 78 *\li *confp == NULL 79 */ 80 81isc_sockaddrlist_t * 82irs_resconf_getnameservers(irs_resconf_t *conf); 83/*%< 84 * Return a list of name server addresses stored in 'conf'. 85 * 86 * Requires: 87 * 88 *\li 'conf' is a valid resconf object. 89 */ 90 91irs_resconf_searchlist_t * 92irs_resconf_getsearchlist(irs_resconf_t *conf); 93/*%< 94 * Return the search list stored in 'conf'. 95 * 96 * Requires: 97 * 98 *\li 'conf' is a valid resconf object. 99 */ 100 101unsigned int 102irs_resconf_getndots(irs_resconf_t *conf); 103/*%< 104 * Return the 'ndots' value stored in 'conf'. 105 * 106 * Requires: 107 * 108 *\li 'conf' is a valid resconf object. 109 */ 110 111ISC_LANG_ENDDECLS 112 113#endif /* IRS_RESCONF_H */ 114