]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/loc/format.h
Add a dictionary with countries to the database
[people/ms/libloc.git] / src / loc / format.h
index a1c0ebd55a68ca28187761239cac2d9af356e1ce..6ea6036a16d18af89dbbb5f555e397791254fc9a 100644 (file)
@@ -20,6 +20,9 @@
 #include <stdint.h>
 
 #define LOC_DATABASE_MAGIC      "LOCDBXX"
+
+#ifdef LIBLOC_PRIVATE
+
 #define LOC_DATABASE_VERSION    0
 
 #define LOC_DATABASE_PAGE_SIZE  4096
@@ -41,6 +44,9 @@ struct loc_database_header_v0 {
        // Description of the database
        uint32_t description;
 
+       // License of the database
+       uint32_t license;
+
        // Tells us where the ASes start
        uint32_t as_offset;
        uint32_t as_length;
@@ -49,10 +55,14 @@ struct loc_database_header_v0 {
        uint32_t network_data_offset;
        uint32_t network_data_length;
 
-       // Tells us where the network tree starts
+       // Tells us where the network nodes start
        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;
@@ -61,17 +71,21 @@ struct loc_database_header_v0 {
 struct loc_database_network_node_v0 {
        uint32_t zero;
        uint32_t one;
+
+       uint32_t network;
 };
 
 struct loc_database_network_v0 {
-       // The start address will be encoded in the tree
-       uint8_t prefix;
+       // The start address and prefix will be encoded in the tree
 
        // The country this network is located in
        char country_code[2];
 
        // ASN
        uint32_t asn;
+
+       // Flags
+       uint32_t flags;
 };
 
 struct loc_database_as_v0 {
@@ -82,4 +96,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