1 .\" $NetBSD: cdbr.3,v 1.2 2010/04/25 10:32:44 wiz Exp $
3 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Joerg Sonnenberger.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in
16 .\" the documentation and/or other materials provided with the
19 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 .Nd constant database access methods
45 .Fn cdbr_open "const char *path" "int flags"
47 .Fn cdbr_entries "struct cdbr *cdbr"
49 .Fn cdbr_get "struct cdbr *cdbr" "uint32_t index" "const void **data" "size_t *datalen"
52 .Fa "struct cdbr *cdbr"
55 .Fa "const void **data"
59 .Fn cdbr_close "struct cdbr *cdbr"
63 library provides a space efficient (key,value) database based
66 A cdb database is opened for reading by calling
68 The only supported value for
72 The function returns a handle to pass to the other functions.
73 The database is closed by invoking
75 All resources associated with the handle are freed and the memory
82 The number of records in the database can be obtained by calling
84 Records can be obtained by record number using
88 Both functions return 0 on success and update
98 It is the responsibility of the caller of
100 to ensure that the key matches the returned data.
101 The function returns the only possible match, but the database doesn't store
102 the keys to minimize overhead.
111 format first appeared in
118 functions have been written by
119 .An Joerg Sonnenberger Aq joerg@NetBSD.org .