]> the.earth.li Git - onak.git/blobdiff - keyarray.h
Add ability to drop overly large packets
[onak.git] / keyarray.h
index a25ad7120c1ee977465cb68d5f386ce10e4008c6..0a137a618f22f9cbd2325559361a45396fedb816 100644 (file)
@@ -1,9 +1,20 @@
-/*
- * keyarray.h - routines to maintain a sorted array of keyids.
+/**
+ * @file keyarray.h
+ * @brief Routines to maintain a sorted array of keyids.
  *
- * Jonathan McDowell <noodles@earth.li>
+ * Copyright 2004 Jonathan McDowell <noodles@earth.li>
  *
- * Copyright 2004 Project Purple
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 #ifndef __KEYARRAY_H__
 #include <stdbool.h>
 #include <stdint.h>
 
+#include "keystructs.h"
+
+/**
+ * @brief A sorted array of fingerprints
+ *
+ * Holds a sorted list of fingerprints, with room for growth - has details of
+ * both the total size of the array as well as the current number of elements.
+ */
 struct keyarray {
-       uint64_t *keys;
+       /** The array of key fingerprints */
+       struct openpgp_fingerprint *keys;
+       /** Number of fingerprints in the array */
        size_t count;
+       /** Total size of the array */
        size_t size;
 };
 
-bool array_find(struct keyarray *array, uint64_t key);
+/**
+ * @brief Given a key array figure out of a key id is present
+ * @param array Pointer to the key array
+ * @param key The keyid to look for
+ */
+bool array_find(struct keyarray *array, struct openpgp_fingerprint *fp);
+
+/**
+ * @brief Free a key array
+ * @param array Pointer to the key array to free
+ */
 void array_free(struct keyarray *array);
-bool array_add(struct keyarray *array, uint64_t key);
+
+/**
+ * @brief Add a keyid to a key array
+ * @param array Pointer to the key array
+ * @param key The keyid to add
+ *
+ * Checks if the key already exists in the key array and if not adds it.
+ * Returns true if the key was added, false if it was found to be already
+ * present.
+ */
+bool array_add(struct keyarray *array, struct openpgp_fingerprint *fp);
 
 #endif /* __KEYARRAY_H__ */