summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-04-23 16:02:59 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2010-04-23 16:02:59 -0700
commit9fdaa4bb4989cc5d402e7cda92931203969ce289 (patch)
tree48ab8ab23e883ec2c596b0e066860515d0716672 /lib
parent9e6a04ed686a86971e6b037af2c705caec07723b (diff)
downloadvyatta-cfg-9fdaa4bb4989cc5d402e7cda92931203969ce289.tar.gz
vyatta-cfg-9fdaa4bb4989cc5d402e7cda92931203969ce289.zip
support all valid multi-type types
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/TypeChecker.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Vyatta/TypeChecker.pm b/lib/Vyatta/TypeChecker.pm
index c13ef4b..d6c470d 100755
--- a/lib/Vyatta/TypeChecker.pm
+++ b/lib/Vyatta/TypeChecker.pm
@@ -69,7 +69,9 @@ my %type_handler = (
'hex32' => \&validate_hex_32_bits,
'ipv6_addr_param' => \&validate_ipv6_addr_param,
'restrictive_filename' => \&validate_restrictive_filename,
- 'no_bash_special' => \&validate_no_bash_special
+ 'no_bash_special' => \&validate_no_bash_special,
+ 'u32' => \&validate_u32,
+ 'bool' => \&validate_bool
);
sub validate_ipv4 {
@@ -79,6 +81,16 @@ sub validate_ipv4 {
return 1;
}
+sub validate_u32 {
+ my $val = shift;
+ return ($val =~ /^\d+$/ and $val < 2**32);
+}
+
+sub validate_bool {
+ my $val = shift;
+ return ($val eq 'true' or $val eq 'false');
+}
+
sub validate_ipv4net {
$_ = shift;
return 0 if (!/^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/);