]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/loc/format.h
Implement signing/verifying databases
[people/ms/libloc.git] / src / loc / format.h
index e138f69d3f8c9dd5f6e3d9cf72ea6c9dfc023486..3762c5eef94aaf547e5245c221c2bcbe1a4e8060 100644 (file)
 
 #define LOC_DATABASE_VERSION    0
 
+#define STR(x) #x
+#define LOC_DATABASE_DOMAIN_LATEST(version) "_latest._v" STR(version) ".location.ipfire.org"
+
 #define LOC_DATABASE_PAGE_SIZE  4096
 
+#define LOC_SIGNATURE_MAX_LENGTH       4096
+
 struct loc_database_magic {
        char magic[7];
 
@@ -59,9 +64,20 @@ struct loc_database_header_v0 {
        uint32_t network_tree_offset;
        uint32_t network_tree_length;
 
+       // Tells us where the countries start
+       uint32_t countries_offset;
+       uint32_t countries_length;
+
        // Tells us where the pool starts
        uint32_t pool_offset;
        uint32_t pool_length;
+
+       // Signature
+       uint32_t signature_length;
+       char signature[LOC_SIGNATURE_MAX_LENGTH];
+
+       // Add some padding for future extensions
+       char padding[32];
 };
 
 struct loc_database_network_node_v0 {
@@ -81,7 +97,10 @@ struct loc_database_network_v0 {
        uint32_t asn;
 
        // Flags
-       uint32_t flags;
+       uint16_t flags;
+
+       // Reserved
+       char padding[2];
 };
 
 struct loc_database_as_v0 {
@@ -92,5 +111,13 @@ struct loc_database_as_v0 {
        uint32_t name;
 };
 
+struct loc_database_country_v0 {
+       char code[2];
+       char continent_code[2];
+
+       // Name in the string pool
+       uint32_t name;
+};
+
 #endif
 #endif