3 * @brief Routines to maintain a sorted array of keyids.
5 * Copyright 2004 Jonathan McDowell <noodles@earth.li>
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 51
18 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef __KEYARRAY_H__
22 #define __KEYARRAY_H__
28 * @brief A sorted array of keyids
30 * Holds a sorted list of keyids, with room for growth - has details of both
31 * the total size of the array as well as the current number of elements.
34 /** The array of key ids */
36 /** Number of key ids in the array */
38 /** Total size of the array */
43 * @brief Given a key array figure out of a key id is present
44 * @param array Pointer to the key array
45 * @param key The keyid to look for
47 bool array_find(struct keyarray *array, uint64_t key);
50 * @brief Free a key array
51 * @param array Pointer to the key array to free
53 void array_free(struct keyarray *array);
56 * @brief Add a keyid to a key array
57 * @param array Pointer to the key array
58 * @param key The keyid to add
60 * Checks if the key already exists in the key array and if not adds it.
61 * Returns true if the key was added, false if it was found to be already
64 bool array_add(struct keyarray *array, uint64_t key);
66 #endif /* __KEYARRAY_H__ */