<<< Chronological >>> Author Index    Subject Index <<< Threads >>>

IPv6 representation in perl

  • From: Guy Vegoda < >
  • Date: Mon, 26 Feb 2001 16:39:55 +0000
  • Reply-to: Guy Vegoda < >

On an entirely different point, I would like to
start a separate thread about the best way to
represent IPv6 numbers in Perl.  

I have the following thoughts.

Possible ways may be:

(1) Using a 128 element binary array, and writing
all the binary maths yourself to manipulate that.

(2) Using a 4 element array storing four hex 
characters from 0 to F.

Probably far slower than the above method, but
smaller for storing many IPs.

I know that Perl can natively think in hex, so maybe
it would be faster than I think.

(3) Having a complex structure, where the IP number
is stored in parts - the top /48 (in any of several
formats), with variable structure subnets underneath 
that.

Could be tricky for the maths, if the variable bits
are badly thought out.

(4) Storing four "IPv4-esque" decimal strings in an
array, or as part of an object. Then do the maths
on each of those separately. Probably fast.

(5) Storing a single parant /48 object (in any
format) and have child objects with only the bottom
parts of the IP to worry about.

I wonder how that would work.

--------

When I have gone away and read more of Mastering
Algorithms with Perl, I will come back and maybe
make some more comments.

Just as a disclaimer - I am in no way making any
comments on Manuel's already excellent libraries. I
have already spoken to him about them, and would not  
want to appear to "go behind his back". This is an 
entirely intellectual exercise only. 

In fact, I would very much like to see Manuel post
his own thoughts and real world experiences on the
subject (of which I have none).

I wish every one well,

Guy

-- 
Guy Vegoda \ guy@localhost *Please do not send html*
NIC: GUY-RIPE \ guy@localhost *attachments*
Unix, Linux Hobbyist \ +44(0)20 7961 8318 (work) 
www.thenakedfrenchman.com \ +44(0)958 469 532 (cell)




  • Post To The List:
<<< Chronological >>> Author    Subject <<< Threads >>>