IP Validation
Total VIs:
strpos.vi, strrpos.vi, substr_count.vi, valid_ipv6.vi, test,vi, unittest.vi, ip2long.vi, long2ip.vi, valid_ipv4.vi
Description:
I saw in the svn of OpenG that there was a candidate for IP validation. But however I think I have a better one. One for IPv4 and one for IPv6, credits for the IPv6 algo goes to http://crisp.tweakbl...d-caveats).html
Note:
-
Blockdiagram:
-
What are you thoughts on this VI?
- Would you like to see such a function in OpenG?
- Can you optimize the code?
- In which package should it be included?
- Should it be rejected?
-edit- ups I forgot to set the unittests data I inputed in the control as default value... well you can now enter them by hand.
$unitTests = array(
'2001:0db8:0000:0000:0000:0000:1428:57ab' => true,
'2001:0DB8:0000:0000:0000:0000:1428:57AB' => true,
'2001:00db8:0000:0000:0000:0000:1428:57ab' => false,
'2001:0db8:xxxx:0000:0000:0000:1428:57ab' => false,
'2001:db8::1428:57ab' => true,
'2001:db8::1428::57ab' => false,
'2001:dx0::1234' => false,
'2001:db0::12345' => false,
'' => false,
':' => false,
'::' => true,
':::' => false,
'::::' => false,
'::1' => true,
':::1' => false,
'::1.2.3.4' => true,
'::256.0.0.1' => false,
'::01.02.03.04' => false,
'a:b:c::1.2.3.4' => true,
'a:b:c:d::1.2.3.4' => true,
'a:b:c:d:e::1.2.3.4' => true,
'a:b:c:d:e:f:1.2.3.4' => true,
'a:b:c:d:e:f:1.256.3.4' => false,
'a:b:c:d:e:f::1.2.3.4' => false,
'a:b:c:d:e:f:0:1:2' => false,
'a:b:c:d:e:f:0:1' => true,
'a::b:c:d:e:f:0:1' => false,
'a::c:d:e:f:0:1' => true,
'a:<img src='http://lavag.org/public/style_emoticons/<#EMO_DIR#>/biggrin.png' class='bbc_emoticon' alt=':D' />:e:f:0:1' => true,
'a::e:f:0:1' => true,
'a::f:0:1' => true,
'a::0:1' => true,
'a::1' => true,
'a::' => true,
'::0:1:a:b:c:d:e:f' => false,
'::0:a:b:c:d:e:f' => false,
'::a:b:c:d:e:f' => true,
'::b:c:d:e:f' => true,
'::c:d:e:f' => true,
':<img src='http://lavag.org/public/style_emoticons/<#EMO_DIR#>/biggrin.png' class='bbc_emoticon' alt=':D' />:e:f' => true,
'::e:f' => true,
'::f' => true,
'0:1:a:b:c:d:e:f::' => false,
'0:a:b:c:d:e:f::' => false,
'a:b:c:d:e:f::' => true,
'b:c:d:e:f::' => true,
'c:d:e:f::' => true,
'd:e:f::' => true,
'e:f::' => true,
'f::' => true,
'a:b:::e:f' => false,
'::a:' => false,
'::a::' => false,
':a::b' => false,
'a::b:' => false,
'::a:b::c' => false,
'abcde::f' => false,
'10.0.0.1' => false,
':10.0.0.1' => false,
'0:0:0:255.255.255.255' => false,
'1fff::a88:85a3::172.31.128.1' => false,
'a:b:c:d:e:f:0::1' => false,
'a:b:c:d:e:f:0::' => false,
'a:b:c:d:e:f::0' => true,
'a:b:c:d:e:f::' => true,
'total gibberish' => false
);
Attached Files
Edited by Wouter, 04 January 2012 - 02:05 AM.













