IP Math anyone?
Doug Stanfield
DOUGS at oceanic.com
Sun Mar 4 15:02:18 EST 2001
A cryptic suggestion was made before to follow this link:
http://www.vex.net/parnassus/apyllo.py?i=35559588
I'd like to reiterate that, with the information that it is a set of classes
that implements most of what you'll end up re-implementing in your "crude
hack". As the discussion showed, its necessary to have both the IP and
netmask info in order to get the math right. These classes give you that as
a start, and I'd guess adding the math functions would be easier than
starting over.
-Doug-
> -----Original Message-----
> From: Timothy Grant [mailto:tjg at exceptionalminds.com]
> Sent: Tuesday, February 27, 2001 9:09 AM
> To: python-list at python.org
> Subject: Re: IP Math anyone?
>
>
> Thanks to all of you who made this thread much more
> enlightening than expected! As I expected, it is a somewhat
> complex problem, for which I will probably throw together a
> class with a nice interface but internals of which are a crude
> hack, and then refine the internals as time allows.
>
>
> On Tue, Feb 27, 2001 at 07:38:56AM -0600, Chris Gonnerman wrote:
> > You neglected to tell us where to download your class from,
> or to attach
> > the source. I at least would like to see it.
> >
> > ----- Original Message -----
> > From: "Tino Wildenhain" <tino at wildenhain.de>
> > Subject: Re: IP Math anyone?
> > > Hi Timothy,
> > >
> > > for teaching I made a class for this.
> > >
> > > you can instantiate it with a=ip('192.168.0.254/24') or
> > > a=ip('192.168.0.254','255.255.255.0') just using
> a=ip('192.168.0.254')
> > > would assign a appropriate subnet mask for this class
> (class B results in
> > > /16 or 255.255.0.0)
> > >
> > > Since IP-adresses are only 32bit non signed integers,
> they are internally
> > > represented
> > > like that.
> > > If you make a class like that you can simply add the
> support to add
> > > integers to
> > > it according to the subnet-mask you use.
> > >
> > > Regards
> > > Tino
>
> --
> Stand Fast,
> tjg.
>
> Timothy Grant tjg at exceptionalminds.com
> Red Hat Certified Engineer www.exceptionalminds.com
> Avalon Technology Group, Inc. <>< (503) 246-3630
> >>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
> >>>>This machine was last rebooted: 41 days 23:20 hours ago<<
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list