]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Monday, Tuesday
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 30 Jul 2024 21:38:09 +0000 (15:38 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Wed, 31 Jul 2024 18:38:28 +0000 (12:38 -0600)
Just relocating stuff.

105 files changed:
Makefile.am
src/Makefile.am
src/asn1/content_info.h
src/asn1/decode.c
src/asn1/oid.h
src/asn1/signed_data.c
src/asn1/signed_data.h
src/base64.c [moved from src/crypto/base64.c with 99% similarity]
src/base64.h [moved from src/crypto/base64.h with 100% similarity]
src/cache.c [moved from src/cache/local_cache.c with 99% similarity]
src/cache.h [moved from src/cache/local_cache.h with 97% similarity]
src/cachent.c [moved from src/cache/cachent.c with 98% similarity]
src/cachent.h [moved from src/cache/cachent.h with 98% similarity]
src/cert_stack.c
src/cert_stack.h
src/common.h
src/config.c
src/config/incidences.c
src/config/string_array.c
src/extension.c
src/file.c
src/hash.c [moved from src/crypto/hash.c with 99% similarity]
src/hash.h [moved from src/crypto/hash.h with 100% similarity]
src/http.c [moved from src/http/http.c with 98% similarity]
src/http.h [moved from src/http/http.h with 69% similarity]
src/incidence.c [moved from src/incidence/incidence.c with 97% similarity]
src/incidence.h [moved from src/incidence/incidence.h with 100% similarity]
src/init.c
src/log.h
src/main.c
src/object/certificate.c
src/object/crl.c
src/object/manifest.c
src/object/tal.c
src/object/tal.h
src/output_printer.c
src/print_file.c
src/relax_ng.c [moved from src/xml/relax_ng.c with 99% similarity]
src/relax_ng.h [moved from src/xml/relax_ng.h with 100% similarity]
src/resource.c
src/resource/asn.c
src/resource/asn.h
src/resource/ip4.c
src/resource/ip6.c
src/rpp.c
src/rrdp.c
src/rsync.c [moved from src/rsync/rsync.c with 99% similarity]
src/rsync.h [moved from src/rsync/rsync.h with 100% similarity]
src/rtr/db/db_table.c
src/rtr/db/delta.c
src/rtr/db/delta.h
src/rtr/db/vrps.c
src/rtr/db/vrps.h
src/rtr/pdu.h
src/rtr/pdu_stream.h
src/rtr/primitive_writer.h
src/rtr/rtr.c
src/rtr/rtr.h
src/slurm/db_slurm.c
src/slurm/db_slurm.h
src/slurm/slurm_loader.c
src/slurm/slurm_parser.c
src/state.c
src/str_token.c [deleted file]
src/str_token.h [deleted file]
src/thread_pool.c [moved from src/thread/thread_pool.c with 99% similarity]
src/thread_pool.h [moved from src/thread/thread_pool.h with 100% similarity]
src/types/array.h [moved from src/data_structure/common.h with 54% similarity]
src/types/arraylist.h [moved from src/data_structure/array_list.h with 91% similarity]
src/types/asn.h [moved from src/as_number.h with 63% similarity]
src/types/bio_seq.h
src/types/map.c
src/types/map.h
src/types/name.c [moved from src/object/name.c with 99% similarity]
src/types/name.h [moved from src/object/name.h with 87% similarity]
src/types/path.c [moved from src/data_structure/path_builder.c with 98% similarity]
src/types/path.h [moved from src/data_structure/path_builder.h with 86% similarity]
src/types/sorted_array.c [moved from src/sorted_array.c with 99% similarity]
src/types/sorted_array.h [moved from src/sorted_array.h with 92% similarity]
src/types/str.c
src/types/str.h
src/types/url.c
src/types/uthash.h [moved from src/data_structure/uthash.h with 99% similarity]
src/types/vrp.h
src/validation_handler.h
test/Makefile.am
test/base64_test.c [moved from test/crypto/base64_test.c with 99% similarity]
test/cache_test.c [moved from test/cache/local_cache_test.c with 99% similarity]
test/cache_util.c [moved from test/cache/util.c with 97% similarity]
test/cache_util.h [moved from test/cache/util.h with 94% similarity]
test/cachent_test.c [moved from test/cache/cachent_test.c with 98% similarity]
test/hash_test.c [moved from test/crypto/hash_test.c with 82% similarity]
test/mock.c
test/resources/xml/notification.xml [moved from test/xml/notification.xml with 100% similarity]
test/rrdp_test.c
test/rrdp_update_test.c
test/rtr/db/vrps_test.c
test/rtr/pdu_handler_test.c
test/tal_test.c
test/thread_pool_test.c
test/types/map_test.c
test/types/path_test.c [moved from test/data_structure/path_builder_test.c with 99% similarity]
test/types/url_test.c
test/types/uthash_test.c [moved from test/data_structure/uthash_test.c with 99% similarity]
test/xml_test.c

index 99305e9c259e2ff4100917b1bb466473843eae4c..df54e5d58e11d55db97b53dd85a09fbe8294cb57 100644 (file)
@@ -1,14 +1,4 @@
-# GNU wants us to include some files that we really don't want; therefore
-# "foreign". The files are
-#
-# - AUTHORS: This should be inferred from the (automatic) git history, not some
-#   error prone, manually-maintained file!
-# - ChangeLog: This is included in the main page of the site, which can be found
-#   in the gh-pages branch. Don't want to (nor should I) repeat myself.
-# - NEWS: Same as ChangeLog.
-# - README: We prefer the much gayer "README.md" version, so no thanks.
-#
-# Man, GNU conventions need a 21 century overhaul badly.
+# Don't want AUTHORS, ChangeLog, NEWS, README.
 AUTOMAKE_OPTIONS = foreign
 
 SUBDIRS = src man test
index 61be911696c4ee9520974fbcad75454263768cb3..56f16aee3e400ac3351ea1b48fd954ae3cc2b228 100644 (file)
 bin_PROGRAMS = fort
 
-fort_SOURCES = alloc.c alloc.h
-fort_SOURCES += cache/cachent.c cache/cachent.h
-fort_SOURCES += cache/local_cache.c cache/local_cache.h
-fort_SOURCES += log.c log.h
-fort_SOURCES += rsync/rsync.c rsync/rsync.h
-fort_SOURCES += rrdp.c rrdp.h
+fort_SOURCES  = main.c
 
-fort_CFLAGS  = -Wall -Wpedantic -Werror
+fort_SOURCES += algorithm.h algorithm.c
+fort_SOURCES += alloc.h alloc.c
+fort_SOURCES += asn1/content_info.h asn1/content_info.c
+fort_SOURCES += asn1/decode.h asn1/decode.c
+fort_SOURCES += asn1/oid.h asn1/oid.c
+fort_SOURCES += asn1/signed_data.h asn1/signed_data.c
+fort_SOURCES += base64.h base64.c
+fort_SOURCES += cache.c cache.h
+fort_SOURCES += cachent.c cachent.h
+fort_SOURCES += certificate_refs.h certificate_refs.c
+fort_SOURCES += cert_stack.h cert_stack.c
+fort_SOURCES += common.c common.h
+fort_SOURCES += config/boolean.c config/boolean.h
+fort_SOURCES += config/filename_format.h config/filename_format.c
+fort_SOURCES += config/file_type.h config/file_type.c
+fort_SOURCES += config.h config.c
+fort_SOURCES += config/incidences.h config/incidences.c
+fort_SOURCES += config/log_conf.h config/log_conf.c
+fort_SOURCES += config/mode.c config/mode.h
+fort_SOURCES += config/output_format.h config/output_format.c
+fort_SOURCES += config/str.c config/str.h
+fort_SOURCES += config/string_array.h config/string_array.c
+fort_SOURCES += config/types.h
+fort_SOURCES += config/uint.c config/uint.h
+fort_SOURCES += config/work_offline.c config/work_offline.h
+fort_SOURCES += daemon.h daemon.c
+fort_SOURCES += extension.h extension.c
+fort_SOURCES += file.h file.c
+fort_SOURCES += hash.h hash.c
+fort_SOURCES += http.h http.c
+fort_SOURCES += incidence.h incidence.c
+fort_SOURCES += init.h init.c
+fort_SOURCES += json_handler.h json_handler.c
+fort_SOURCES += json_util.c json_util.h
+fort_SOURCES += libcrypto_util.h libcrypto_util.c
+fort_SOURCES += log.h log.c
+fort_SOURCES += nid.h nid.c
+fort_SOURCES += object/bgpsec.h object/bgpsec.c
+fort_SOURCES += object/certificate.h object/certificate.c
+fort_SOURCES += object/crl.h object/crl.c
+fort_SOURCES += object/ghostbusters.h object/ghostbusters.c
+fort_SOURCES += object/manifest.h object/manifest.c
+fort_SOURCES += object/roa.h object/roa.c
+fort_SOURCES += object/signed_object.h object/signed_object.c
+fort_SOURCES += object/tal.h object/tal.c
+fort_SOURCES += object/vcard.h object/vcard.c
+fort_SOURCES += output_printer.h output_printer.c
+fort_SOURCES += print_file.h print_file.c
+fort_SOURCES += relax_ng.c relax_ng.h
+fort_SOURCES += resource/asn.h resource/asn.c
+fort_SOURCES += resource.h resource.c
+fort_SOURCES += resource/ip4.h resource/ip4.c
+fort_SOURCES += resource/ip6.h resource/ip6.c
+fort_SOURCES += rpp.h rpp.c
+fort_SOURCES += rrdp.h rrdp.c
+fort_SOURCES += rsync.h rsync.c
+fort_SOURCES += rtr/db/db_table.c rtr/db/db_table.h
+fort_SOURCES += rtr/db/delta.c rtr/db/delta.h
+fort_SOURCES += rtr/db/deltas_array.c rtr/db/deltas_array.h
+fort_SOURCES += rtr/db/vrps.c rtr/db/vrps.h
+fort_SOURCES += rtr/err_pdu.c rtr/err_pdu.h
+fort_SOURCES += rtr/pdu.c rtr/pdu.h
+fort_SOURCES += rtr/pdu_handler.c rtr/pdu_handler.h
+fort_SOURCES += rtr/pdu_sender.c rtr/pdu_sender.h
+fort_SOURCES += rtr/pdu_stream.c rtr/pdu_stream.h
+fort_SOURCES += rtr/primitive_writer.c rtr/primitive_writer.h
+fort_SOURCES += rtr/rtr.c rtr/rtr.h
+fort_SOURCES += slurm/db_slurm.c slurm/db_slurm.h
+fort_SOURCES += slurm/slurm_loader.c slurm/slurm_loader.h
+fort_SOURCES += slurm/slurm_parser.c slurm/slurm_parser.h
+fort_SOURCES += state.h state.c
+fort_SOURCES += thread_pool.c thread_pool.h
+fort_SOURCES += thread_var.h thread_var.c
+fort_SOURCES += types/address.h types/address.c
+fort_SOURCES += types/arraylist.h
+fort_SOURCES += types/asn.h
+fort_SOURCES += types/bio_seq.c types/bio_seq.h
+fort_SOURCES += types/delta.c types/delta.h
+fort_SOURCES += types/map.h types/map.c
+fort_SOURCES += types/name.h types/name.c
+fort_SOURCES += types/path.h types/path.c
+fort_SOURCES += types/router_key.c types/router_key.h
+fort_SOURCES += types/serial.h types/serial.c
+fort_SOURCES += types/sorted_array.h types/sorted_array.c
+fort_SOURCES += types/str.h types/str.c
+fort_SOURCES += types/url.c types/url.h
+fort_SOURCES += types/uthash.h
+fort_SOURCES += types/vrp.c types/vrp.h
+fort_SOURCES += validation_handler.h validation_handler.c
+
+include asn1/asn1c/Makefile.include
+fort_SOURCES += $(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS)
+
+#fort_CFLAGS  = -Wall -Wpedantic -Werror
+fort_CFLAGS  = -Wall -Wpedantic
 #fort_CFLAGS += $(GCC_WARNS)
 fort_CFLAGS += -std=c99 -D_DEFAULT_SOURCE=1 -D_XOPEN_SOURCE=700 -D_BSD_SOURCE=1
 fort_CFLAGS += -O2 -g $(FORT_FLAGS) ${XML2_CFLAGS}
@@ -17,13 +106,11 @@ fort_LDFLAGS = -rdynamic
 endif
 fort_LDADD   = ${JANSSON_LIBS} ${CURL_LIBS} ${XML2_LIBS}
 
-# I'm tired of scrolling up, but feel free to comment this out.
-GCC_WARNS  = -fmax-errors=1
-
+GCC_WARNS  = -fmax-errors=1 -fanalyzer
 GCC_WARNS += -pedantic-errors -Waddress -Walloc-zero -Walloca
 GCC_WARNS += -Wno-aggressive-loop-optimizations -Warray-bounds=2 -Wbool-compare
 GCC_WARNS += -Wbool-operation -Wno-builtin-declaration-mismatch -Wcast-align
-GCC_WARNS += -Wcast-qual -Wchar-subscripts -Wchkp -Wclobbered -Wcomment
+GCC_WARNS += -Wcast-qual -Wchar-subscripts -Wclobbered -Wcomment
 GCC_WARNS += -Wdangling-else -Wdate-time -Wdisabled-optimization
 GCC_WARNS += -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond
 GCC_WARNS += -Wempty-body -Wenum-compare -Wexpansion-to-defined -Wfloat-equal
@@ -31,26 +118,16 @@ GCC_WARNS += -Wformat -Wformat-nonliteral -Wformat-overflow=2 -Wformat-security
 GCC_WARNS += -Wformat-signedness -Wformat-truncation=2 -Wformat-y2k
 GCC_WARNS += -Wframe-address -Wjump-misses-init -Wignored-qualifiers
 GCC_WARNS += -Wignored-attributes -Wincompatible-pointer-types
-
-# This is a fun one. Write "/* fallthrough */" to prevent a warning whenever
-# switch cases do not break.
 GCC_WARNS += -Wimplicit-fallthrough
-
 GCC_WARNS += -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Winline
 GCC_WARNS += -Wint-in-bool-context -Winvalid-memory-model -Winvalid-pch
 GCC_WARNS += -Wlogical-op -Wlogical-not-parentheses -Wlong-long -Wmain
 GCC_WARNS += -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args
 GCC_WARNS += -Wmisleading-indentation -Wmissing-braces -Wmissing-include-dirs
 GCC_WARNS += -Wnonnull -Wnonnull-compare -Wnormalized -Wnull-dereference
-
-# This one seems to be undocumented.
+# Seems undocumented
 GCC_WARNS += -Wodr
-
-# "Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus simd
-# directive set by user."
-# ... What?
 GCC_WARNS += -Wopenmp-simd
-
 GCC_WARNS += -Woverride-init-side-effects -Woverlength-strings -Wpacked
 GCC_WARNS += -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith
 GCC_WARNS += -Wpointer-compare -Wredundant-decls -Wrestrict -Wreturn-type
@@ -69,18 +146,11 @@ GCC_WARNS += -Wunused-value -Wunused-variable -Wunused-const-variable=2
 GCC_WARNS += -Wunused-but-set-parameter -Wunused-but-set-variable
 GCC_WARNS += -Wvariadic-macros -Wvector-operation-performance -Wvla
 GCC_WARNS += -Wvolatile-register-var -Wwrite-strings
-
-# "Issue a warning when HSAIL cannot be emitted for the compiled function or
-# OpenMP construct."
-# Uh-huh.
 GCC_WARNS += -Whsa
-
-# I don't mind too much increasing these.
-# Just make sure that you know what you're doing.
+# Relatively arbitrary
 GCC_WARNS += -Wlarger-than=2048 -Walloc-size-larger-than=4096
 GCC_WARNS += -Wframe-larger-than=1024 -Wstack-usage=1024
-
 # Can't use because of dependencies: -Waggregate-return
-# Want to add, but needs work: -Wconversion, -Wsign-compare, -Wsign-conversion
+# Want to add, but need work: -Wconversion, -Wsign-compare, -Wsign-conversion
 # Seem to require other compiler features: -Wchkp, -Wstack-protector,
 #     -Wstrict-aliasing
index 89d7e722f6c88ac4976793444fb806e74eeea578..958a7ee288d8a6a1b5cba722ecf52ab1c3e99aa8 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_CONTENT_INFO_H_
-#define SRC_CONTENT_INFO_H_
+#ifndef SRC_ASN1_CONTENT_INFO_H_
+#define SRC_ASN1_CONTENT_INFO_H_
 
 /* Some wrappers for asn1/asn1c/ContentInfo.h. */
 
@@ -8,4 +8,4 @@
 int content_info_load(char const *, struct ContentInfo **);
 void content_info_free(struct ContentInfo *);
 
-#endif /* SRC_CONTENT_INFO_H_ */
+#endif /* SRC_ASN1_CONTENT_INFO_H_ */
index 1de93080e081b7f39f0d7e0a3b938cdda53bfb6e..faa2ad404924d470c45fdc482c0c3b782b8f7e65 100644 (file)
@@ -3,7 +3,7 @@
 #include "asn1/asn1c/ber_decoder.h"
 #include "asn1/asn1c/constraints.h"
 #include "common.h"
-#include "incidence/incidence.h"
+#include "incidence.h"
 #include "log.h"
 
 #define COND_LOG(log, pr) (log ? pr : -EINVAL)
index 4fb051c5abe2f0bd0ab2756a9defa314ba79322b..9aea49931985eabf9603c8f6dd74bfec079621d9 100644 (file)
@@ -1,9 +1,10 @@
-#ifndef SRC_OID_H_
-#define SRC_OID_H_
+#ifndef SRC_ASN1_OID_H_
+#define SRC_ASN1_OID_H_
 
 #include "asn1/asn1c/ANY.h"
 #include "asn1/asn1c/OBJECT_IDENTIFIER.h"
 #include "common.h"
+#include "types/array.h"
 
 /* These objects are expected to live on the stack. */
 struct oid_arcs {
@@ -51,4 +52,4 @@ bool arcs_equal_oids(struct oid_arcs *, asn_oid_arc_t const *, size_t);
  */
 #define ARCS_EQUAL_OIDS(a, b) arcs_equal_oids(a, b, ARRAY_LEN(b))
 
-#endif /* SRC_OID_H_ */
+#endif /* SRC_ASN1_OID_H_ */
index d19d8b126c50a1d011ba430f9d4eaa7aeaeb2f08..a37ea4169f5618d4e6547e80c491672b52aee52a 100644 (file)
@@ -9,7 +9,7 @@
 #include "asn1/decode.h"
 #include "asn1/oid.h"
 #include "config.h"
-#include "crypto/hash.h"
+#include "hash.h"
 #include "log.h"
 #include "object/certificate.h"
 #include "thread_var.h"
index 3ab2d03c2ed87ca3839e33b21d5704f541106299..f166a012d91330a1ee48310978b779457751ca00 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_SIGNED_DATA_H_
-#define SRC_SIGNED_DATA_H_
+#ifndef SRC_ASN1_SIGNED_DATA_H_
+#define SRC_ASN1_SIGNED_DATA_H_
 
 /* Some wrappers for asn1/asn1c/SignedData.h. */
 
@@ -27,4 +27,4 @@ int signed_data_validate(ANY_t *, struct SignedData *, struct ee_cert *);
 
 int get_content_type_attr(struct SignedData *, OBJECT_IDENTIFIER_t **);
 
-#endif /* SRC_SIGNED_DATA_H_ */
+#endif /* SRC_ASN1_SIGNED_DATA_H_ */
similarity index 99%
rename from src/crypto/base64.c
rename to src/base64.c
index c6fb61705e9281f73936d79e718c5e101a81c05a..3469082433851d087d688e418db5ad20af6dcfe5 100644 (file)
@@ -1,4 +1,4 @@
-#include "crypto/base64.h"
+#include "base64.h"
 
 #include <openssl/buffer.h>
 #include <openssl/err.h>
similarity index 100%
rename from src/crypto/base64.h
rename to src/base64.h
similarity index 99%
rename from src/cache/local_cache.c
rename to src/cache.c
index 97ef956481a7e56b2b55d229bdcb121e7364bd2f..ac7fb75d6fd6536bc080a4dd6ad14110d3b4aeb2 100644 (file)
@@ -1,12 +1,10 @@
 /*
- * Current design notes:
- *
  * - We only need to keep nodes for the rsync root.
  * - The tree traverse only needs to touch files.
  * - RRDP needs caging.
  */
 
-#include "cache/local_cache.h"
+#include "cache.h"
 
 #include <ftw.h>
 #include <stdatomic.h>
 #include "file.h"
 #include "json_util.h"
 #include "log.h"
+#include "http.h"
 #include "rrdp.h"
-#include "data_structure/array_list.h"
-#include "data_structure/path_builder.h"
-#include "data_structure/uthash.h"
-#include "http/http.h"
-#include "rsync/rsync.h"
+#include "rsync.h"
+#include "types/arraylist.h"
 #include "types/str.h"
+#include "types/path.h"
 #include "types/url.h"
+#include "types/uthash.h"
 
 /* XXX force RRDP if one RPP fails to validate by rsync? */
 
similarity index 97%
rename from src/cache/local_cache.h
rename to src/cache.h
index 593ee14602e7d20c09204a990925a32c45eaa649..e5378e07172b643de2aee75965adea925f76525c 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SRC_CACHE_LOCAL_CACHE_H_
 #define SRC_CACHE_LOCAL_CACHE_H_
 
-#include "cache/cachent.h"
+#include "cachent.h"
 #include "types/str.h"
 
 void cache_setup(void);                /* Init this module */
similarity index 98%
rename from src/cache/cachent.c
rename to src/cachent.c
index 25921ba8c0045565a1d91f0ece28346e5ea61906..e7f4da0352470cc6f3312c13b765f4394e4775b2 100644 (file)
@@ -1,10 +1,10 @@
-#include "cache/cachent.h"
+#include "cachent.h"
 
 #include "alloc.h"
 #include "config.h"
-#include "data_structure/common.h"
-#include "data_structure/path_builder.h"
 #include "log.h"
+#include "types/array.h"
+#include "types/path.h"
 #include "types/url.h"
 
 struct cache_node *
similarity index 98%
rename from src/cache/cachent.h
rename to src/cachent.h
index 509039a9e90ee2b300c61d8a6000589a68c3220b..e70114e44132bea789467f527ea2e42600322170 100644 (file)
@@ -4,7 +4,7 @@
 /* CACHE ENTity, CACHE elemENT, CACHE componENT */
 
 #include <stdbool.h>
-#include "data_structure/uthash.h"
+#include "types/uthash.h"
 #include "rrdp.h"
 
 /* XXX rename "touched" and "validated" into "preserve"? */
index b1a725fb2957012c7246611fa3e230575e76585f..2eb9e46712c40a07be6ef79a3de1be50054c635b 100644 (file)
@@ -4,11 +4,12 @@
 #include <sys/queue.h>
 
 #include "alloc.h"
-#include "data_structure/array_list.h"
-#include "object/name.h"
+#include "log.h"
 #include "resource.h"
-#include "str_token.h"
 #include "thread_var.h"
+#include "types/arraylist.h"
+#include "types/name.h"
+#include "types/str.h"
 
 enum defer_node_type {
        DNT_SEPARATOR,
index 518b375092e21e03edf4e70ff0a0df238da4fef4..b9c9e248e7e43b87ba9731fcdd39ea4c29ad2a59 100644 (file)
@@ -4,9 +4,9 @@
 #include <openssl/bn.h>
 
 #include "object/certificate.h"
-#include "object/name.h"
 #include "resource.h"
 #include "types/map.h"
+#include "types/name.h"
 
 /*
  * One certificate stack is allocated per validation cycle, and it is used
index 37154f0a3ae819b48697b7a58b552b7434be3204..190b04c7b25af9f2a1f670d0751b8627f2c86f62 100644 (file)
@@ -23,8 +23,6 @@
  */
 #define ENSURE_NEGATIVE(error) (((error) < 0) ? (error) : -(error))
 
-#define ARRAY_LEN(array) (sizeof(array) / sizeof((array)[0]))
-
 bool str_starts_with(char const *, char const *);
 bool str_ends_with(char const *, char const *);
 
index 228706a2fe4eadb2d1b41817080206bee8c843fe..2a86fe7a9265a49e9378a5412b7aa3fb486cef42 100644 (file)
@@ -18,6 +18,7 @@
 #include "init.h"
 #include "json_handler.h"
 #include "log.h"
+#include "types/array.h"
 
 /**
  * To add a member to this structure,
index 99e17c4085d572151d6041bcf600d51f8ffd64be..7d20fe07e357cc3021a5bccd047904c8e130484d 100644 (file)
@@ -1,6 +1,6 @@
 #include "config/incidences.h"
 
-#include "incidence/incidence.h"
+#include "incidence.h"
 
 static void
 incidences_print(struct option_field const *field, void *_value)
index 7293b7f8e99e72875619366fc6285c50fd0f5dbf..ba584b2d558b8bef165194d2e96c44af38ab846e 100644 (file)
@@ -5,7 +5,7 @@
 #include "alloc.h"
 #include "config/str.h"
 #include "log.h"
-#include "str_token.h"
+#include "types/str.h"
 
 void
 string_array_init(struct string_array *array, char const *const *values,
index c3e6060ae2df8ba5877ec814639d19f5d334abe0..7ecdfb729965e915b45fe134705c8cd3fd9399ec 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "cert_stack.h"
 #include "common.h"
-#include "crypto/hash.h"
+#include "hash.h"
 #include "json_util.h"
 #include "libcrypto_util.h"
 #include "log.h"
index e02d64a276bb162f6592f1b7e90730339d65dd0a..3d37337a1eed2995082b1cfa709396a1d3c1ba3c 100644 (file)
@@ -7,8 +7,8 @@
 #include "alloc.h"
 #include "common.h"
 #include "log.h"
-#include "data_structure/path_builder.h"
-#include "data_structure/uthash.h"
+#include "types/path.h"
+#include "types/uthash.h"
 
 int
 file_open(char const *file_name, FILE **result, struct stat *stat)
similarity index 99%
rename from src/crypto/hash.c
rename to src/hash.c
index b6cdbc8a96ca2220721eb85ea230922436d1c392..1155fb32904e7255375e08d84e65eaf4abb43e0a 100644 (file)
@@ -1,4 +1,4 @@
-#include "crypto/hash.h"
+#include "hash.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
similarity index 100%
rename from src/crypto/hash.h
rename to src/hash.h
similarity index 98%
rename from src/http/http.c
rename to src/http.c
index 4091d28e724d736b7983d7befcaf1b3c15c53879..c47253d7fd2d140c3796382b7f468f76dd5e28ac 100644 (file)
@@ -1,13 +1,13 @@
-#include "http/http.h"
+#include "http.h"
 
 #include "alloc.h"
-#include "cache/cache_entity.h"
-#include "cache/local_cache.h"
+#include "cache.h"
 #include "common.h"
 #include "config.h"
-#include "data_structure/uthash.h"
 #include "file.h"
 #include "log.h"
+#include "types/url.h"
+#include "types/uthash.h"
 
 struct http_handler {
        CURL *curl;
similarity index 69%
rename from src/http/http.h
rename to src/http.h
index 981aa1ba2aaaf8fbf1b7a1ca53868d6be68eb770..a8479ab537ab807579518c55f398b1ff0759d69b 100644 (file)
@@ -1,6 +1,7 @@
-#ifndef SRC_HTTP_HTTP_H_
-#define SRC_HTTP_HTTP_H_
+#ifndef SRC_HTTP_H_
+#define SRC_HTTP_H_
 
+#include <stdbool.h>
 #include <curl/curl.h>
 
 int http_init(void);
@@ -9,4 +10,4 @@ void http_cleanup(void);
 int http_download(char const *, char const *, curl_off_t, bool *);
 int http_download_direct(char const *, char const *);
 
-#endif /* SRC_HTTP_HTTP_H_ */
+#endif /* SRC_HTTP_H_ */
similarity index 97%
rename from src/incidence/incidence.c
rename to src/incidence.c
index 7b0c13e1527523453a0c5b57ee33cfbf9858e0f4..2641fcc388bdfc94631a58c180158e718eb9917b 100644 (file)
@@ -1,11 +1,10 @@
-#include "incidence/incidence.h"
+#include "incidence.h"
 
 #include <assert.h>
 
-#include "common.h"
-#include "data_structure/common.h"
 #include "json_util.h"
 #include "log.h"
+#include "types/array.h"
 
 struct incidence {
        const enum incidence_id id;
similarity index 100%
rename from src/incidence/incidence.h
rename to src/incidence.h
index 5cb9ff4bfe4e9d0a44589fd41aeb94a9f86ef861..22972756b1649e8d7386e052e2cac599d97cad7c 100644 (file)
@@ -1,9 +1,9 @@
 #include "init.h"
 
 #include "config.h"
-#include "data_structure/path_builder.h"
-#include "http/http.h"
+#include "http.h"
 #include "log.h"
+#include "types/path.h"
 
 static int
 fetch_url(char const *url, char const *filename)
index a8ac304dcc527c0e72d3e51389f01f9864a14a62..cde4010e79385a9b04533bff8f9b57e76e139feb 100644 (file)
--- a/src/log.h
+++ b/src/log.h
@@ -4,7 +4,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include "incidence/incidence.h"
+#include "incidence.h"
 
 /*
  * According to BSD style, __dead is supposed to be defined in sys/cdefs.h,
index 7f69d0a7812d8de737d739f3b3faceb3bce7b329..23161fe98d19dc2eeb60cbb569d4c34edcd04fef 100644 (file)
@@ -1,17 +1,17 @@
 #include <errno.h>
 
 #include "config.h"
-#include "crypto/hash.h"
 #include "extension.h"
-#include "http/http.h"
-#include "incidence/incidence.h"
+#include "hash.h"
+#include "http.h"
+#include "incidence.h"
 #include "log.h"
 #include "nid.h"
 #include "print_file.h"
+#include "relax_ng.h"
 #include "rtr/db/vrps.h"
 #include "rtr/rtr.h"
 #include "thread_var.h"
-#include "xml/relax_ng.h"
 
 static int
 fort_standalone(void)
index 293bad1250d3031f3d967611fc93c8b39b404bec..06a21cbc8e1eb88a95d9ee2bfd54e5b99aeb0eb9 100644 (file)
 #include "asn1/asn1c/IPAddrBlocks.h"
 #include "asn1/decode.h"
 #include "asn1/oid.h"
-#include "cache/local_cache.h"
+#include "cache.h"
 #include "cert_stack.h"
 #include "config.h"
-#include "crypto/hash.h"
+#include "hash.h"
 #include "types/str.h"
 #include "extension.h"
-#include "incidence/incidence.h"
+#include "incidence.h"
 #include "log.h"
 #include "nid.h"
 #include "object/bgpsec.h"
 #include "object/manifest.h"
-#include "object/name.h"
 #include "object/signed_object.h"
 #include "rrdp.h"
-#include "str_token.h"
 #include "thread_var.h"
+#include "types/name.h"
+#include "types/str.h"
 
 /*
  * The X509V3_EXT_METHOD that references NID_sinfo_access uses the AIA item.
@@ -1873,7 +1873,7 @@ certificate_traverse(struct rpp *rpp_parent, struct cache_mapping *cert_map)
        if (error)
                goto revert_cert;
 
-       sia_uris_init(&sia_uris);
+       sias_init(&sia_uris);
        error = (certype == CERTYPE_TA)
            ? certificate_validate_extensions_ta(cert, &sia_uris, &policy)
            : certificate_validate_extensions_ca(cert, &sia_uris, &policy,
@@ -1881,7 +1881,7 @@ certificate_traverse(struct rpp *rpp_parent, struct cache_mapping *cert_map)
        if (error)
                goto revert_uris;
 
-       error = cache_download_alt(&sia_uris, MAP_NOTIF, NULL, NULL);
+       error = cache_download_alt(&sia_uris, NULL, NULL);
        if (error)
                goto revert_uris;
 
index 4b0aa8895a2530d4f2ca66dd261d50fe962447df..74781073221c52203deb2ec8f8e14da89bf5717b 100644 (file)
@@ -7,8 +7,8 @@
 #include "algorithm.h"
 #include "extension.h"
 #include "log.h"
-#include "object/name.h"
 #include "thread_var.h"
+#include "types/name.h"
 
 static int
 __crl_load(struct cache_mapping *map, X509_CRL **result)
index a898a5e06dac25b58a5935de69e5e93697f81483..a47afe5f8b8595b8a52b63caed1510153bc48e6f 100644 (file)
@@ -7,7 +7,7 @@
 #include "asn1/decode.h"
 #include "asn1/oid.h"
 #include "common.h"
-#include "crypto/hash.h"
+#include "hash.h"
 #include "log.h"
 #include "object/certificate.h"
 #include "object/crl.h"
index 2002c372a5024f31977a5a5684539b9dc1db6377..81e827c8ebcfa5f6b4c55b290b0a9d622f8dfd35 100644 (file)
@@ -7,18 +7,19 @@
 #include <time.h>
 
 #include "alloc.h"
+#include "base64.h"
+#include "cache.h"
 #include "cert_stack.h"
 #include "common.h"
 #include "config.h"
 #include "file.h"
 #include "log.h"
+#include "object/certificate.h"
+#include "rtr/db/vrps.h"
 #include "state.h"
 #include "thread_var.h"
+#include "types/str.h"
 #include "validation_handler.h"
-#include "crypto/base64.h"
-#include "object/certificate.h"
-#include "rtr/db/vrps.h"
-#include "cache/local_cache.h"
 
 typedef int (*foreach_map_cb)(struct tal *, struct cache_mapping *, void *);
 
@@ -267,7 +268,7 @@ do_file_validation(void *arg)
                goto end;
 
        args.db = db_table_create();
-       thread->error = cache_download_urls(&args.tal.urls,
+       thread->error = cache_download_uri(&args.tal.urls,
            __handle_tal_map, &args);
        if (thread->error) {
                pr_op_err("None of the URIs of the TAL '%s' yielded a successful traversal.",
index 46eaabda424300b72d977b6d23e2ea57b5073a52..9d9f8022cd4ae841c1f00fde6d7baaa79133aa74 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef TAL_OBJECT_H_
-#define TAL_OBJECT_H_
+#ifndef SRC_OBJECT_TAL_H_
+#define SRC_OBJECT_TAL_H_
 
 /* This is RFC 8630. */
 
@@ -13,4 +13,4 @@ void tal_get_spki(struct tal *, unsigned char const **, size_t *);
 
 struct db_table *perform_standalone_validation(void);
 
-#endif /* TAL_OBJECT_H_ */
+#endif /* SRC_OBJECT_TAL_H_ */
index c4f8fb8d17a1b87112627c73891f13ad0ebed47f..980aba111bc29253252fdd3dba017ada6b12da63 100644 (file)
@@ -1,8 +1,8 @@
 #include "output_printer.h"
 
+#include "base64.h"
 #include "common.h"
 #include "config.h"
-#include "crypto/base64.h"
 #include "file.h"
 #include "log.h"
 #include "types/vrp.h"
index 3a80a158f12a9872ff91f6f3bc730d26b672ad83..57abee2da47646f718d6d46368a3b5696070a543 100644 (file)
@@ -7,12 +7,12 @@
 #include "asn1/content_info.h"
 #include "common.h"
 #include "config.h"
-#include "data_structure/path_builder.h"
 #include "file.h"
 #include "log.h"
-#include "rsync/rsync.h"
+#include "rsync.h"
 #include "types/bio_seq.h"
 #include "types/map.h"
+#include "types/path.h"
 
 #define HDRSIZE 32
 
similarity index 99%
rename from src/xml/relax_ng.c
rename to src/relax_ng.c
index 60c57e1adade17fc3c6e39ce78c9ae2d87b2bcfa..e3d909e616f170ea36512bd60d25132e13efd5a2 100644 (file)
@@ -1,4 +1,4 @@
-#include "xml/relax_ng.h"
+#include "relax_ng.h"
 
 #include <stdarg.h>
 #include <stddef.h>
similarity index 100%
rename from src/xml/relax_ng.h
rename to src/relax_ng.h
index 33ee85e639c88b5f32ac0b82c53d76dc2a1319d2..7ecb8405bac494c54ececdeb6b7230815bfcb56c 100644 (file)
@@ -7,9 +7,9 @@
 #include "log.h"
 #include "resource/ip4.h"
 #include "resource/ip6.h"
-#include "sorted_array.h"
 #include "thread_var.h"
 #include "types/address.h"
+#include "types/sorted_array.h"
 
 /* The resources we extracted from one certificate. */
 struct resources {
index cdc513463070adc6cb3671672ee1c7bf212a9f9f..ace6c894fb299c1036fd662c316c3cf0bc2636e9 100644 (file)
@@ -1,7 +1,7 @@
 #include "resource/asn.h"
 
 #include "log.h"
-#include "sorted_array.h"
+#include "types/sorted_array.h"
 
 struct asn_cb {
        foreach_asn_cb cb;
index 058cbd33be2be785dcf228761215ed827d53d03d..784a75fa0fe8a8af672548eaff20b1c008ec43fe 100644 (file)
@@ -3,8 +3,8 @@
 
 #include <stdbool.h>
 
-#include "as_number.h"
 #include "asn1/asn1c/ASId.h"
+#include "types/asn.h"
 
 /*
  * Implementation note: This is just a casted struct sorted_array.
index 4bab3fa3c5107057ffea1287d4164b241d25d657..57ec2a16ae5a2dc8ed0c028716a00c5608e5d6b8 100644 (file)
@@ -1,6 +1,6 @@
 #include "resource/ip4.h"
 
-#include "sorted_array.h"
+#include "types/sorted_array.h"
 
 struct r4_node {
        uint32_t min; /* This is an IPv4 address in host byte order */
index aad0aaa10360e57a330b1ca15899bfcb0955ccf7..6b6b96ade6b7ed3f4138221dbb5cf19038ec8b91 100644 (file)
@@ -1,6 +1,6 @@
 #include "resource/ip6.h"
 
-#include "sorted_array.h"
+#include "types/sorted_array.h"
 
 static int
 addr_cmp(struct in6_addr const *a, struct in6_addr const *b)
index 85d5bb76b1bd545316ea651ada873eaa51699140..e165bb0dfcaa769f3cc47293830f1569c5fb23b1 100644 (file)
--- a/src/rpp.c
+++ b/src/rpp.c
@@ -2,13 +2,13 @@
 
 #include "alloc.h"
 #include "cert_stack.h"
-#include "data_structure/array_list.h"
 #include "log.h"
 #include "object/certificate.h"
 #include "object/crl.h"
 #include "object/ghostbusters.h"
 #include "object/roa.h"
 #include "thread_var.h"
+#include "types/arraylist.h"
 #include "types/map.h"
 
 /** A Repository Publication Point (RFC 6481), as described by some manifest. */
index 9c9f46b0591f5513fe30f32b90abffa65ca1299f..0332d05f56a5a09d112dfbca5898e650af8f50de 100644 (file)
@@ -4,19 +4,18 @@
 #include <openssl/evp.h>
 
 #include "alloc.h"
-#include "cache/local_cache.h"
+#include "base64.h"
+#include "cache.h"
 #include "common.h"
 #include "config.h"
 #include "file.h"
+#include "hash.h"
+#include "http.h"
 #include "json_util.h"
 #include "log.h"
+#include "relax_ng.h"
 #include "thread_var.h"
-#include "http/http.h"
-#include "cache/cachent.h"
-#include "crypto/base64.h"
-#include "crypto/hash.h"
 #include "types/url.h"
-#include "xml/relax_ng.h"
 
 /* RRDP's XML namespace */
 #define RRDP_NAMESPACE         "http://www.ripe.net/rpki/rrdp"
similarity index 99%
rename from src/rsync/rsync.c
rename to src/rsync.c
index 54476516c3021fbcb718d47e283a29f8b29094bd..9d4839cf94deeb19c0a52e402476a1a61bb0675c 100644 (file)
@@ -1,4 +1,4 @@
-#include "rsync/rsync.h"
+#include "rsync.h"
 
 #include <errno.h>
 #include <fcntl.h>
similarity index 100%
rename from src/rsync/rsync.h
rename to src/rsync.h
index f2736e4a62c0cd7be840c152d278c84a2ce5f3ea..abb1ef49c4ff968a25d8e73f53db147538413ca3 100644 (file)
@@ -3,8 +3,8 @@
 #include <errno.h>
 
 #include "alloc.h"
-#include "data_structure/uthash.h"
 #include "log.h"
+#include "types/uthash.h"
 
 struct hashable_roa {
        struct vrp data;
index 1689e3f534a408b3b9d1726aea5e80431e679fb8..1ca822bac10e41f5297f27eac362923425f0016a 100644 (file)
@@ -3,8 +3,9 @@
 #include <stdatomic.h>
 
 #include "alloc.h"
-#include "data_structure/array_list.h"
+#include "log.h"
 #include "types/address.h"
+#include "types/arraylist.h"
 
 struct delta_v4 {
        uint32_t as;
index cdaa9bcb2c832901b795edcf5e85a240740fa9f1..1a0bc96287f13f8c429c1e74c8b860442550912d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_DELTA_H_
-#define SRC_DELTA_H_
+#ifndef SRC_RTR_DB_DELTA_H_
+#define SRC_RTR_DB_DELTA_H_
 
 #include "types/delta.h"
 
@@ -18,4 +18,4 @@ int deltas_foreach(struct deltas *, delta_vrp_foreach_cb,
     delta_router_key_foreach_cb, void *);
 void deltas_print(struct deltas *);
 
-#endif /* SRC_DELTA_H_ */
+#endif /* SRC_RTR_DB_DELTA_H_ */
index 97a95175832b4aa6155785ea7e3e5ee655679b10..3ba4a73d085455c843f98f300a049c94e03db2ff 100644 (file)
@@ -6,7 +6,7 @@
 #include "alloc.h"
 #include "common.h"
 #include "config.h"
-#include "data_structure/array_list.h"
+#include "log.h"
 #include "object/tal.h"
 #include "output_printer.h"
 #include "rtr/db/db_table.h"
index 0020f6d1a63c284d208e61255c1d0e894c13d677..967259facead0f3da30244b3d650ef4e0aded6c2 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_VRPS_H_
-#define SRC_VRPS_H_
+#ifndef SRC_RTR_DB_VRPS_H_
+#define SRC_RTR_DB_VRPS_H_
 
 /*
  * "VRPs" = "Validated ROA Payloads." See RFC 6811.
@@ -7,9 +7,9 @@
  * This module stores VRPs and their serials.
  */
 
-#include "as_number.h"
 #include "rtr/db/deltas_array.h"
 #include "types/address.h"
+#include "types/asn.h"
 
 int vrps_init(void);
 void vrps_destroy(void);
@@ -36,4 +36,4 @@ uint16_t get_current_session_id(uint8_t);
 
 void vrps_print_base(void);
 
-#endif /* SRC_VRPS_H_ */
+#endif /* SRC_RTR_DB_VRPS_H_ */
index b25c1dda00ef69d48035d9c567dd0b465e15f4cd..9b5be6752c7f808c2f104e627afd68062da1971d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef RTR_PDU_H_
-#define RTR_PDU_H_
+#ifndef SRC_RTR_PDU_H_
+#define SRC_RTR_PDU_H_
 
 #include <stddef.h>
 #include <stdio.h>
@@ -79,4 +79,4 @@ rtrpdu_error_report_len(uint32_t errpdu_len, uint32_t errmsg_len)
            + errmsg_len;
 }
 
-#endif /* RTR_PDU_H_ */
+#endif /* SRC_RTR_PDU_H_ */
index 4622291427708a06c6999461d9d7f40ea44993f7..e869454fab25837fd1db66cf5186575ddcce6edc 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef SRC_RTR_PDU_STREAM_H_
 #define SRC_RTR_PDU_STREAM_H_
 
-#include "data_structure/array_list.h"
 #include "rtr/pdu.h"
 #include "rtr/rtr.h"
 
index f1b541ad14402d623ab9c72d70f2711bf4d6c46e..c8a4254420708421884f1c3207ca6972d998a9d5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef RTR_PRIMITIVE_WRITER_H_
-#define RTR_PRIMITIVE_WRITER_H_
+#ifndef SRC_RTR_PRIMITIVE_WRITER_H_
+#define SRC_RTR_PRIMITIVE_WRITER_H_
 
 #include <arpa/inet.h>
 #include <netdb.h>
@@ -12,4 +12,4 @@ unsigned char *write_uint32(unsigned char *, uint32_t);
 unsigned char *write_in_addr(unsigned char *, struct in_addr);
 unsigned char *write_in6_addr(unsigned char *, struct in6_addr const *);
 
-#endif /* RTR_PRIMITIVE_WRITER_H_ */
+#endif /* SRC_RTR_PRIMITIVE_WRITER_H_ */
index 69d9e96a4881b71d479de8e1fd07f1d418803331..ed0777b49a51a3c1693f9948d7a70c17faa0454f 100644 (file)
@@ -6,15 +6,16 @@
 
 #include "alloc.h"
 #include "config.h"
-#include "data_structure/array_list.h"
+#include "log.h"
 #include "rtr/db/vrps.h"
 #include "rtr/err_pdu.h"
 #include "rtr/pdu.h"
 #include "rtr/pdu_handler.h"
 #include "rtr/pdu_sender.h"
 #include "rtr/pdu_stream.h"
-#include "thread/thread_pool.h"
+#include "thread_pool.h"
 #include "types/address.h"
+#include "types/arraylist.h"
 #include "types/serial.h"
 
 struct rtr_server {
index f85aa16fa8b8f85025fcfb0fac641d955f15e62d..ada4222dd42ab27b5cfe305963e6c4285361478b 100644 (file)
@@ -1,9 +1,9 @@
-#ifndef RTR_RTR_H_
-#define RTR_RTR_H_
+#ifndef SRC_RTR_RTR_H_
+#define SRC_RTR_RTR_H_
 
 int rtr_start(void);
 void rtr_stop(void);
 
 void rtr_notify(void);
 
-#endif /* RTR_RTR_H_ */
+#endif /* SRC_RTR_RTR_H_ */
index 44d38dcaba18311f820df596145b2220e47e54df..faf7b2b82c2f516458a8922e745bbd6ef3355a82 100644 (file)
@@ -4,9 +4,10 @@
 #include <time.h>
 
 #include "alloc.h"
+#include "base64.h"
 #include "common.h"
-#include "crypto/base64.h"
-#include "data_structure/array_list.h"
+#include "log.h"
+#include "types/arraylist.h"
 #include "types/router_key.h"
 
 struct slurm_prefix_wrap {
index 69940dfd7fd7172104fe05e01a6f108414c11c29..8755cd37820a5cac6021c39b2a52cbb96759a7a9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_SLURM_db_slurm_H_
-#define SRC_SLURM_db_slurm_H_
+#ifndef SRC_SLURM_DB_SLURM_H_
+#define SRC_SLURM_DB_SLURM_H_
 
 #include <openssl/evp.h>
 #include <sys/queue.h>
@@ -82,4 +82,4 @@ void db_slurm_destroy(struct db_slurm *);
 
 void db_slurm_get_csum_list(struct db_slurm *, struct slurm_csum_list *);
 
-#endif /* SRC_SLURM_db_slurm_H_ */
+#endif /* SRC_SLURM_DB_SLURM_H_ */
index 06e498198f7ed1eb70cc56fb7f28d2ea0e70dd1b..5438638cd111d154e1094f2134bf9c099081a195 100644 (file)
@@ -7,7 +7,7 @@
 #include "log.h"
 #include "config.h"
 #include "common.h"
-#include "crypto/hash.h"
+#include "hash.h"
 #include "slurm/slurm_parser.h"
 
 #define SLURM_FILE_EXTENSION   ".slurm"
index 40898814ac019f30d16133795ae34f2514937789..00ddcaddedca22bd47d2828f58da6707fef764a8 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "algorithm.h"
 #include "alloc.h"
-#include "crypto/base64.h"
+#include "base64.h"
 #include "json_util.h"
 #include "log.h"
 #include "slurm/db_slurm.h"
index c36a67c7694949747bcb11b6cd5c40c1f2bff8cb..a72347769be7dfe24f5ee6b0e161e4e4fd795798 100644 (file)
@@ -1,7 +1,7 @@
 #include "state.h"
 
 #include "alloc.h"
-#include "cache/local_cache.h"
+#include "cache.h"
 #include "cert_stack.h"
 #include "log.h"
 #include "thread_var.h"
diff --git a/src/str_token.c b/src/str_token.c
deleted file mode 100644 (file)
index 9f01dc8..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-#include "str_token.h"
-
-#include <openssl/bio.h>
-#include <stdint.h>
-
-#include "alloc.h"
-#include "log.h"
-
-/**
- * Does not assume that @string is NULL-terminated.
- */
-static char *
-string_clone(void const *string, size_t size)
-{
-       char *result;
-
-       result = pmalloc(size + 1);
-
-       memcpy(result, string, size);
-       result[size] = '\0';
-
-       return result;
-}
-
-int
-ia5s2string(ASN1_IA5STRING *ia5, char **result)
-{
-       if (ia5->flags & ASN1_STRING_FLAG_BITS_LEFT)
-               return pr_val_err("CRL URI IA5String has unused bits.");
-
-       *result = string_clone(ia5->data, ia5->length);
-       return 0;
-}
-
-int
-BN2string(BIGNUM *bn, char **_result)
-{
-       BIO *bio;
-       uint64_t written;
-       char *result;
-
-       /* Callers can call free() whether this function fails or not. */
-       *_result = NULL;
-
-       bio = BIO_new(BIO_s_mem());
-       if (bio == NULL)
-               return val_crypto_err("Cannot create a BIO.");
-
-       if (BN_print(bio, bn) == 0) {
-               BIO_free(bio);
-               return val_crypto_err("Unable to print the BIGNUM into a BIO");
-       }
-
-       written = BIO_number_written(bio);
-       result = pmalloc(written + 1);
-
-       BIO_read(bio, result, written);
-       result[written] = '\0';
-
-       BIO_free(bio);
-       *_result = result;
-       return 0;
-}
-
-void
-string_tokenizer_init(struct string_tokenizer *tokenizer, char const *str,
-    size_t str_len, unsigned char separator)
-{
-       tokenizer->str = str;
-       tokenizer->str_len = str_len;
-       tokenizer->separator = separator;
-       tokenizer->start = 0;
-       tokenizer->end = 0;
-}
-
-/**
- * Returns whether a new token was found.
- */
-bool
-string_tokenizer_next(struct string_tokenizer *tokenizer)
-{
-       size_t end = tokenizer->end;
-
-       if (end == tokenizer->str_len)
-               return false;
-
-       /* Ignore "empty" tokens */
-       while (tokenizer->str[end] == tokenizer->separator) {
-               end++;
-               if (end == tokenizer->str_len) {
-                       tokenizer->start = end;
-                       tokenizer->end = end;
-                       return false;
-               }
-       }
-
-       tokenizer->start = end;
-
-       for (; end < tokenizer->str_len; end++)
-               if (tokenizer->str[end] == tokenizer->separator)
-                       break;
-
-       tokenizer->end = end;
-       return true;
-}
-
-/**
- * Returns whether the tokens described by @t1 and @t2 are identical.
- */
-bool
-token_equals(struct string_tokenizer *t1, struct string_tokenizer *t2)
-{
-       size_t t1len = t1->end - t1->start;
-       size_t t2len = t2->end - t2->start;
-       return (t1len == t2len)
-           ? (memcmp(t1->str + t1->start, t2->str + t2->start, t1len) == 0)
-           : false;
-}
-
-char *
-token_read(struct string_tokenizer *tokenizer)
-{
-       return string_clone(tokenizer->str + tokenizer->start,
-           tokenizer->end - tokenizer->start);
-}
-
-size_t
-token_count(struct string_tokenizer *tokenizer)
-{
-       struct string_tokenizer copy;
-       size_t count;
-
-       string_tokenizer_init(&copy, tokenizer->str, tokenizer->str_len,
-           tokenizer->separator);
-
-       count = 0;
-       while (string_tokenizer_next(&copy))
-               count++;
-
-       return count;
-}
diff --git a/src/str_token.h b/src/str_token.h
deleted file mode 100644 (file)
index aaaf10d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef SRC_STR_TOKEN_H_
-#define SRC_STR_TOKEN_H_
-
-#include <openssl/asn1.h>
-#include <openssl/bn.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-int ia5s2string(ASN1_IA5STRING *, char **);
-int BN2string(BIGNUM *, char **);
-
-/* This file is named "str_token.h" because "string.h" collides with <string.h>. */
-
-/**
- * Do not modify fields directly; this should be private.
- *
- * This is more or less like strtok(), except it doesn't modify the string at
- * any point.
- */
-struct string_tokenizer {
-       /** String we're tokenizing. */
-       char const *str;
-       size_t str_len;
-       /** Token delimiter. */
-       unsigned char separator;
-       /** Offset of the first character of the current token. */
-       size_t start;
-       /** Offset of the last character of the current token + 1. */
-       size_t end;
-};
-
-void string_tokenizer_init(struct string_tokenizer *, char const *, size_t,
-    unsigned char);
-bool string_tokenizer_next(struct string_tokenizer *);
-bool token_equals(struct string_tokenizer *, struct string_tokenizer *);
-char *token_read(struct string_tokenizer *);
-size_t token_count(struct string_tokenizer *);
-
-#endif /* SRC_STR_TOKEN_H_ */
similarity index 99%
rename from src/thread/thread_pool.c
rename to src/thread_pool.c
index 7ec30d102fcd8f43583a21c4a3dd6447b96f5656..447fa5ff9030485bc7864a35cc7b5e3664416bc9 100644 (file)
@@ -1,4 +1,4 @@
-#include "thread/thread_pool.h"
+#include "thread_pool.h"
 
 #include <sys/queue.h>
 
similarity index 100%
rename from src/thread/thread_pool.h
rename to src/thread_pool.h
similarity index 54%
rename from src/data_structure/common.h
rename to src/types/array.h
index f1ffa8f5be9e9756c63d9443b6c618d7f57bbec3..2e8f68b72c5b3fba9dfae7bedb982c5dc2fe48d0 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_DATA_STRUCTURE_COMMON_H_
-#define SRC_DATA_STRUCTURE_COMMON_H_
+#ifndef SRC_TYPES_ARRAY_H_
+#define SRC_TYPES_ARRAY_H_
 
 #include <stddef.h>
 #include <stdio.h>
@@ -10,5 +10,6 @@
 #include <unistd.h>
 
 typedef size_t array_index;
+#define ARRAY_LEN(array) (sizeof(array) / sizeof((array)[0]))
 
-#endif /* SRC_DATA_STRUCTURE_COMMON_H_ */
+#endif /* SRC_TYPES_ARRAY_H_ */
similarity index 91%
rename from src/data_structure/array_list.h
rename to src/types/arraylist.h
index 7777ec2593f0aa3f332b9fa635963db3148b89cb..415ec85996afdce40d7ff142f05034dd2e91e44c 100644 (file)
@@ -1,8 +1,7 @@
-#ifndef SRC_DATA_STRUCTURE_ARRAY_LIST_H_
-#define SRC_DATA_STRUCTURE_ARRAY_LIST_H_
+#ifndef SRC_TYPES_ARRAYLIST_H_
+#define SRC_TYPES_ARRAYLIST_H_
 
-#include "data_structure/common.h"
-#include "log.h"
+#include "types/array.h"
 
 #define DEFINE_ARRAY_LIST_STRUCT(name, elem_type)                      \
        struct name {                                                   \
@@ -75,4 +74,4 @@
        (index)++                                                       \
 )
 
-#endif /* SRC_DATA_STRUCTURE_ARRAY_LIST_H_ */
+#endif /* SRC_TYPES_ARRAYLIST_H_ */
similarity index 63%
rename from src/as_number.h
rename to src/types/asn.h
index 28aec481e3662607f78ff9c6d17679f1a4932781..2a90bac07848ee9d1f8b2e94081dda53c100d041 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_AS_NUMBER_H_
-#define SRC_AS_NUMBER_H_
+#ifndef SRC_TYPES_ASN_H_
+#define SRC_TYPES_ASN_H_
 
 #include <arpa/inet.h>
 #include <netdb.h>
@@ -11,4 +11,4 @@ struct asn_range {
        uint32_t max;
 };
 
-#endif /* SRC_AS_NUMBER_H_ */
+#endif /* SRC_TYPES_ASN_H_ */
index ad3ba81926cce4d7b9cbfe8363494895b83341fb..86280bcfe61de6d94bd859bdaa0bdcdd23556614 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef TEST_TYPES_BIO_SEQ_H_
-#define TEST_TYPES_BIO_SEQ_H_
+#ifndef SRC_TYPES_BIO_SEQ_H_
+#define SRC_TYPES_BIO_SEQ_H_
 
 #include <openssl/bio.h>
 
@@ -8,4 +8,4 @@ void bioseq_teardown(void);
 
 BIO *BIO_new_seq(BIO *, BIO *);
 
-#endif /* TEST_TYPES_BIO_SEQ_H_ */
+#endif /* SRC_TYPES_BIO_SEQ_H_ */
index 16f3e80b648fa6e4c02e32a8b5e95f8be1ff3d5b..6b11c541a66d12d408444fb6a752dab28411468c 100644 (file)
@@ -3,16 +3,17 @@
 #include <errno.h>
 
 #include "alloc.h"
+#include "cache.h"
 #include "common.h"
 #include "config.h"
+#include "config/filename_format.h"
 #include "log.h"
 #include "rrdp.h"
 #include "state.h"
-#include "str_token.h"
 #include "thread_var.h"
-#include "cache/local_cache.h"
-#include "config/filename_format.h"
-#include "data_structure/path_builder.h"
+#include "types/path.h"
+#include "types/str.h"
+#include "types/url.h"
 
 /**
  * Aside from the reference counter, instances are meant to be immutable.
@@ -231,7 +232,7 @@ map_simple(struct cache_mapping *map, char const *subdir)
        if (error)
                return error;
 
-       error = pb_append(&pb, &map->url[SCHEMA_LEN]);
+       error = pb_append(&pb, &map->url[RPKI_SCHEMA_LEN]);
        if (error) {
                pb_cleanup(&pb);
                return error;
index e67cc44c9dbfb03007a7fb550c779f73be5a6860..4edb1bc261927f7e258e2c9ed8a1b2215ede0dc0 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef SRC_TYPES_MAP_H_
 #define SRC_TYPES_MAP_H_
 
+#include <stdbool.h>
 #include "asn1/asn1c/IA5String.h"
-#include "data_structure/array_list.h"
+#include "types/arraylist.h"
 
 /*
  * "Long" time = seven days.
similarity index 99%
rename from src/object/name.c
rename to src/types/name.c
index f1b66b39584c7dc1cbd4236e6edf08476830809d..4c523a2c278fe10270638c391beaed60e1857fbb 100644 (file)
@@ -1,4 +1,4 @@
-#include "object/name.h"
+#include "types/name.h"
 
 #include <openssl/asn1.h>
 #include <openssl/obj_mac.h>
similarity index 87%
rename from src/object/name.h
rename to src/types/name.h
index 4ded9d2ec7e443f8f35b3d3f22ea694c55dc4144..3c38b2345556c67b743ef449d2625c6c7e636a82 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_OBJECT_NAME_H_
-#define SRC_OBJECT_NAME_H_
+#ifndef SRC_TYPES_NAME_H_
+#define SRC_TYPES_NAME_H_
 
 #include <openssl/x509.h>
 #include <stdbool.h>
@@ -24,4 +24,4 @@ int validate_issuer_name(char const *, X509_NAME *);
 
 void x509_name_pr_debug(char const *, X509_NAME *);
 
-#endif /* SRC_OBJECT_NAME_H_ */
+#endif /* SRC_TYPES_NAME_H_ */
similarity index 98%
rename from src/data_structure/path_builder.c
rename to src/types/path.c
index e444a0b39ea14ff4bb3f8fa8f8109415a2747769..2246f33872a38782e14a4ef08afb432e941a0942 100644 (file)
@@ -1,10 +1,10 @@
-#include "data_structure/path_builder.h"
+#include "types/path.h"
 
 #include <errno.h>
 
 #include "alloc.h"
 #include "config.h"
-#include "crypto/hash.h"
+#include "hash.h"
 #include "log.h"
 
 /* These are arbitrary; feel free to change them. */
similarity index 86%
rename from src/data_structure/path_builder.h
rename to src/types/path.h
index fb5986441a5d6b16d4bfc9cc3d3e6cca94b56f80..6aac775fdf3f45cf34de647a02b7fd83777c7d3c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_DATA_STRUCTURE_PATH_BUILDER_H_
-#define SRC_DATA_STRUCTURE_PATH_BUILDER_H_
+#ifndef SRC_TYPES_PATH_H_
+#define SRC_TYPES_PATH_H_
 
 #include <stdbool.h>
 #include <netdb.h>
@@ -40,4 +40,4 @@ void pb_cleanup(struct path_builder *);
 
 char *join_paths(char const *, char const *);
 
-#endif /* SRC_DATA_STRUCTURE_PATH_BUILDER_H_ */
+#endif /* SRC_TYPES_PATH_H_ */
similarity index 99%
rename from src/sorted_array.c
rename to src/types/sorted_array.c
index c5447e605238d8df4bb28b02316ecde9fb0b5845..ee6c4bfe7c4e073df237c66249500c8fcdcbb215 100644 (file)
@@ -1,4 +1,4 @@
-#include "sorted_array.h"
+#include "types/sorted_array.h"
 
 #include "alloc.h"
 #include "log.h"
similarity index 92%
rename from src/sorted_array.h
rename to src/types/sorted_array.h
index 12db6c98493111f33a34e5cd297014de0bbb2aaf..c590e15155f610f2e83bf736962a5253ef02012f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SRC_SORTED_ARRAY_H_
-#define SRC_SORTED_ARRAY_H_
+#ifndef SRC_TYPES_SORTED_ARRAY_H_
+#define SRC_TYPES_SORTED_ARRAY_H_
 
 #include <stdbool.h>
 #include <stddef.h>
@@ -53,4 +53,4 @@ int sarray_foreach(struct sorted_array *, sarray_foreach_cb, void *);
 
 char const *sarray_err2str(int);
 
-#endif /* SRC_SORTED_ARRAY_H_ */
+#endif /* SRC_TYPES_SORTED_ARRAY_H_ */
index 155425d6ffcdc95a19366da1a7a8f95db797a016..0322b5acd013858a71e806f149c2e824d6b93c70 100644 (file)
@@ -1,5 +1,145 @@
 #include "types/str.h"
 
+#include <openssl/bio.h>
+#include <stdint.h>
+
+#include "alloc.h"
+#include "log.h"
+
+/**
+ * Does not assume that @string is NULL-terminated.
+ */
+static char *
+string_clone(void const *string, size_t size)
+{
+       char *result;
+
+       result = pmalloc(size + 1);
+
+       memcpy(result, string, size);
+       result[size] = '\0';
+
+       return result;
+}
+
+int
+ia5s2string(ASN1_IA5STRING *ia5, char **result)
+{
+       if (ia5->flags & ASN1_STRING_FLAG_BITS_LEFT)
+               return pr_val_err("CRL URI IA5String has unused bits.");
+
+       *result = string_clone(ia5->data, ia5->length);
+       return 0;
+}
+
+int
+BN2string(BIGNUM *bn, char **_result)
+{
+       BIO *bio;
+       uint64_t written;
+       char *result;
+
+       /* Callers can call free() whether this function fails or not. */
+       *_result = NULL;
+
+       bio = BIO_new(BIO_s_mem());
+       if (bio == NULL)
+               return val_crypto_err("Cannot create a BIO.");
+
+       if (BN_print(bio, bn) == 0) {
+               BIO_free(bio);
+               return val_crypto_err("Unable to print the BIGNUM into a BIO");
+       }
+
+       written = BIO_number_written(bio);
+       result = pmalloc(written + 1);
+
+       BIO_read(bio, result, written);
+       result[written] = '\0';
+
+       BIO_free(bio);
+       *_result = result;
+       return 0;
+}
+
+void
+string_tokenizer_init(struct string_tokenizer *tokenizer, char const *str,
+    size_t str_len, unsigned char separator)
+{
+       tokenizer->str = str;
+       tokenizer->str_len = str_len;
+       tokenizer->separator = separator;
+       tokenizer->start = 0;
+       tokenizer->end = 0;
+}
+
+/**
+ * Returns whether a new token was found.
+ */
+bool
+string_tokenizer_next(struct string_tokenizer *tokenizer)
+{
+       size_t end = tokenizer->end;
+
+       if (end == tokenizer->str_len)
+               return false;
+
+       /* Ignore "empty" tokens */
+       while (tokenizer->str[end] == tokenizer->separator) {
+               end++;
+               if (end == tokenizer->str_len) {
+                       tokenizer->start = end;
+                       tokenizer->end = end;
+                       return false;
+               }
+       }
+
+       tokenizer->start = end;
+
+       for (; end < tokenizer->str_len; end++)
+               if (tokenizer->str[end] == tokenizer->separator)
+                       break;
+
+       tokenizer->end = end;
+       return true;
+}
+
+/**
+ * Returns whether the tokens described by @t1 and @t2 are identical.
+ */
+bool
+token_equals(struct string_tokenizer *t1, struct string_tokenizer *t2)
+{
+       size_t t1len = t1->end - t1->start;
+       size_t t2len = t2->end - t2->start;
+       return (t1len == t2len)
+           ? (memcmp(t1->str + t1->start, t2->str + t2->start, t1len) == 0)
+           : false;
+}
+
+char *
+token_read(struct string_tokenizer *tokenizer)
+{
+       return string_clone(tokenizer->str + tokenizer->start,
+           tokenizer->end - tokenizer->start);
+}
+
+size_t
+token_count(struct string_tokenizer *tokenizer)
+{
+       struct string_tokenizer copy;
+       size_t count;
+
+       string_tokenizer_init(&copy, tokenizer->str, tokenizer->str_len,
+           tokenizer->separator);
+
+       count = 0;
+       while (string_tokenizer_next(&copy))
+               count++;
+
+       return count;
+}
+
 void
 strlist_init(struct strlist *list)
 {
index 0de5bca8874b7383048d49d0935073efee3015e6..9798e7847287166a0b8981b7e597cff23c99bb1c 100644 (file)
@@ -1,7 +1,46 @@
 #ifndef SRC_TYPES_STR_H_
 #define SRC_TYPES_STR_H_
 
-#include "data_structure/array_list.h"
+#include <openssl/asn1.h>
+#include <openssl/bn.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "types/arraylist.h"
+
+int ia5s2string(ASN1_IA5STRING *, char **);
+int BN2string(BIGNUM *, char **);
+
+/**
+ * Do not modify fields directly; this should be private.
+ *
+ * This is more or less like strtok(), except it doesn't modify the string at
+ * any point.
+ */
+struct string_tokenizer {
+       /** String we're tokenizing. */
+       char const *str;
+       size_t str_len;
+       /** Token delimiter. */
+       unsigned char separator;
+       /** Offset of the first character of the current token. */
+       size_t start;
+       /** Offset of the last character of the current token + 1. */
+       size_t end;
+};
+
+void string_tokenizer_init(struct string_tokenizer *, char const *, size_t,
+    unsigned char);
+bool string_tokenizer_next(struct string_tokenizer *);
+bool token_equals(struct string_tokenizer *, struct string_tokenizer *);
+char *token_read(struct string_tokenizer *);
+size_t token_count(struct string_tokenizer *);
 
 /* XXX delete? */
 DEFINE_ARRAY_LIST_STRUCT(strlist, char *);
index 3a2054d97de9f8e33f54de5be35884cbaf00a9bd..5227b33590a7254db1b3f06ca838ef95762913e4 100644 (file)
@@ -1,7 +1,7 @@
 #include "types/url.h"
 
 #include "alloc.h"
-#include "data_structure/path_builder.h"
+#include "types/path.h"
 
 static char *
 path_rewind(char const *root, char *cursor)
similarity index 99%
rename from src/data_structure/uthash.h
rename to src/types/uthash.h
index 3db49db0336b8f42133d9345aea694717930a18f..d02632ca9ce58b15e50e5bcbae357673a57928ae 100644 (file)
@@ -21,8 +21,8 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#ifndef UTHASH_H
-#define UTHASH_H
+#ifndef SRC_TYPES_UTHASH_H
+#define SRC_TYPES_UTHASH_H
 
 #define UTHASH_VERSION 2.1.0
 
@@ -1207,4 +1207,4 @@ typedef struct UT_hash_handle {
    unsigned hashv;                   /* result of hash-fcn(key)        */
 } UT_hash_handle;
 
-#endif /* UTHASH_H */
+#endif /* SRC_TYPES_UTHASH_H */
index a1673c5a5a48647dc0ee0ce3dedad831d48f6262..bdb612ebfd1fded64b97eb754d475dd43a03454f 100644 (file)
@@ -8,7 +8,7 @@
 #include <stdint.h>
 
 /*
- * A ROA.
+ * A ROA payload.
  *
  * I think it's called "VRP" ("Validated ROA Payload") because it was originally
  * meant to represent an already validated ROA, and used exclusively by the RTR
index 9beec0a07fd3640b7158e65f7cf018d43627a631..46d0163927b0bc62c677bb1f8c74829d8cf25772 100644 (file)
@@ -1,9 +1,9 @@
 #ifndef SRC_VALIDATION_HANDLER_H_
 #define SRC_VALIDATION_HANDLER_H_
 
-#include "as_number.h"
-#include "object/name.h"
 #include "types/address.h"
+#include "types/asn.h"
+#include "types/name.h"
 #include "types/router_key.h"
 
 /**
index 48e88574178b6fa915dea239d624d52051acb396..f6a03bf7564ba576223dfd7d3c3de96648d74d74 100644 (file)
@@ -21,28 +21,100 @@ AM_CFLAGS += -I../src -DUNIT_TESTING ${CHECK_CFLAGS} ${XML2_CFLAGS} ${JANSSON_CF
 # target.
 MY_LDADD = ${CHECK_LIBS} ${JANSSON_LIBS}
 
-check_PROGRAMS  = url.test
+check_PROGRAMS  = address.test
+check_PROGRAMS += base64.test
 check_PROGRAMS += cachent.test
 check_PROGRAMS += cache.test
+check_PROGRAMS += db_table.test
+check_PROGRAMS += deltas_array.test
+check_PROGRAMS += hash.test
+check_PROGRAMS += json_util.test
+check_PROGRAMS += map.test
+check_PROGRAMS += path.test
+check_PROGRAMS += pdu_handler.test
+check_PROGRAMS += pdu_stream.test
 check_PROGRAMS += rrdp.test
 check_PROGRAMS += rrdp_update.test
+check_PROGRAMS += serial.test
+check_PROGRAMS += tal.test
+check_PROGRAMS += thread_pool.test
+check_PROGRAMS += url.test
+check_PROGRAMS += uthash.test
+check_PROGRAMS += vcard.test
+check_PROGRAMS += vrps.test
+check_PROGRAMS += xml.test
 TESTS = ${check_PROGRAMS}
 
-url_test_SOURCES = types/url_test.c
-url_test_LDADD = ${MY_LDADD} ${JANSSON_LIBS}
+###############################################################################
+
+address_test_SOURCES = types/address_test.c
+address_test_LDADD = ${MY_LDADD}
 
-cachent_test_SOURCES = cache/cachent_test.c
+base64_test_SOURCES = base64_test.c
+base64_test_LDADD = ${MY_LDADD}
+
+cachent_test_SOURCES = cachent_test.c
 cachent_test_LDADD = ${MY_LDADD} ${JANSSON_LIBS}
 
-cache_test_SOURCES = cache/local_cache_test.c
+cache_test_SOURCES = cache_test.c
 cache_test_LDADD = ${MY_LDADD} ${JANSSON_LIBS}
 
+db_table_test_SOURCES = rtr/db/db_table_test.c
+db_table_test_LDADD = ${MY_LDADD}
+
+deltas_array_test_SOURCES = rtr/db/deltas_array_test.c
+deltas_array_test_LDADD = ${MY_LDADD}
+
+hash_test_SOURCES = hash_test.c
+hash_test_LDADD = ${MY_LDADD}
+
+json_util_test_SOURCES = json_util_test.c
+json_util_test_LDADD = ${MY_LDADD}
+
+map_test_SOURCES = types/map_test.c
+map_test_LDADD = ${MY_LDADD}
+
+path_test_SOURCES = types/path_test.c
+path_test_LDADD = ${MY_LDADD}
+
+pdu_handler_test_SOURCES = rtr/pdu_handler_test.c
+pdu_handler_test_LDADD = ${MY_LDADD} ${JANSSON_LIBS}
+
+pdu_stream_test_SOURCES = rtr/pdu_stream_test.c
+pdu_stream_test_LDADD = ${MY_LDADD} ${JANSSON_LIBS}
+
 rrdp_test_SOURCES = rrdp_test.c
 rrdp_test_LDADD = ${MY_LDADD} ${JANSSON_LIBS} ${XML2_LIBS}
 
 rrdp_update_test_SOURCES = rrdp_update_test.c
 rrdp_update_test_LDADD = ${MY_LDADD} ${JANSSON_LIBS} ${XML2_LIBS}
 
+serial_test_SOURCES = types/serial_test.c
+serial_test_LDADD = ${MY_LDADD}
+
+tal_test_SOURCES = tal_test.c
+tal_test_LDADD = ${MY_LDADD}
+
+thread_pool_test_SOURCES = thread_pool_test.c
+thread_pool_test_LDADD = ${MY_LDADD}
+
+url_test_SOURCES = types/url_test.c
+url_test_LDADD = ${MY_LDADD} ${JANSSON_LIBS}
+
+uthash_test_SOURCES = types/uthash_test.c
+uthash_test_LDADD = ${MY_LDADD}
+
+vcard_test_SOURCES = vcard_test.c
+vcard_test_LDADD = ${MY_LDADD}
+
+vrps_test_SOURCES = rtr/db/vrps_test.c
+vrps_test_LDADD = ${MY_LDADD} ${JANSSON_LIBS}
+
+xml_test_SOURCES = xml_test.c
+xml_test_LDADD = ${MY_LDADD} ${XML2_LIBS}
+
+###############################################################################
+
 EXTRA_DIST  = mock.c mock.h
 EXTRA_DIST += resources/lorem-ipsum.txt
 EXTRA_DIST += rtr/db/rtr_db_mock.c
similarity index 99%
rename from test/crypto/base64_test.c
rename to test/base64_test.c
index dc40b33c076e0ac473badb0c67b281173d2b64cd..b64616462a81be26e12f305791228b4579b520dc 100644 (file)
@@ -1,9 +1,9 @@
 #include <check.h>
 
 #include "alloc.c"
+#include "base64.c"
 #include "common.h"
 #include "mock.c"
-#include "crypto/base64.c"
 
 static void
 ck_uchar_array(unsigned char *expected, size_t expected_len,
similarity index 99%
rename from test/cache/local_cache_test.c
rename to test/cache_test.c
index c041ff8f0ea19b15c9823a38e99091f9adeb438d..04db54fb18c545741cec53eb6beedb017380a300 100644 (file)
@@ -1,18 +1,16 @@
 /* This will create some test files in "tmp/". Needs permissions. */
 
 #include <check.h>
-//#include <stdarg.h>
 #include <sys/queue.h>
 
 #include "alloc.c"
 #include "common.c"
+#include "cache.c"
+#include "cachent.c"
+#include "cache_util.c"
 #include "file.c"
-//#include "json_util.c"
 #include "mock.c"
-#include "cache/cachent.c"
-#include "cache/local_cache.c"
-#include "cache/util.c"
-#include "data_structure/path_builder.c"
+#include "types/path.c"
 #include "types/str.c"
 #include "types/url.c"
 
similarity index 97%
rename from test/cache/util.c
rename to test/cache_util.c
index 6acbb829bd60010ca53a6d6451a1b56001b71894..85a121ff5631c26d86e46bc5d9f7a9d640e70ac0 100644 (file)
@@ -1,7 +1,7 @@
-#include "cache/util.h"
+#include "cache_util.h"
 
 #include <string.h>
-#include "data_structure/uthash.h"
+#include "types/uthash.h"
 
 static struct cache_node *
 node(char const *schema, char const *path, int flags, char const *tmpdir,
similarity index 94%
rename from test/cache/util.h
rename to test/cache_util.h
index 4e350c8d44042b768fb83933ac7844c9d15c5c84..2b3f1949cfcdc98ba2107d8fd07fbf35ce87d4ca 100644 (file)
@@ -2,7 +2,7 @@
 #define TEST_CACHE_UTIL_H_
 
 #include <stdarg.h>
-#include "cache/cachent.h"
+#include "cachent.h"
 
 struct cache_node *ruftnode(char const *, int , char const *, ...);
 struct cache_node *rufnode(char const *, int , ...);
similarity index 98%
rename from test/cache/cachent_test.c
rename to test/cachent_test.c
index 9f4c9d49d8cba4ace0a6dd8002c11b2f3be6e873..e3e1c070ccb850b5ed22b2c76bccef92040549f2 100644 (file)
@@ -1,10 +1,10 @@
 #include <check.h>
 
 #include "alloc.c"
-#include "cache/cachent.c"
-#include "cache/util.c"
-#include "data_structure/path_builder.c"
+#include "cachent.c"
+#include "cache_util.c"
 #include "mock.c"
+#include "types/path.c"
 #include "types/url.c"
 
 static char deleted[16][6];
similarity index 82%
rename from test/crypto/hash_test.c
rename to test/hash_test.c
index 6345543967202df8dd97afc95effbd8691d22358..ffeee35fe34ee70f69b9d73e646524347cd8a0b5 100644 (file)
@@ -4,10 +4,10 @@
 #include "alloc.c"
 #include "common.c"
 #include "file.c"
+#include "hash.c"
 #include "mock.c"
-#include "data_structure/path_builder.c"
 #include "types/map.c"
-#include "crypto/hash.c"
+#include "types/path.c"
 
 MOCK_ABORT_INT(cache_tmpfile, char **filename)
 
@@ -40,15 +40,10 @@ START_TEST(test_hash)
        struct hash_algorithm const *ha;
        char const *name;
        char const *input = "Fort";
-       struct cache_mapping map = { 0 };
+       char const *file = "resources/lorem-ipsum.txt";
 
        hash_setup();
 
-       map.url = "https://example.com/resources/lorem-ipsum.txt";
-       map.path = "resources/lorem-ipsum.txt";
-       map.type = MAP_HTTP;
-       map.references = 1;
-
        ha = hash_get_sha1();
        ck_assert_uint_eq(20, hash_get_size(ha));
        name = hash_get_name(ha);
@@ -59,10 +54,10 @@ START_TEST(test_hash)
        FORT_SHA1[1] = 1;
        ck_assert_int_eq(EINVAL, hash_validate(ha, (unsigned char *)input, strlen(input), FORT_SHA1, sizeof(FORT_SHA1)));
 
-       ck_assert_int_eq(0, hash_validate_file(ha, &map, FILE_SHA1, sizeof(FILE_SHA1)));
-       ck_assert_int_eq(-EINVAL, hash_validate_file(ha, &map, FILE_SHA1, sizeof(FILE_SHA1) - 10));
+       ck_assert_int_eq(0, hash_validate_file(ha, file, FILE_SHA1, sizeof(FILE_SHA1)));
+       ck_assert_int_eq(-EINVAL, hash_validate_file(ha, file, FILE_SHA1, sizeof(FILE_SHA1) - 10));
        FILE_SHA1[19] = 0;
-       ck_assert_int_eq(-EINVAL, hash_validate_file(ha, &map, FILE_SHA1, sizeof(FILE_SHA1)));
+       ck_assert_int_eq(-EINVAL, hash_validate_file(ha, file, FILE_SHA1, sizeof(FILE_SHA1)));
 
        ha = hash_get_sha256();
        ck_assert_uint_eq(32, hash_get_size(ha));
@@ -74,10 +69,10 @@ START_TEST(test_hash)
        FORT_SHA256[10] = 0;
        ck_assert_int_eq(EINVAL, hash_validate(ha, (unsigned char *)input, strlen(input), FORT_SHA256, sizeof(FORT_SHA256)));
 
-       ck_assert_int_eq(0, hash_validate_file(ha, &map, FILE_SHA256, sizeof(FILE_SHA256)));
-       ck_assert_int_eq(-EINVAL, hash_validate_file(ha, &map, FILE_SHA256, sizeof(FILE_SHA256) - 1));
+       ck_assert_int_eq(0, hash_validate_file(ha, file, FILE_SHA256, sizeof(FILE_SHA256)));
+       ck_assert_int_eq(-EINVAL, hash_validate_file(ha, file, FILE_SHA256, sizeof(FILE_SHA256) - 1));
        FILE_SHA256[31] = 10;
-       ck_assert_int_eq(-EINVAL, hash_validate_file(ha, &map, FILE_SHA256, sizeof(FILE_SHA256)));
+       ck_assert_int_eq(-EINVAL, hash_validate_file(ha, file, FILE_SHA256, sizeof(FILE_SHA256)));
 
        hash_teardown();
 }
index e2849c13e7656956aff83b6f8120d62a0fa02ae8..40bd6803f3a5a85c7e45be58c45e34d23c3670a9 100644 (file)
@@ -3,11 +3,11 @@
 #include <errno.h>
 #include <arpa/inet.h>
 #include "config.h"
-#include "state.h"
-#include "thread_var.h"
 #include "config/filename_format.h"
 #include "config/mode.h"
-#include "incidence/incidence.h"
+#include "incidence.h"
+#include "state.h"
+#include "thread_var.h"
 
 /**
  * Some core functions, as linked from unit tests.
index 46629cd34e81ab2886222d648664ed558c506b20..28e0d2325bfa10913f7f01c96adfff95e04b527f 100644 (file)
@@ -3,17 +3,17 @@
 #include <stdlib.h>
 
 #include "alloc.c"
-#include "cache/cachent.c"
+#include "base64.c"
+#include "cachent.c"
 #include "common.c"
-#include "crypto/base64.c"
-#include "crypto/hash.c"
-#include "data_structure/path_builder.c"
 #include "file.c"
+#include "hash.c"
 #include "json_util.c"
 #include "mock.c"
+#include "relax_ng.c"
 #include "rrdp.c"
+#include "types/path.c"
 #include "types/url.c"
-#include "xml/relax_ng.c"
 
 /* Mocks */
 
index 00d19858bdebeaddf02ecbe9131978b594809a4e..2896e42eca00bf0f376ab26fc0f8948f915dbf7b 100644 (file)
@@ -1,13 +1,13 @@
 #include <check.h>
 
 #include "alloc.c"
-#include "cache/cachent.c"
+#include "base64.c"
+#include "cachent.c"
 #include "common.c"
-#include "crypto/base64.c"
-#include "data_structure/path_builder.c"
 #include "json_util.c"
 #include "mock.c"
 #include "rrdp.c"
+#include "types/path.c"
 #include "types/url.c"
 
 /* Mocks */
index 403a1eec7b3bc74d16359c5f2853928df4fbcea1..322613bb64a1e6712950f1b17e7091fd4635f93a 100644 (file)
@@ -2,27 +2,28 @@
 #include <stdbool.h>
 #include <stdlib.h>
 
-#include "crypto/base64.c"
 #include "algorithm.c"
 #include "alloc.c"
+#include "base64.c"
 #include "common.c"
 #include "file.c"
 #include "json_util.c"
 #include "mock.c"
 #include "output_printer.c"
-#include "types/delta.c"
-#include "types/router_key.c"
-#include "types/serial.c"
-#include "types/vrp.c"
+#include "rtr/db/db_table.c"
 #include "rtr/db/delta.c"
 #include "rtr/db/deltas_array.c"
-#include "rtr/db/db_table.c"
 #include "rtr/db/rtr_db_mock.c"
 #include "rtr/db/vrps.c"
 #include "slurm/db_slurm.c"
 #include "slurm/slurm_loader.c"
 #include "slurm/slurm_parser.c"
-#include "thread/thread_pool.c"
+#include "thread_pool.c"
+#include "types/delta.c"
+#include "types/path.c"
+#include "types/router_key.c"
+#include "types/serial.c"
+#include "types/vrp.c"
 
 /* -- Expected database descriptors -- */
 
index 20e277f647fd231cdead172df3da1406145ebabb..47b710eb384b3253ae94ce76c186d7bbb3f6f346 100644 (file)
@@ -17,7 +17,7 @@
 #include "rtr/db/db_table.c"
 #include "rtr/db/rtr_db_mock.c"
 #include "rtr/db/vrps.c"
-#include "thread/thread_pool.c"
+#include "thread_pool.c"
 
 /* Mocks */
 
index c98c5aebf9607373809bde0466e5ca03a32fcc25..aacfe6d748aa6a29969c5abc4d8f8168524c8f34 100644 (file)
@@ -3,12 +3,13 @@
 #include <check.h>
 
 #include "alloc.c"
+#include "base64.c"
 #include "common.c"
 #include "file.c"
 #include "mock.c"
-#include "data_structure/path_builder.c"
 #include "types/map.c"
-#include "crypto/base64.c"
+#include "types/path.c"
+#include "types/str.c"
 
 /* Mocks */
 
@@ -18,8 +19,7 @@ MOCK_VOID(cache_destroy, struct rpki_cache *cache)
 MOCK_ABORT_INT(cache_download, struct rpki_cache *cache,
     struct cache_mapping *map, bool *changed,
     struct cachefile_notification ***notif)
-MOCK_ABORT_INT(cache_download_alt, struct rpki_cache *cache,
-    struct map_list *maps, enum map_type http_type, enum map_type rsync_type,
+MOCK_ABORT_INT(cache_download_alt, struct sia_uris *sias,
     maps_dl_cb cb, void *arg)
 MOCK_ABORT_PTR(cache_recover, cache_mapping, struct rpki_cache *cache,
     struct map_list *maps)
@@ -42,7 +42,7 @@ MOCK_ABORT_INT(handle_roa_v6, uint32_t as, struct ipv6_prefix const *prefix,
 MOCK_ABORT_INT(handle_router_key, unsigned char const *ski,
     struct asn_range const *asns, unsigned char const *spk, void *arg)
 MOCK_ABORT_VOID(rpp_refput, struct rpp *pp)
-MOCK_ABORT_INT(rrdp_update, struct cache_mapping *map)
+MOCK_ABORT_INT(rrdp_update, struct cache_node *notif)
 MOCK(state_retrieve, struct validation *, NULL, void)
 MOCK_ABORT_PTR(validation_certstack, cert_stack, struct validation *state)
 MOCK_ABORT_VOID(validation_destroy, struct validation *state)
@@ -101,7 +101,7 @@ test_1url(char const *file)
        ck_assert_int_eq(0, tal_init(&tal, file));
 
        ck_assert_uint_eq(1, tal.urls.len);
-       ck_assert_str_eq("rsync://example.com/rpki/ta.cer", tal.urls.array[0]->url);
+       ck_assert_str_eq("rsync://example.com/rpki/ta.cer", tal.urls.array[0]);
        check_spki(&tal);
 
        tal_cleanup(&tal);
index 071d08cc0d0abcb089e71241c88683ce469f760d..3acc89b4ee36f4ca63149ef71b0d613e9d2652c6 100644 (file)
@@ -5,7 +5,7 @@
 #include "alloc.c"
 #include "common.c"
 #include "mock.c"
-#include "thread/thread_pool.c"
+#include "thread_pool.c"
 
 static void
 thread_work(void *arg)
index c3bd5ec695dfa71339f22d605ee34b3345d77a7c..cd901ce6e41e95504c8c566538536dd33696f684 100644 (file)
@@ -6,7 +6,7 @@
 #include "common.c"
 #include "mock.c"
 #include "types/map.c"
-#include "data_structure/path_builder.c"
+#include "types/path.c"
 
 /* Mocks */
 
@@ -16,8 +16,6 @@ MOCK(state_retrieve, struct validation *, NULL, void)
 MOCK(validation_tal, struct tal *, NULL, struct validation *state)
 MOCK(tal_get_file_name, char const *, NULL, struct tal *tal)
 
-MOCK_ABORT_INT(rrdp_update, struct cache_mapping *map)
-
 int
 cache_tmpfile(char **filename)
 {
@@ -35,7 +33,7 @@ cache_tmpfile(char **filename)
 
 /* Tests */
 
-#define MAP_CREATE_HTTP(map, str) map_create(&map, MAP_TA_HTTP, str)
+#define MAP_CREATE_HTTP(map, str) map_create(&map, MAP_HTTP, str)
 #define MAP_CREATE(map, type, str) map_create(&map, type, str)
 
 START_TEST(test_constructor)
@@ -119,13 +117,16 @@ START_TEST(test_constructor)
        ck_assert_str_eq("tmp/tmp/0", map_get_path(map));
        map_refput(map);
 
+       /* XXX
        ck_assert_int_eq(0, MAP_CREATE(map, MAP_TMP, "https://a.b.c/snapshot.xml"));
        ck_assert_str_eq("https://a.b.c/snapshot.xml", map_get_url(map));
        ck_assert_str_eq("tmp/tmp/0", map_get_path(map));
        map_refput(map);
+       */
 }
 END_TEST
 
+/*
 #define BUFFER_LEN 128
 static uint8_t buffer[BUFFER_LEN];
 
@@ -147,9 +148,11 @@ __test_validate(char const *src, size_t len)
 }
 
 #define test_validate(str) __test_validate(str, sizeof(str) - 1)
+*/
 
 START_TEST(check_validate_current_directory)
 {
+       /* XXX wtf is this doing in the map test?
        ck_assert_int_eq(-EINVAL, test_validate(""));
        ck_assert_int_eq(-EINVAL, test_validate("."));
        ck_assert_int_eq(-EINVAL, test_validate(".."));
@@ -175,11 +178,13 @@ START_TEST(check_validate_current_directory)
 
        ck_assert_int_eq(0, test_validate("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890-_.-_-"));
        ck_assert_int_eq(0, test_validate("vixxBTS_TVXQ-2pmGOT7.cer"));
+       */
 }
 END_TEST
 
 START_TEST(check_caged)
 {
+       /* XXX
        struct cache_mapping *map;
 
        ck_assert_int_eq(0, map_create(&notif, MAP_NOTIF, "https://a.b.c/d/e.xml"));
@@ -193,6 +198,7 @@ START_TEST(check_caged)
        ck_assert_str_eq("tmp/rrdp/a.b.c/w", map_get_path(map));
        map_refput(map);
        map_refput(notif);
+       */
 }
 END_TEST
 
similarity index 99%
rename from test/data_structure/path_builder_test.c
rename to test/types/path_test.c
index f6a822f1cb9416942830b183869a763438af7905..0e24d1398b829ecc0972faf56fdff542be52b65f 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "alloc.c"
 #include "mock.c"
-#include "data_structure/path_builder.c"
+#include "types/path.c"
 
 #define CHECK_PB(_string, _capacity)                                   \
        ck_assert_str_eq(_string, pb.string);                           \
index d4226127c876886fac1dee09a3faed6f27ca2035..8d20ab30ec63bedb810eaf7055dbbce851294107 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "alloc.c"
 #include "mock.c"
-#include "data_structure/path_builder.c"
+#include "types/path.c"
 #include "types/url.c"
 
 #define TEST_NORMALIZE(dirty, clean)                                   \
similarity index 99%
rename from test/data_structure/uthash_test.c
rename to test/types/uthash_test.c
index 22f82e970cc6d178d43fcd9dfb0ada12670eb74f..291033e608f3ca652a9c4c0d61c445ac2110db6a 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include "data_structure/uthash.h"
+#include "types/uthash.h"
 
 struct uthash_node {
        int key;
index 9e57057582c81147726ec6a4875902907cdb43a2..c46ac828972d0690505acd3b20cd7a0ac6d5b44f 100644 (file)
@@ -4,7 +4,7 @@
 #include <libxml/xmlreader.h>
 
 #include "mock.c"
-#include "xml/relax_ng.c"
+#include "relax_ng.c"
 
 struct reader_ctx {
        unsigned int delta_count;
@@ -58,7 +58,7 @@ reader_cb(xmlTextReaderPtr reader, void *arg)
 START_TEST(relax_ng_valid)
 {
        struct reader_ctx ctx;
-       char const *url = "xml/notification.xml";
+       char const *url = "resources/xml/notification.xml";
 
        ctx.delta_count = 0;
        ctx.snapshot_count = 0;