I’m looking for the ruby equivalent of the perl Net::Patricia module
which uses the Patricia Trie algorithm for storing objects in
association with a ip address/mask combinations. For example,
p = Patricia.new()
p.add_address(‘127.0.0.0/8’, obj) # stores object obj
o = p.match(‘127.0.0.1’) # returns object obj
Is there anything similar already in existence for ruby? Is it possible
to adapt the acl modules?
I’m looking for the ruby equivalent of the perl Net::Patricia module
which uses the Patricia Trie algorithm for storing objects in
association with a ip address/mask combinations. For example,
p = Patricia.new()
p.add_address(‘127.0.0.0/8’, obj) # stores object obj
o = p.match(‘127.0.0.1’) # returns object obj
Is there anything similar already in existence for ruby? Is it possible
to adapt the acl modules?
I’m trying to avoid re-inventing the wheel.
Jeff.
Is there an overall Trie object in Ruby at all? I would be interested
in one if it exists. If it doesn’t maybe that’s something important we
are missing. I’m done with finals in a week or so, maybe i’ll throw
something together after that.
Charles Comstock
I’m looking for the ruby equivalent of the perl Net::Patricia module
which uses the Patricia Trie algorithm for storing objects in
association with a ip address/mask combinations. For example,
I’m not familiar with this package but…
p = Patricia.new()
p.add_address(‘127.0.0.0/8’, obj) # stores object obj
o = p.match(‘127.0.0.1’) # returns object obj
Tuplespaces may help, though you’ll need to create some Netmask
class with an === operator so it will compare the addresses against
the mask (to do the matching) the way you want. This is part of Rinda
which is part of ruby out of the box.
It would be much appreciated. I shouldn’t be playing with ruby at the
moment either I’ve couple of assignments and exams to look forward to
in the next month (along with full time work).
Jeff.
···
On 07/05/2004, at 4:03 PM, Charles Comstock wrote:
Is there an overall Trie object in Ruby at all? I would be interested
in one if it exists. If it doesn’t maybe that’s something important
we are missing. I’m done with finals in a week or so, maybe i’ll
throw something together after that.
Charles Comstock
This combined with the suggestion made by hgs@dmu.ac.uk to use
truplespaces may provide a short term solution. The only problem I
have with truplespaces is the number of match operations that may be
needed. I checked the authors web pages (which is in japanese) from
reading between the lines I don’t think he mentions what algorithm he
uses.
Looks like I’ll have to read the source.
Take a look at some of the following for info on patricia tries if your
curious,