1 /* $NetBSD: alist.h,v 1.8 2025/01/26 16:25:44 christos Exp $ */ 2 3 /* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * SPDX-License-Identifier: MPL-2.0 AND ISC 7 * 8 * This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11 * 12 * See the COPYRIGHT file distributed with this work for additional 13 * information regarding copyright ownership. 14 */ 15 16 /* 17 * Copyright (C) 2001 Nominum, Inc. 18 * 19 * Permission to use, copy, modify, and/or distribute this software for any 20 * purpose with or without fee is hereby granted, provided that the above 21 * copyright notice and this permission notice appear in all copies. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL 24 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY 26 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 27 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 28 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 29 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 30 */ 31 32 #pragma once 33 34 /*! \file isccc/alist.h */ 35 36 #include <stdbool.h> 37 #include <stdio.h> 38 39 #include <isc/lang.h> 40 41 #include <isccc/types.h> 42 43 ISC_LANG_BEGINDECLS 44 45 isccc_sexpr_t * 46 isccc_alist_create(void); 47 48 bool 49 isccc_alist_alistp(isccc_sexpr_t *alist); 50 51 bool 52 isccc_alist_emptyp(isccc_sexpr_t *alist); 53 54 isccc_sexpr_t * 55 isccc_alist_first(isccc_sexpr_t *alist); 56 57 isccc_sexpr_t * 58 isccc_alist_assq(isccc_sexpr_t *alist, const char *key); 59 60 void 61 isccc_alist_delete(isccc_sexpr_t *alist, const char *key); 62 63 isccc_sexpr_t * 64 isccc_alist_define(isccc_sexpr_t *alist, const char *key, isccc_sexpr_t *value); 65 66 isccc_sexpr_t * 67 isccc_alist_definestring(isccc_sexpr_t *alist, const char *key, 68 const char *str); 69 70 isccc_sexpr_t * 71 isccc_alist_definebinary(isccc_sexpr_t *alist, const char *key, 72 isccc_region_t *r); 73 74 isccc_sexpr_t * 75 isccc_alist_lookup(isccc_sexpr_t *alist, const char *key); 76 77 isc_result_t 78 isccc_alist_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp); 79 80 isc_result_t 81 isccc_alist_lookupbinary(isccc_sexpr_t *alist, const char *key, 82 isccc_region_t **r); 83 84 void 85 isccc_alist_prettyprint(isccc_sexpr_t *sexpr, unsigned int indent, 86 FILE *stream); 87 88 ISC_LANG_ENDDECLS 89