summaryrefslogtreecommitdiffstats
path: root/rtrlib/spki/spkitable.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:54:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:54:46 +0000
commitcd7b005519ade8ab6c97fcb21590b71b7d1be6e3 (patch)
treec611a8d0cd5e8f68f41b8c2d16ba580e0f40a38d /rtrlib/spki/spkitable.h
parentInitial commit. (diff)
downloadlibrtr-upstream.tar.xz
librtr-upstream.zip
Adding upstream version 0.8.0.upstream/0.8.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--rtrlib/spki/spkitable.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/rtrlib/spki/spkitable.h b/rtrlib/spki/spkitable.h
new file mode 100644
index 0000000..4158c58
--- /dev/null
+++ b/rtrlib/spki/spkitable.h
@@ -0,0 +1,54 @@
+/*
+ * This file is part of RTRlib.
+ *
+ * This file is subject to the terms and conditions of the MIT license.
+ * See the file LICENSE in the top level directory for more details.
+ *
+ * Website: http://rtrlib.realmv6.org/
+ */
+
+/**
+ * @defgroup mod_spki_h Subject Public Key Info table
+ * @brief The spki_table is an abstract data structure to organize the received Router Key PDUs
+ * from a RPKI-RTR cache server.
+ *
+ * @{
+ */
+
+#ifndef RTR_SPKI_H
+#define RTR_SPKI_H
+
+#include "rtrlib/rtr/rtr.h"
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#define SKI_SIZE 20
+#define SPKI_SIZE 91
+
+struct spki_table;
+
+/**
+ * @brief spki_record.
+ * @param ski Subject Key Identifier
+ * @param asn Origin AS number
+ * @param spki Subject public key info
+ * @param socket Pointer to the rtr_socket this spki_record was received in
+ */
+struct spki_record {
+ uint8_t ski[SKI_SIZE];
+ uint32_t asn;
+ uint8_t spki[SPKI_SIZE];
+ const struct rtr_socket *socket;
+};
+
+/**
+ * @brief A function pointer that is called if an record was added
+ * to the spki_table or was removed from the spki_table.
+ * @param spki_table which was updated.
+ * @param record spki_record that was modified.
+ * @param added True if the record was added, false if the record was removed.
+ */
+typedef void (*spki_update_fp)(struct spki_table *spki_table, const struct spki_record record, const bool added);
+#endif
+/** @} */