Changeset 523 for trunk/cgi-bin/IPDB.pm
- Timestamp:
- 10/19/12 17:32:12 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r519 r523 25 25 %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist @masterblocks 26 26 %allocated %free %routed %bigfree %IPDBacl %aclmsg 27 &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &addMaster 28 &deleteBlock &getBlockData 27 &initIPDBGlobals &connectDB &finish &checkDBSanity 28 &addMaster 29 &listSummary &listMaster &listRBlock 30 &allocateBlock &deleteBlock &getBlockData 29 31 &getNodeList 30 32 &mailNotify … … 35 37 %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist 36 38 @masterblocks %allocated %free %routed %bigfree %IPDBacl %aclmsg 37 &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock 38 &addMaster &deleteBlock &getBlockData 39 &initIPDBGlobals &connectDB &finish &checkDBSanity 40 &addMaster 41 &listSummary &listMaster &listRBlock 42 &allocateBlock &deleteBlock &getBlockData 39 43 &getNodeList 40 44 &mailNotify … … 311 315 } 312 316 } # end addMaster 317 318 319 ## IPDB::listSummary() 320 # Get summary list of all master blocks 321 # Returns an arrayref to a list of hashrefs containing the master block, routed count, 322 # allocated count, free count, and largest free block masklength 323 sub listSummary { 324 my $dbh = shift; 325 326 my $mlist = $dbh->selectall_arrayref("SELECT cidr AS master FROM masterblocks ORDER BY cidr", { Slice => {} }); 327 328 foreach (@{$mlist}) { 329 my ($rcnt) = $dbh->selectrow_array("SELECT count(*) FROM routed WHERE cidr <<= ?", undef, ($$_{master})); 330 $$_{routed} = $rcnt; 331 my ($acnt) = $dbh->selectrow_array("SELECT count(*) FROM allocations WHERE cidr <<= ?", undef, ($$_{master})); 332 $$_{allocated} = $acnt; 333 my ($fcnt) = $dbh->selectrow_array("SELECT count(*) FROM freeblocks WHERE cidr <<= ?". 334 " AND (routed='y' OR routed='n')", undef, ($$_{master})); 335 $$_{free} = $fcnt; 336 my ($bigfree) = $dbh->selectrow_array("SELECT maskbits FROM freeblocks WHERE cidr <<= ?". 337 " AND (routed='y' OR routed='n') ORDER BY maskbits LIMIT 1", undef, ($$_{master})); 338 ##fixme: should find a way to do this without having to HTMLize the <> 339 $bigfree = "/$bigfree" if $bigfree; 340 $bigfree = '<NONE>' if !$bigfree; 341 $$_{bigfree} = $bigfree; 342 } 343 return $mlist; 344 } # end listSummary() 345 346 347 # &listMaster &listRBlock 313 348 314 349
Note:
See TracChangeset
for help on using the changeset viewer.