[ANN] Trie LCH

J

jm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

TrieLCH or Trie::LCH is a Trie with Level Compression and Hashing to
be used in a manner similar to Hashes but with IP addresses as keys.
This includes the use of the mask component of the IP address allowing
you to store a value for a subnet and another for a subnet within that
subnet.

Example
trie = Trie::LCH.new()
trie.add("192.168.0.0/24","network A")
trie.add("192.168.0.128/25", "network B")
trie.match("192.168.0.1") -> "network A"
trie.match("192.168.0.32/8") -> "network A"
trie.match("192.168.0.129") -> "network B"
trie.match("10.0.0.0/8") -> nil

Alternatively,
trie = Trie::LC.new()
trie["192.168.0.0/24"] = "network A"
trie["192.168.0.1"] -> "network A"


Homepage: http://ghostgun.com/software/trielch/


This is a quick release to make this package available to the wider
community of ruby users. Trie::LCH lacks a delete() method making it
unsuitable for some uses. Having said that it should still prove useful
to anyone working with IP addresses.

Jeff.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (Darwin)

iD8DBQFBxhq7EMczJf0zY5MRAq//AJwJ6atMnWe/JmX9pIAxH2mCWY8CywCfQg5/
n6RD+3vIJX1dX1DGOYXyJeI=
=tYRp
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top