]> git.ipfire.org Git - people/ms/libloc.git/log
people/ms/libloc.git
6 years agoWhen formatting an IP address only pass the actual IP address
Michael Tremer [Mon, 8 Jan 2018 18:58:00 +0000 (18:58 +0000)] 
When formatting an IP address only pass the actual IP address

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agonetwork: Fix calculating the last IP address of a network
Michael Tremer [Mon, 8 Jan 2018 18:56:00 +0000 (18:56 +0000)] 
network: Fix calculating the last IP address of a network

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoCorrectly handle invalid IP addresses
Michael Tremer [Mon, 8 Jan 2018 18:42:21 +0000 (18:42 +0000)] 
Correctly handle invalid IP addresses

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Make level variable unsigned (as used in log messages)
Michael Tremer [Mon, 8 Jan 2018 18:36:49 +0000 (18:36 +0000)] 
database: Make level variable unsigned (as used in log messages)

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoFix typo in comparison function
Michael Tremer [Mon, 8 Jan 2018 18:29:29 +0000 (18:29 +0000)] 
Fix typo in comparison function

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoFix typo
Michael Tremer [Mon, 8 Jan 2018 18:25:28 +0000 (18:25 +0000)] 
Fix typo

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Stop walking down the tree when we hit a leaf node
Michael Tremer [Mon, 8 Jan 2018 18:06:13 +0000 (18:06 +0000)] 
database: Stop walking down the tree when we hit a leaf node

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoAdd license attribute to the database
Michael Tremer [Mon, 8 Jan 2018 17:57:46 +0000 (17:57 +0000)] 
Add license attribute to the database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Save path when opening the database
Michael Tremer [Mon, 8 Jan 2018 17:46:17 +0000 (17:46 +0000)] 
python: Save path when opening the database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoRemove test.db when running "make clean"
Michael Tremer [Mon, 8 Jan 2018 17:41:47 +0000 (17:41 +0000)] 
Remove test.db when running "make clean"

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoAdd a few examples that show how to use the python module
Michael Tremer [Mon, 8 Jan 2018 17:39:55 +0000 (17:39 +0000)] 
Add a few examples that show how to use the python module

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Handle error codes when searching for an AS
Michael Tremer [Mon, 8 Jan 2018 17:33:23 +0000 (17:33 +0000)] 
python: Handle error codes when searching for an AS

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoInstall python module into correct location
Michael Tremer [Mon, 8 Jan 2018 17:25:37 +0000 (17:25 +0000)] 
Install python module into correct location

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoDrop loc_load function
Michael Tremer [Mon, 8 Jan 2018 17:14:53 +0000 (17:14 +0000)] 
Drop loc_load function

We don't need this any more

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoHide all functions that we don't want to make public
Michael Tremer [Mon, 8 Jan 2018 17:11:33 +0000 (17:11 +0000)] 
Hide all functions that we don't want to make public

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoRemove loc_database_write which no longer exists from header
Michael Tremer [Mon, 8 Jan 2018 17:03:05 +0000 (17:03 +0000)] 
Remove loc_database_write which no longer exists from header

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agowriter: Move alignment into each section writer
Michael Tremer [Mon, 8 Jan 2018 17:01:08 +0000 (17:01 +0000)] 
writer: Move alignment into each section writer

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Implement adding networks to Writer
Michael Tremer [Mon, 8 Jan 2018 16:59:30 +0000 (16:59 +0000)] 
python: Implement adding networks to Writer

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Unmap all mapped sections when freeing database
Michael Tremer [Mon, 8 Jan 2018 16:52:01 +0000 (16:52 +0000)] 
database: Unmap all mapped sections when freeing database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Make lookup function available
Michael Tremer [Mon, 8 Jan 2018 16:42:46 +0000 (16:42 +0000)] 
python: Make lookup function available

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoconfigure: Check for the existance of some headers
Michael Tremer [Mon, 8 Jan 2018 16:30:24 +0000 (16:30 +0000)] 
configure: Check for the existance of some headers

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Implement lookup
Michael Tremer [Mon, 8 Jan 2018 15:56:28 +0000 (15:56 +0000)] 
database: Implement lookup

This allows to pass an IP address to the database and
to return the result

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Implement reading a network from the database
Michael Tremer [Mon, 8 Jan 2018 11:55:58 +0000 (11:55 +0000)] 
database: Implement reading a network from the database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Load networks from database
Michael Tremer [Sun, 7 Jan 2018 20:21:16 +0000 (20:21 +0000)] 
database: Load networks from database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Pass header to functions loading database sections
Michael Tremer [Sun, 7 Jan 2018 20:12:25 +0000 (20:12 +0000)] 
database: Pass header to functions loading database sections

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Map network nodes section when opening the database
Michael Tremer [Sun, 7 Jan 2018 20:09:44 +0000 (20:09 +0000)] 
database: Map network nodes section when opening the database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agowriter: Write out the network tree
Michael Tremer [Sun, 7 Jan 2018 13:32:51 +0000 (13:32 +0000)] 
writer: Write out the network tree

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agonetwork: Fix walking through the tree in order
Michael Tremer [Fri, 5 Jan 2018 16:44:56 +0000 (16:44 +0000)] 
network: Fix walking through the tree in order

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agotest: Write a ASN to the network database
Michael Tremer [Fri, 5 Jan 2018 16:41:32 +0000 (16:41 +0000)] 
test: Write a ASN to the network database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoOne byte doesn't have to be converted to big endian
Michael Tremer [Fri, 5 Jan 2018 16:40:21 +0000 (16:40 +0000)] 
One byte doesn't have to be converted to big endian

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agotest: Write two test networks to the database
Michael Tremer [Fri, 5 Jan 2018 16:35:46 +0000 (16:35 +0000)] 
test: Write two test networks to the database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoDeclare a static function as static
Michael Tremer [Fri, 5 Jan 2018 16:30:46 +0000 (16:30 +0000)] 
Declare a static function as static

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agotest: Add a second network to a tree
Michael Tremer [Fri, 5 Jan 2018 16:30:01 +0000 (16:30 +0000)] 
test: Add a second network to a tree

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agonetwork: Implement function to count all nodes
Michael Tremer [Fri, 5 Jan 2018 16:25:46 +0000 (16:25 +0000)] 
network: Implement function to count all nodes

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agonetwork: Always use the first address of a network
Michael Tremer [Tue, 2 Jan 2018 17:38:21 +0000 (17:38 +0000)] 
network: Always use the first address of a network

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoMap prefix to IPv6 as well for IPv4 addresses
Michael Tremer [Tue, 2 Jan 2018 17:26:02 +0000 (17:26 +0000)] 
Map prefix to IPv6 as well for IPv4 addresses

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoValidate the prefix to be within range
Michael Tremer [Tue, 2 Jan 2018 17:17:57 +0000 (17:17 +0000)] 
Validate the prefix to be within range

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoPrevent segmentation fault when no prefix is present
Michael Tremer [Tue, 2 Jan 2018 17:07:03 +0000 (17:07 +0000)] 
Prevent segmentation fault when no prefix is present

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agonetwork: Support parsing IPv4 addresses and map them to IPv6
Michael Tremer [Sat, 30 Dec 2017 16:35:56 +0000 (16:35 +0000)] 
network: Support parsing IPv4 addresses and map them to IPv6

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoMake AS independent from stringpool
Michael Tremer [Sat, 30 Dec 2017 15:26:14 +0000 (15:26 +0000)] 
Make AS independent from stringpool

Strings are written to the string pool when a AS is written to
disk.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agonetwork: Add asn and remove reference to struct loc_as
Michael Tremer [Fri, 29 Dec 2017 20:39:04 +0000 (20:39 +0000)] 
network: Add asn and remove reference to struct loc_as

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Implement Network class
Michael Tremer [Fri, 29 Dec 2017 20:21:45 +0000 (20:21 +0000)] 
python: Implement Network class

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Implement setting description to the writer
Michael Tremer [Fri, 29 Dec 2017 19:52:17 +0000 (19:52 +0000)] 
python: Implement setting description to the writer

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Fix setters
Michael Tremer [Fri, 29 Dec 2017 19:48:49 +0000 (19:48 +0000)] 
python: Fix setters

Setters however expected a tuple instead of the value directly

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Implement adding an AS to the writer
Michael Tremer [Fri, 29 Dec 2017 19:47:38 +0000 (19:47 +0000)] 
python: Implement adding an AS to the writer

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Add write method to Writer
Michael Tremer [Fri, 29 Dec 2017 15:13:49 +0000 (15:13 +0000)] 
python: Add write method to Writer

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Add Writer class
Michael Tremer [Fri, 29 Dec 2017 14:57:52 +0000 (14:57 +0000)] 
python: Add Writer class

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agowriter: Correctly increase offset when writing ASes
Michael Tremer [Fri, 29 Dec 2017 14:41:35 +0000 (14:41 +0000)] 
writer: Correctly increase offset when writing ASes

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Impement setting the name of an AS
Michael Tremer [Fri, 29 Dec 2017 14:29:50 +0000 (14:29 +0000)] 
python: Impement setting the name of an AS

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Implement comparison of ASes
Michael Tremer [Fri, 29 Dec 2017 14:25:34 +0000 (14:25 +0000)] 
python: Implement comparison of ASes

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Show better repr for AS classes
Michael Tremer [Fri, 29 Dec 2017 14:17:56 +0000 (14:17 +0000)] 
python: Show better repr for AS classes

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoas: Return NULL if name is not set
Michael Tremer [Fri, 29 Dec 2017 14:17:39 +0000 (14:17 +0000)] 
as: Return NULL if name is not set

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Remove reference to context from database
Michael Tremer [Fri, 29 Dec 2017 14:07:42 +0000 (14:07 +0000)] 
python: Remove reference to context from database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Remove local stringpool and ctx from AS class
Michael Tremer [Fri, 29 Dec 2017 14:06:00 +0000 (14:06 +0000)] 
python: Remove local stringpool and ctx from AS class

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Access ASes from database
Michael Tremer [Fri, 29 Dec 2017 14:03:41 +0000 (14:03 +0000)] 
python: Access ASes from database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Only use global loc context
Michael Tremer [Fri, 29 Dec 2017 13:00:24 +0000 (13:00 +0000)] 
python: Only use global loc context

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Create a global loc_ctx* context
Michael Tremer [Fri, 29 Dec 2017 12:02:21 +0000 (12:02 +0000)] 
python: Create a global loc_ctx* context

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Add AS class
Michael Tremer [Fri, 29 Dec 2017 11:53:02 +0000 (11:53 +0000)] 
python: Add AS class

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Expose database creation time
Michael Tremer [Fri, 29 Dec 2017 11:32:56 +0000 (11:32 +0000)] 
python: Expose database creation time

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Expose database description and vendor
Michael Tremer [Fri, 29 Dec 2017 11:27:30 +0000 (11:27 +0000)] 
python: Expose database description and vendor

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoheaders: Don't make private structures public
Michael Tremer [Fri, 29 Dec 2017 11:22:22 +0000 (11:22 +0000)] 
headers: Don't make private structures public

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoMove all header files into src/loc and install them
Michael Tremer [Fri, 29 Dec 2017 11:20:30 +0000 (11:20 +0000)] 
Move all header files into src/loc and install them

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopython: Add Database class
Michael Tremer [Fri, 29 Dec 2017 11:10:01 +0000 (11:10 +0000)] 
python: Add Database class

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoStart a Python module
Michael Tremer [Thu, 28 Dec 2017 18:32:45 +0000 (18:32 +0000)] 
Start a Python module

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoWrite networks to the database
Michael Tremer [Thu, 28 Dec 2017 18:07:11 +0000 (18:07 +0000)] 
Write networks to the database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoAllow creating networks in memory
Michael Tremer [Thu, 28 Dec 2017 16:55:33 +0000 (16:55 +0000)] 
Allow creating networks in memory

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoDo not copy the file pointer when opening a database
Michael Tremer [Tue, 12 Dec 2017 17:11:27 +0000 (17:11 +0000)] 
Do not copy the file pointer when opening a database

We don't need this at all when we are using mmap to read
any data from any of the sections.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoUse be*toh and htobe* to convert to big-endian
Michael Tremer [Tue, 12 Dec 2017 17:06:18 +0000 (17:06 +0000)] 
Use be*toh and htobe* to convert to big-endian

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoLog how long it takes to open the database
Michael Tremer [Tue, 12 Dec 2017 17:02:46 +0000 (17:02 +0000)] 
Log how long it takes to open the database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Log how long it took to retrieve an AS
Michael Tremer [Tue, 12 Dec 2017 16:58:16 +0000 (16:58 +0000)] 
database: Log how long it took to retrieve an AS

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agostringpool: Make them initializable right from the file
Michael Tremer [Tue, 12 Dec 2017 16:45:22 +0000 (16:45 +0000)] 
stringpool: Make them initializable right from the file

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agotest: We do not guarantee that string pointers never change
Michael Tremer [Tue, 12 Dec 2017 16:44:50 +0000 (16:44 +0000)] 
test: We do not guarantee that string pointers never change

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoSplit database into a writer and reader
Michael Tremer [Tue, 12 Dec 2017 15:52:47 +0000 (15:52 +0000)] 
Split database into a writer and reader

This allows us to build both parts more to their
own purpose instead of making code overly complicated
to archive flexibility we don't need.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Move string pool to the end of the file again
Michael Tremer [Tue, 12 Dec 2017 13:31:27 +0000 (13:31 +0000)] 
database: Move string pool to the end of the file again

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Save time when the database was created
Michael Tremer [Tue, 12 Dec 2017 13:29:10 +0000 (13:29 +0000)] 
database: Save time when the database was created

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Add function to align to page boundaries
Michael Tremer [Tue, 12 Dec 2017 13:16:54 +0000 (13:16 +0000)] 
database: Add function to align to page boundaries

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Cleanup writing AS section
Michael Tremer [Tue, 12 Dec 2017 13:14:14 +0000 (13:14 +0000)] 
database: Cleanup writing AS section

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Cleanup writing pool
Michael Tremer [Tue, 12 Dec 2017 13:08:34 +0000 (13:08 +0000)] 
database: Cleanup writing pool

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoconfigure: We don't allow disabling logging any more
Michael Tremer [Tue, 12 Dec 2017 12:50:16 +0000 (12:50 +0000)] 
configure: We don't allow disabling logging any more

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agostringpool: Use mmap to make reading the pool more efficient
Michael Tremer [Tue, 12 Dec 2017 12:49:44 +0000 (12:49 +0000)] 
stringpool: Use mmap to make reading the pool more efficient

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodatabase: Copy the file pointer so we can keep the file open
Michael Tremer [Tue, 12 Dec 2017 12:04:49 +0000 (12:04 +0000)] 
database: Copy the file pointer so we can keep the file open

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoMove all database format definition into format.h
Michael Tremer [Tue, 12 Dec 2017 11:43:59 +0000 (11:43 +0000)] 
Move all database format definition into format.h

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoIntroduce object to store an AS
Michael Tremer [Tue, 12 Dec 2017 11:40:47 +0000 (11:40 +0000)] 
Introduce object to store an AS

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoDraft initial database format
Michael Tremer [Fri, 8 Dec 2017 14:49:17 +0000 (14:49 +0000)] 
Draft initial database format

This patch adds a writer and reader for the database and already
has some metadata and the ability to write and read the string
pool from disk.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoAdd deduplicated and memory-efficient string pool
Michael Tremer [Thu, 7 Dec 2017 12:36:11 +0000 (12:36 +0000)] 
Add deduplicated and memory-efficient string pool

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoInitial commit
Michael Tremer [Tue, 5 Dec 2017 18:48:36 +0000 (18:48 +0000)] 
Initial commit

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>