1 .\" $NetBSD: cdbw.3,v 1.3 2010/11/03 16:17:48 plunky 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
40 .Nd create constant databases
47 .Fa "struct cdbw *cdbw"
50 .Fa "const void *data"
55 .Fa "struct cdbw *cdbw"
56 .Fa "const void *data"
62 .Fa "struct cdbw *cdbw"
69 .Fa "struct cdbw *cdbw"
71 .Fa "const char descr[16]"
72 .Fa "uint32_t (*seedgen)(void)"
75 .Fn cdbw_close "struct cdbw *cdbw"
79 functions are used to create a constant databases for use with
81 Details about the file format, including overhead and limitations,
89 The function returns a handle to pass to the other functions.
92 frees all resources associated with the handle.
95 adds the given (key,value) pair after checking for a duplicate key.
97 adds the given value to the writer without adding a key reference.
98 The returned index can be used in subsequent calls to
100 to add one or more keys pointing to this value.
102 checks for duplicate keys and valid index arguments.
103 On success it adds the given key.
106 computes the database file and writes it to the given descriptor.
107 The function returns an error if the file cannot be written correctly.
110 parameter provides a human readable description of the database content.
113 parameter can be used to override the default PRNG.
114 The function should return a different value for each invokation.
115 The bitwise layout of the output depends on the chosen seed.
122 format first appeared in
129 functions have been written by
130 .An Joerg Sonnenberger Aq joerg@NetBSD.org .