return 0;
}
-int loc_as_new_from_database_v0(struct loc_ctx* ctx, struct loc_stringpool* pool,
- struct loc_as** as, const struct loc_database_as_v0* dbobj) {
+int loc_as_new_from_database_v1(struct loc_ctx* ctx, struct loc_stringpool* pool,
+ struct loc_as** as, const struct loc_database_as_v1* dbobj) {
uint32_t number = be32toh(dbobj->number);
int r = loc_as_new(ctx, as, number);
return 0;
}
-int loc_as_to_database_v0(struct loc_as* as, struct loc_stringpool* pool,
- struct loc_database_as_v0* dbobj) {
+int loc_as_to_database_v1(struct loc_as* as, struct loc_stringpool* pool,
+ struct loc_database_as_v1* dbobj) {
dbobj->number = htobe32(as->number);
// Save the name string in the string pool
return strcmp(country1->code, country2->code);
}
-int loc_country_new_from_database_v0(struct loc_ctx* ctx, struct loc_stringpool* pool,
- struct loc_country** country, const struct loc_database_country_v0* dbobj) {
+int loc_country_new_from_database_v1(struct loc_ctx* ctx, struct loc_stringpool* pool,
+ struct loc_country** country, const struct loc_database_country_v1* dbobj) {
char buffer[3];
// Read country code
return r;
}
-int loc_country_to_database_v0(struct loc_country* country,
- struct loc_stringpool* pool, struct loc_database_country_v0* dbobj) {
+int loc_country_to_database_v1(struct loc_country* country,
+ struct loc_stringpool* pool, struct loc_database_country_v1* dbobj) {
// Add country code
for (unsigned int i = 0; i < 2; i++) {
dbobj->code[i] = country->code[i] ? country->code[i] : '\0';
size_t signature_length;
// ASes in the database
- struct loc_database_as_v0* as_v0;
+ struct loc_database_as_v1* as_v1;
size_t as_count;
// Network tree
- struct loc_database_network_node_v0* network_nodes_v0;
+ struct loc_database_network_node_v1* network_nodes_v1;
size_t network_nodes_count;
// Networks
- struct loc_database_network_v0* networks_v0;
+ struct loc_database_network_v1* networks_v1;
size_t networks_count;
// Countries
- struct loc_database_country_v0* countries_v0;
+ struct loc_database_country_v1* countries_v1;
size_t countries_count;
struct loc_stringpool* pool;
return 1;
}
-static int loc_database_read_as_section_v0(struct loc_database* db,
- const struct loc_database_header_v0* header) {
+static int loc_database_read_as_section_v1(struct loc_database* db,
+ const struct loc_database_header_v1* header) {
off_t as_offset = be32toh(header->as_offset);
size_t as_length = be32toh(header->as_length);
DEBUG(db->ctx, "Reading AS section from %jd (%zu bytes)\n", (intmax_t)as_offset, as_length);
if (as_length > 0) {
- db->as_v0 = mmap(NULL, as_length, PROT_READ,
+ db->as_v1 = mmap(NULL, as_length, PROT_READ,
MAP_SHARED, fileno(db->f), as_offset);
- if (db->as_v0 == MAP_FAILED)
+ if (db->as_v1 == MAP_FAILED)
return -errno;
}
- db->as_count = as_length / sizeof(*db->as_v0);
+ db->as_count = as_length / sizeof(*db->as_v1);
INFO(db->ctx, "Read %zu ASes from the database\n", db->as_count);
return 0;
}
-static int loc_database_read_network_nodes_section_v0(struct loc_database* db,
- const struct loc_database_header_v0* header) {
+static int loc_database_read_network_nodes_section_v1(struct loc_database* db,
+ const struct loc_database_header_v1* header) {
off_t network_nodes_offset = be32toh(header->network_tree_offset);
size_t network_nodes_length = be32toh(header->network_tree_length);
(intmax_t)network_nodes_offset, network_nodes_length);
if (network_nodes_length > 0) {
- db->network_nodes_v0 = mmap(NULL, network_nodes_length, PROT_READ,
+ db->network_nodes_v1 = mmap(NULL, network_nodes_length, PROT_READ,
MAP_SHARED, fileno(db->f), network_nodes_offset);
- if (db->network_nodes_v0 == MAP_FAILED)
+ if (db->network_nodes_v1 == MAP_FAILED)
return -errno;
}
- db->network_nodes_count = network_nodes_length / sizeof(*db->network_nodes_v0);
+ db->network_nodes_count = network_nodes_length / sizeof(*db->network_nodes_v1);
INFO(db->ctx, "Read %zu network nodes from the database\n", db->network_nodes_count);
return 0;
}
-static int loc_database_read_networks_section_v0(struct loc_database* db,
- const struct loc_database_header_v0* header) {
+static int loc_database_read_networks_section_v1(struct loc_database* db,
+ const struct loc_database_header_v1* header) {
off_t networks_offset = be32toh(header->network_data_offset);
size_t networks_length = be32toh(header->network_data_length);
(intmax_t)networks_offset, networks_length);
if (networks_length > 0) {
- db->networks_v0 = mmap(NULL, networks_length, PROT_READ,
+ db->networks_v1 = mmap(NULL, networks_length, PROT_READ,
MAP_SHARED, fileno(db->f), networks_offset);
- if (db->networks_v0 == MAP_FAILED)
+ if (db->networks_v1 == MAP_FAILED)
return -errno;
}
- db->networks_count = networks_length / sizeof(*db->networks_v0);
+ db->networks_count = networks_length / sizeof(*db->networks_v1);
INFO(db->ctx, "Read %zu networks from the database\n", db->networks_count);
return 0;
}
-static int loc_database_read_countries_section_v0(struct loc_database* db,
- const struct loc_database_header_v0* header) {
+static int loc_database_read_countries_section_v1(struct loc_database* db,
+ const struct loc_database_header_v1* header) {
off_t countries_offset = be32toh(header->countries_offset);
size_t countries_length = be32toh(header->countries_length);
(intmax_t)countries_offset, countries_length);
if (countries_length > 0) {
- db->countries_v0 = mmap(NULL, countries_length, PROT_READ,
+ db->countries_v1 = mmap(NULL, countries_length, PROT_READ,
MAP_SHARED, fileno(db->f), countries_offset);
- if (db->countries_v0 == MAP_FAILED)
+ if (db->countries_v1 == MAP_FAILED)
return -errno;
}
- db->countries_count = countries_length / sizeof(*db->countries_v0);
+ db->countries_count = countries_length / sizeof(*db->countries_v1);
INFO(db->ctx, "Read %zu countries from the database\n",
db->countries_count);
return 0;
}
-static int loc_database_read_header_v0(struct loc_database* db) {
- struct loc_database_header_v0 header;
+static int loc_database_read_header_v1(struct loc_database* db) {
+ struct loc_database_header_v1 header;
// Read from file
size_t size = fread(&header, 1, sizeof(header), db->f);
return r;
// AS section
- r = loc_database_read_as_section_v0(db, &header);
+ r = loc_database_read_as_section_v1(db, &header);
if (r)
return r;
// Network Nodes
- r = loc_database_read_network_nodes_section_v0(db, &header);
+ r = loc_database_read_network_nodes_section_v1(db, &header);
if (r)
return r;
// Networks
- r = loc_database_read_networks_section_v0(db, &header);
+ r = loc_database_read_networks_section_v1(db, &header);
if (r)
return r;
// countries
- r = loc_database_read_countries_section_v0(db, &header);
+ r = loc_database_read_countries_section_v1(db, &header);
if (r)
return r;
static int loc_database_read_header(struct loc_database* db) {
switch (db->version) {
case 0:
- return loc_database_read_header_v0(db);
+ return loc_database_read_header_v1(db);
default:
ERROR(db->ctx, "Incompatible database version: %u\n", db->version);
DEBUG(db->ctx, "Releasing database %p\n", db);
// Removing all ASes
- if (db->as_v0) {
- r = munmap(db->as_v0, db->as_count * sizeof(*db->as_v0));
+ if (db->as_v1) {
+ r = munmap(db->as_v1, db->as_count * sizeof(*db->as_v1));
if (r)
ERROR(db->ctx, "Could not unmap AS section: %s\n", strerror(errno));
}
// Remove mapped network sections
- if (db->networks_v0) {
- r = munmap(db->networks_v0, db->networks_count * sizeof(*db->networks_v0));
+ if (db->networks_v1) {
+ r = munmap(db->networks_v1, db->networks_count * sizeof(*db->networks_v1));
if (r)
ERROR(db->ctx, "Could not unmap networks section: %s\n", strerror(errno));
}
// Remove mapped network nodes section
- if (db->network_nodes_v0) {
- r = munmap(db->network_nodes_v0, db->network_nodes_count * sizeof(*db->network_nodes_v0));
+ if (db->network_nodes_v1) {
+ r = munmap(db->network_nodes_v1, db->network_nodes_count * sizeof(*db->network_nodes_v1));
if (r)
ERROR(db->ctx, "Could not unmap network nodes section: %s\n", strerror(errno));
}
}
// Read the header
- struct loc_database_header_v0 header_v0;
+ struct loc_database_header_v1 header_v1;
switch (db->version) {
case 0:
- fread(&header_v0, 1, sizeof(header_v0), db->f);
+ fread(&header_v1, 1, sizeof(header_v1), db->f);
// Clear signature
- for (unsigned int i = 0; i < sizeof(header_v0.signature); i++) {
- header_v0.signature[i] = '\0';
+ for (unsigned int i = 0; i < sizeof(header_v1.signature); i++) {
+ header_v1.signature[i] = '\0';
}
- hexdump(db->ctx, &header_v0, sizeof(header_v0));
+ hexdump(db->ctx, &header_v1, sizeof(header_v1));
// Feed header into the hash
- r = EVP_DigestVerifyUpdate(mdctx, &header_v0, sizeof(header_v0));
+ r = EVP_DigestVerifyUpdate(mdctx, &header_v1, sizeof(header_v1));
if (r != 1) {
ERROR(db->ctx, "%s\n", ERR_error_string(ERR_get_error(), NULL));
r = 1;
int r;
switch (db->version) {
case 0:
- r = loc_as_new_from_database_v0(db->ctx, db->pool, as, db->as_v0 + pos);
+ r = loc_as_new_from_database_v1(db->ctx, db->pool, as, db->as_v1 + pos);
break;
default:
int r;
switch (db->version) {
case 0:
- r = loc_network_new_from_database_v0(db->ctx, network,
- address, prefix, db->networks_v0 + pos);
+ r = loc_network_new_from_database_v1(db->ctx, network,
+ address, prefix, db->networks_v1 + pos);
break;
default:
return r;
}
-static int __loc_database_node_is_leaf(const struct loc_database_network_node_v0* node) {
+static int __loc_database_node_is_leaf(const struct loc_database_network_node_v1* node) {
return (node->network != htobe32(0xffffffff));
}
static int __loc_database_lookup_handle_leaf(struct loc_database* db, const struct in6_addr* address,
struct loc_network** network, struct in6_addr* network_address, unsigned int prefix,
- const struct loc_database_network_node_v0* node) {
+ const struct loc_database_network_node_v1* node) {
off_t network_index = be32toh(node->network);
- DEBUG(db->ctx, "Handling leaf node at %jd (%jd)\n", (intmax_t)(node - db->network_nodes_v0), (intmax_t)network_index);
+ DEBUG(db->ctx, "Handling leaf node at %jd (%jd)\n", (intmax_t)(node - db->network_nodes_v1), (intmax_t)network_index);
// Fetch the network
int r = loc_database_fetch_network(db, network,
// Searches for an exact match along the path
static int __loc_database_lookup(struct loc_database* db, const struct in6_addr* address,
struct loc_network** network, struct in6_addr* network_address,
- const struct loc_database_network_node_v0* node, unsigned int level) {
+ const struct loc_database_network_node_v1* node, unsigned int level) {
int r;
off_t node_index;
// Move on to the next node
r = __loc_database_lookup(db, address, network, network_address,
- db->network_nodes_v0 + node_index, level + 1);
+ db->network_nodes_v1 + node_index, level + 1);
// End here if a result was found
if (r == 0)
clock_t start = clock();
int r = __loc_database_lookup(db, address, network, &network_address,
- db->network_nodes_v0, 0);
+ db->network_nodes_v1, 0);
clock_t end = clock();
int r;
switch (db->version) {
case 0:
- r = loc_country_new_from_database_v0(db->ctx, db->pool, country, db->countries_v0 + pos);
+ r = loc_country_new_from_database_v1(db->ctx, db->pool, country, db->countries_v1 + pos);
break;
default:
enumerator->networks_visited[node->offset]++;
// Pop node from top of the stack
- struct loc_database_network_node_v0* n =
- enumerator->db->network_nodes_v0 + node->offset;
+ struct loc_database_network_node_v1* n =
+ enumerator->db->network_nodes_v1 + node->offset;
// Add edges to stack
r = loc_database_enumerator_stack_push_node(enumerator,
#ifdef LIBLOC_PRIVATE
-int loc_as_new_from_database_v0(struct loc_ctx* ctx, struct loc_stringpool* pool,
- struct loc_as** as, const struct loc_database_as_v0* dbobj);
-int loc_as_to_database_v0(struct loc_as* as, struct loc_stringpool* pool,
- struct loc_database_as_v0* dbobj);
+int loc_as_new_from_database_v1(struct loc_ctx* ctx, struct loc_stringpool* pool,
+ struct loc_as** as, const struct loc_database_as_v1* dbobj);
+int loc_as_to_database_v1(struct loc_as* as, struct loc_stringpool* pool,
+ struct loc_database_as_v1* dbobj);
int loc_as_match_string(struct loc_as* as, const char* string);
#include <string.h>
-int loc_country_new_from_database_v0(struct loc_ctx* ctx, struct loc_stringpool* pool,
- struct loc_country** country, const struct loc_database_country_v0* dbobj);
-int loc_country_to_database_v0(struct loc_country* country,
- struct loc_stringpool* pool, struct loc_database_country_v0* dbobj);
+int loc_country_new_from_database_v1(struct loc_ctx* ctx, struct loc_stringpool* pool,
+ struct loc_country** country, const struct loc_database_country_v1* dbobj);
+int loc_country_to_database_v1(struct loc_country* country,
+ struct loc_stringpool* pool, struct loc_database_country_v1* dbobj);
static inline void loc_country_code_copy(char* dst, const char* src) {
for (unsigned int i = 0; i < 2; i++) {
#define LOC_DATABASE_MAGIC "LOCDBXX"
+enum loc_database_version {
+ LOC_DATABASE_VERSION_UNSET = 0,
+ LOC_DATABASE_VERSION_1 = 1,
+};
+
#ifdef LIBLOC_PRIVATE
-#define LOC_DATABASE_VERSION 0
+#define LOC_DATABASE_VERSION_LATEST LOC_DATABASE_VERSION_1
#define STR(x) #x
-#define LOC_DATABASE_DOMAIN_LATEST(version) "_latest._v" STR(version) ".location.ipfire.org"
+#define LOC_DATABASE_DOMAIN(version) "_v" STR(version) "._db.location.ipfire.org"
#define LOC_DATABASE_PAGE_SIZE 4096
uint8_t version;
};
-struct loc_database_header_v0 {
+struct loc_database_header_v1 {
// UNIX timestamp when the database was created
uint64_t created_at;
char padding[32];
};
-struct loc_database_network_node_v0 {
+struct loc_database_network_node_v1 {
uint32_t zero;
uint32_t one;
uint32_t network;
};
-struct loc_database_network_v0 {
+struct loc_database_network_v1 {
// The start address and prefix will be encoded in the tree
// The country this network is located in
char padding[2];
};
-struct loc_database_as_v0 {
+struct loc_database_as_v1 {
// The AS number
uint32_t number;
uint32_t name;
};
-struct loc_database_country_v0 {
+struct loc_database_country_v1 {
char code[2];
char continent_code[2];
#ifdef LIBLOC_PRIVATE
-int loc_network_to_database_v0(struct loc_network* network, struct loc_database_network_v0* dbobj);
-int loc_network_new_from_database_v0(struct loc_ctx* ctx, struct loc_network** network,
- struct in6_addr* address, unsigned int prefix, const struct loc_database_network_v0* dbobj);
+int loc_network_to_database_v1(struct loc_network* network, struct loc_database_network_v1* dbobj);
+int loc_network_new_from_database_v1(struct loc_ctx* ctx, struct loc_network** network,
+ struct in6_addr* address, unsigned int prefix, const struct loc_database_network_v1* dbobj);
struct loc_network_tree;
int loc_network_tree_new(struct loc_ctx* ctx, struct loc_network_tree** tree);
#include <loc/libloc.h>
#include <loc/as.h>
#include <loc/country.h>
+#include <loc/database.h>
#include <loc/network.h>
struct loc_writer;
-int loc_writer_new(struct loc_ctx* ctx, struct loc_writer** writer, FILE* fkey);
+int loc_writer_new(struct loc_ctx* ctx, struct loc_writer** writer,
+ enum loc_database_version version, FILE* fkey);
struct loc_writer* loc_writer_ref(struct loc_writer* writer);
struct loc_writer* loc_writer_unref(struct loc_writer* writer);
return loc_network_has_flag(network, flag);
}
-LOC_EXPORT int loc_network_to_database_v0(struct loc_network* network, struct loc_database_network_v0* dbobj) {
+LOC_EXPORT int loc_network_to_database_v1(struct loc_network* network, struct loc_database_network_v1* dbobj) {
// Add country code
loc_country_code_copy(dbobj->country_code, network->country_code);
return 0;
}
-LOC_EXPORT int loc_network_new_from_database_v0(struct loc_ctx* ctx, struct loc_network** network,
- struct in6_addr* address, unsigned int prefix, const struct loc_database_network_v0* dbobj) {
+LOC_EXPORT int loc_network_new_from_database_v1(struct loc_ctx* ctx, struct loc_network** network,
+ struct in6_addr* address, unsigned int prefix, const struct loc_database_network_v1* dbobj) {
char country_code[3] = "\0\0";
int r = loc_network_new(ctx, network, address, prefix);
write.add_argument("--vendor", nargs="?", help=_("Sets the vendor"))
write.add_argument("--description", nargs="?", help=_("Sets a description"))
write.add_argument("--license", nargs="?", help=_("Sets the license"))
+ write.add_argument("--version", type=int, help=_("Database Format Version"))
# Update WHOIS
update_whois = subparsers.add_parser("update-whois", help=_("Update WHOIS Information"))
static int Writer_init(WriterObject* self, PyObject* args, PyObject* kwargs) {
PyObject* private_key = NULL;
+ int version = -1;
FILE* f = NULL;
// Parse arguments
- if (!PyArg_ParseTuple(args, "|O", &private_key))
+ if (!PyArg_ParseTuple(args, "|Oi", &private_key, &version))
return -1;
// Convert into FILE*
}
// Create the writer object
- int r = loc_writer_new(loc_ctx, &self->writer, f);
+ int r = loc_writer_new(loc_ctx, &self->writer,
+ (enum loc_database_version)version, f);
return r;
}
// Fall back to default domain
if (!domain)
- domain = LOC_DATABASE_DOMAIN_LATEST(LOC_DATABASE_VERSION);
+ domain = LOC_DATABASE_DOMAIN(LOC_DATABASE_VERSION_LATEST);
unsigned char answer[PACKETSZ];
int len;
// Create a database
struct loc_writer* writer;
- err = loc_writer_new(ctx, &writer, NULL);
+ err = loc_writer_new(ctx, &writer, LOC_DATABASE_VERSION_LATEST, NULL);
if (err < 0)
exit(EXIT_FAILURE);
// Create a database
struct loc_writer* writer;
- err = loc_writer_new(ctx, &writer, NULL);
+ err = loc_writer_new(ctx, &writer, LOC_DATABASE_VERSION_LATEST, NULL);
if (err < 0)
exit(EXIT_FAILURE);
// Create a database
struct loc_writer* writer;
- err = loc_writer_new(ctx, &writer, NULL);
+ err = loc_writer_new(ctx, &writer, LOC_DATABASE_VERSION_LATEST, NULL);
if (err < 0)
exit(EXIT_FAILURE);
// Create a database
struct loc_writer* writer;
- err = loc_writer_new(ctx, &writer, NULL);
+ err = loc_writer_new(ctx, &writer, LOC_DATABASE_VERSION_LATEST, NULL);
if (err < 0)
exit(EXIT_FAILURE);
// Create an empty database
struct loc_writer* writer;
- err = loc_writer_new(ctx, &writer, private_key);
+ err = loc_writer_new(ctx, &writer, LOC_DATABASE_VERSION_LATEST, private_key);
if (err < 0)
exit(EXIT_FAILURE);
struct loc_writer {
struct loc_ctx* ctx;
int refcount;
+ enum loc_database_version version;
struct loc_stringpool* pool;
off_t vendor;
return 0;
}
-LOC_EXPORT int loc_writer_new(struct loc_ctx* ctx, struct loc_writer** writer, FILE* fkey) {
+LOC_EXPORT int loc_writer_new(struct loc_ctx* ctx, struct loc_writer** writer,
+ enum loc_database_version version, FILE* fkey) {
struct loc_writer* w = calloc(1, sizeof(*w));
if (!w)
return -ENOMEM;
w->ctx = loc_ref(ctx);
w->refcount = 1;
+ // Check version
+ switch (version) {
+ case LOC_DATABASE_VERSION_1:
+ w->version = version;
+ break;
+
+ case LOC_DATABASE_VERSION_UNSET:
+ w->version = LOC_DATABASE_VERSION_LATEST;
+ break;
+
+ default:
+ ERROR(ctx, "Invalid database version: %d\n", version);
+ loc_writer_unref(w);
+ return -1;
+ }
+
int r = loc_stringpool_new(ctx, &w->pool);
if (r) {
loc_writer_unref(w);
magic->magic[i] = LOC_DATABASE_MAGIC[i];
// Set version
- magic->version = htobe16(LOC_DATABASE_VERSION);
+ magic->version = htobe16(writer->version);
}
static void align_page_boundary(off_t* offset, FILE* f) {
}
static int loc_database_write_pool(struct loc_writer* writer,
- struct loc_database_header_v0* header, off_t* offset, FILE* f) {
+ struct loc_database_header_v1* header, off_t* offset, FILE* f) {
// Save the offset of the pool section
DEBUG(writer->ctx, "Pool starts at %jd bytes\n", (intmax_t)*offset);
header->pool_offset = htobe32(*offset);
}
static int loc_database_write_as_section(struct loc_writer* writer,
- struct loc_database_header_v0* header, off_t* offset, FILE* f) {
+ struct loc_database_header_v1* header, off_t* offset, FILE* f) {
DEBUG(writer->ctx, "AS section starts at %jd bytes\n", (intmax_t)*offset);
header->as_offset = htobe32(*offset);
size_t as_length = 0;
- struct loc_database_as_v0 as;
+ struct loc_database_as_v1 as;
for (unsigned int i = 0; i < writer->as_count; i++) {
// Convert AS into database format
- loc_as_to_database_v0(writer->as[i], writer->pool, &as);
+ loc_as_to_database_v1(writer->as[i], writer->pool, &as);
// Write to disk
*offset += fwrite(&as, 1, sizeof(as), f);
}
static int loc_database_write_networks(struct loc_writer* writer,
- struct loc_database_header_v0* header, off_t* offset, FILE* f) {
+ struct loc_database_header_v1* header, off_t* offset, FILE* f) {
// Write the network tree
DEBUG(writer->ctx, "Network tree starts at %jd bytes\n", (intmax_t)*offset);
header->network_tree_offset = htobe32(*offset);
uint32_t index = 0;
uint32_t network_index = 0;
- struct loc_database_network_v0 db_network;
- struct loc_database_network_node_v0 db_node;
+ struct loc_database_network_v1 db_network;
+ struct loc_database_network_node_v1 db_node;
// Initialize queue for nodes
TAILQ_HEAD(node_t, node) nodes;
TAILQ_REMOVE(&networks, nw, networks);
// Prepare what we are writing to disk
- int r = loc_network_to_database_v0(nw->network, &db_network);
+ int r = loc_network_to_database_v1(nw->network, &db_network);
if (r)
return r;
}
static int loc_database_write_countries(struct loc_writer* writer,
- struct loc_database_header_v0* header, off_t* offset, FILE* f) {
+ struct loc_database_header_v1* header, off_t* offset, FILE* f) {
DEBUG(writer->ctx, "Countries section starts at %jd bytes\n", (intmax_t)*offset);
header->countries_offset = htobe32(*offset);
size_t countries_length = 0;
- struct loc_database_country_v0 country;
+ struct loc_database_country_v1 country;
for (unsigned int i = 0; i < writer->countries_count; i++) {
// Convert country into database format
- loc_country_to_database_v0(writer->countries[i], writer->pool, &country);
+ loc_country_to_database_v1(writer->countries[i], writer->pool, &country);
// Write to disk
*offset += fwrite(&country, 1, sizeof(country), f);
}
static int loc_writer_create_signature(struct loc_writer* writer,
- struct loc_database_header_v0* header, FILE* f) {
+ struct loc_database_header_v1* header, FILE* f) {
DEBUG(writer->ctx, "Signing database...\n");
// Read file from the beginning
make_magic(writer, &magic);
// Make the header
- struct loc_database_header_v0 header;
+ struct loc_database_header_v1 header;
header.vendor = htobe32(writer->vendor);
header.description = htobe32(writer->description);
header.license = htobe32(writer->license);