diff --git a/db/NodeType.pm.in b/db/NodeType.pm.in index 4e3d32cfb5ded5244bd8217293ffbb3ff575a6f0..359777bf6f53b40c9c076c4c585b9f259664f068 100644 --- a/db/NodeType.pm.in +++ b/db/NodeType.pm.in @@ -99,6 +99,38 @@ sub LookupSync($$) return Lookup($class, $type); } +# +# Find me a type, or a class, or by auxtype. Just find me something! +# +sub LookupAny($$) +{ + my ($class, $type) = @_; + + my $obj = NodeType->Lookup($type); + return $obj + if (defined($obj)); + + my $query_result = + DBQueryWarn("select type from node_types where class='$type' limit 1"); + return undef + if (!$query_result); + if ($query_result->numrows) { + my ($ntype) = $query_result->fetchrow_array(); + return NodeType->Lookup($ntype); + } + + $query_result = + DBQueryWarn("select type from node_types_auxtypes ". + "where auxtype='$type' limit 1"); + return undef + if (!$query_result); + if ($query_result->numrows) { + my ($ntype) = $query_result->fetchrow_array(); + return NodeType->Lookup($ntype); + } + return undef; +} + # # Return a list of all types. # @@ -264,6 +296,7 @@ sub control_iface($;$) {return GetAttribute($_[0], "control_interface",$_[1]);} sub adminmfs_osid($;$) {return GetAttribute($_[0], "adminmfs_osid",$_[1]);} sub rebootable($;$) {return GetAttribute($_[0], "rebootable",$_[1]);} sub power_delay($;$) {return GetAttribute($_[0], "power_delay",$_[1]);} +sub shared($;$) {return GetAttribute($_[0], "shared",$_[1]);} sub initial_experiment($;$) { return GetAttribute($_[0], "initial_experiment",$_[1]); @@ -280,6 +313,9 @@ sub delay_capacity($;$) { sub trivlink_maxspeed($;$) { return GetAttribute($_[0], "trivlink_maxspeed", $_[1]); } +sub isdedicatedremote($;$) { + return GetAttribute($_[0], "dedicated_widearea", $_[1]); +} sub control_interface($;$) { return control_iface($_[0], $_[1]); } # _Always_ make sure that this 1 is at the end of the file...