PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Sep 25, 2020 12:09 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Tue Aug 15, 2006 7:23 am 
Offline
DevNet Master
User avatar

Joined: Mon Oct 25, 2004 9:29 pm
Posts: 3698
Location: New Jersey, US


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 8:24 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 9:37 am 
Offline
DevNet Master
User avatar

Joined: Tue May 24, 2005 6:01 pm
Posts: 3179
Location: UK
Oh yeah Feyd, I meant to ask is that Object code with __get and __set PD? I mean, can I use it?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 9:45 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 9:48 am 
Offline
DevNet Master
User avatar

Joined: Tue May 24, 2005 6:01 pm
Posts: 3179
Location: UK


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 3:45 pm 
Offline
DevNet Master
User avatar

Joined: Mon Oct 25, 2004 9:29 pm
Posts: 3698
Location: New Jersey, US


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 3:49 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 3:52 pm 
Offline
DevNet Master
User avatar

Joined: Mon Oct 25, 2004 9:29 pm
Posts: 3698
Location: New Jersey, US
Aha. So this should be usable out of the box.

Hmm... would the algorithm benefit from the pre-knowledge that the address is IPv6? This is because the URI RFC requires IP literals (IPv6 and all future versions) have brackets around them, so I'll know before-hand whether or not it's IPv6 or not. Edit - Doh, yes, of course, even a cursory glance of the code would have told me that. Nevermind.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 3:57 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
They would still have to validate the formatting, so not really. Now, if you wanted to test if the IP given is routable, then there's additionall code to add. My unit test(s) list the nonroutable masks. It wouldn't be difficult to add.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 4:05 pm 
Offline
DevNet Master
User avatar

Joined: Mon Oct 25, 2004 9:29 pm
Posts: 3698
Location: New Jersey, US


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 4:27 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
Syntax: [ Download ] [ Hide ]
$this->AssertTrue( isValidIPv6('::/128'));                                                            //    compressed, unspecified address type, non-routable

                $this->AssertTrue( isValidIPv6('::1/128'));                                             //   compressed, loopback address type, non-routable

                $this->AssertTrue( isValidIPv6('FE80::/10'));                           // compressed, link-local unicast, non-routable

                $this->AssertTrue( isValidIPv6('FEC0::/10'));                           // compressed, site-local unicast, deprecated
are the IPv6 non-routables. Everything else is considered a unicast, and therefore "allowed."

As for IPv4 and URI.. well, if you want to remove support for IPv4, those are in the code as $ip4 and $IPv4address in mine and the other algorithm, respectively. It's really easy to make IPv4 fail my test, change the first true to false, done. :)

I'm actually not all that well versed in the finer details of this layer of networking either. But since the idea of validating IPv6 intrigued me, I read the RFC and built what you see on the previous page. :D


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 4:31 pm 
Offline
DevNet Master
User avatar

Joined: Mon Oct 25, 2004 9:29 pm
Posts: 3698
Location: New Jersey, US


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group