summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-05 11:35:30 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-05 11:35:30 -0800
commitb4b78cee341f07dd3fec1bc90c7310e6c2593d09 (patch)
tree85fb26f3f2c8ce15727c25539f7e68b1390e283a
parent43c8d9ed9b30c21f3484665b174974f7e74d4f1d (diff)
parentd2418b63d68d5bb562e64e322244f6b83af18620 (diff)
downloadvyatta-cfg-b4b78cee341f07dd3fec1bc90c7310e6c2593d09.tar.gz
vyatta-cfg-b4b78cee341f07dd3fec1bc90c7310e6c2593d09.zip
Merge branch 'jenner' of suva.vyatta.com:/git/vyatta-cfg into jenner
-rw-r--r--debian/changelog18
-rwxr-xr-xlib/Vyatta/TypeChecker.pm16
2 files changed, 34 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 0cd89ef..bb4a941 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
+vyatta-cfg (0.14.9) unstable; urgency=low
+
+ * Add type checking functions for 16- and 32-bit hexadecimal values.
+
+ -- Bob Gilligan <gilligan@vyatta.com> Wed, 04 Feb 2009 14:52:25 -0800
+
+vyatta-cfg (0.14.8) unstable; urgency=low
+
+ * Revert "Cleanup confg library"
+ * Vyatta::Config::returnValue - change to three argument open
+ * Vyatta::Config - fix perlcritic warnings from dangling return
+ * Vyatta::Config - simplify boolean
+ * Vyatta::Config - don't use global handle for opendir
+ * Vyatta::ConfigOutput - test for exists should not use defined
+ * Vyatta::Config - exists simplification
+
+ -- Stephen Hemminger <stephen.hemminger@vyatta.com> Wed, 04 Feb 2009 11:08:50 -0800
+
vyatta-cfg (0.14.7) unstable; urgency=low
* Reindent load config for clarity
diff --git a/lib/Vyatta/TypeChecker.pm b/lib/Vyatta/TypeChecker.pm
index 37f365d..89b8932 100755
--- a/lib/Vyatta/TypeChecker.pm
+++ b/lib/Vyatta/TypeChecker.pm
@@ -67,6 +67,8 @@ my %type_handler = (
'ipv6_negate' => \&validate_ipv6_negate,
'ipv6net' => \&validate_ipv6net,
'ipv6net_negate' => \&validate_ipv6net_negate,
+ 'hex16' => \&validate_hex_16_bits,
+ 'hex32' => \&validate_hex_32_bits,
);
sub validate_ipv4 {
@@ -222,6 +224,20 @@ sub validate_ipv6net_negate {
return validate_ipv6net($value);
}
+# Validate a 16-bit hex value, no leading "0x"
+sub validate_hex_16_bits {
+ my $value = shift;
+ $value = lc $value;
+ return 1 if ($value =~ /^[0-9a-f]{4}$/)
+}
+
+# Validate a 32-bit hex value, no leading "0x"
+sub validate_hex_32_bits {
+ my $value = shift;
+ $value = lc $value;
+ return 1 if ($value =~ /^[0-9a-f]{8}$/)
+}
+
sub validateType {
my ($type, $value, $quiet) = @_;
if (!defined($type) || !defined($value)) {