/** * @ignore * */ public function load_from_domxml(DOMElement $xml) { $this->xmlroot = $xml; $this->name = DH::findAttribute('name', $xml); if ($this->name === FALSE) { derr("address name not found\n"); } $this->_load_description_from_domxml(); //print "object named '".$this->name."' found\n"; $typeFound = false; foreach ($xml->childNodes as $node) { if ($node->nodeType != 1) { continue; } $lsearch = array_search($node->nodeName, self::$AddressTypes); if ($lsearch !== FALSE) { $typeFound = true; $this->type = $lsearch; $this->value = $node->textContent; } } if (!$typeFound) { derr('object type not found or not supported'); } if ($this->owner->owner->version >= 60) { $tagRoot = DH::findFirstElement('tag', $xml); if ($tagRoot !== false) { $this->tags->load_from_domxml($tagRoot); } } }
public function display_statistics() { print "Statistics for DG '" . PH::boldText($this->name) . "'\n"; print "- {$this->securityRules->countPreRules()} / {$this->securityRules->countPostRules()} pre/post SecRules\n"; print "- {$this->natRules->countPreRules()} / {$this->natRules->countPostRules()} pre/post NatRules\n"; print "- {$this->addressStore->countAddresses()} / {$this->addressStore->countAddressGroups()} / {$this->addressStore->countTmpAddresses()} address/group/tmp/total objects\n"; print "- {$this->serviceStore->countServices()} / {$this->serviceStore->countServiceGroups()} / {$this->serviceStore->countTmpServices()} service/group/tmp/total objects\n"; print "- {$this->tagStore->count()} tags. {$this->tagStore->countUnused()} unused\n"; }
public function display_statistics() { print "Statistics for VSYS '" . $this->name . "'\n"; print "- " . $this->securityRules->count() . " security rules\n"; print "- " . $this->natRules->count() . " nat rules\n"; print "- " . $this->decryptionRules->count() . " decryption rules\n"; print "- " . $this->addressStore->countAddresses() . " address objects\n"; print "- " . $this->addressStore->countAddressGroups() . " address groups\n"; print "- " . $this->serviceStore->countServices() . " service objects\n"; print "- " . $this->serviceStore->countServiceGroups() . " service groups\n"; print "- " . $this->addressStore->countTmpAddresses() . " temporary address objects\n"; print "- " . $this->serviceStore->countTmpServices() . " temporary service objects\n"; print "- " . $this->tagStore->count() . " tags. " . $this->tagStore->countUnused() . " unused\n"; print "- " . $this->zoneStore->count() . " zones.\n"; print "- " . $this->appStore->count() . " apps.\n"; }
/** * @ignore * */ public function load_from_domxml($xml) { $this->xmlroot = $xml; $this->name = DH::findAttribute('name', $xml); if ($this->name === FALSE) { derr("name not found\n"); } if ($this->owner->owner->version >= 60) { $tagRoot = DH::findFirstElement('tag', $this->xmlroot); if ($tagRoot !== false) { $this->tags->load_from_domxml($tagRoot); } $this->membersRoot = DH::findFirstElement('static', $xml); if ($this->membersRoot === false) { $this->isDynamic = true; } else { foreach ($this->membersRoot->childNodes as $node) { if ($node->nodeType != 1) { continue; } $memberName = $node->textContent; if (strlen($memberName) < 1) { derr('found a member with empty name !', $node); } $f = $this->owner->findOrCreate($memberName, $this, true); $this->members[] = $f; } } } else { foreach ($xml->childNodes as $node) { if ($node->nodeType != 1) { continue; } $memberName = $node->textContent; if (strlen($memberName) < 1) { derr('found a member with empty name !', $node); } $f = $this->owner->findOrCreate($memberName, $this, true); $this->members[] = $f; } } }
/** * @param DOMElement $xml * * should only be called from a Rule constructor * @ignore */ public function load_from_domxml($xml) { $this->xmlroot = $xml; $toBeCleaned = array(); foreach ($xml->childNodes as $node) { if ($node->nodeType != 1) { continue; } if (strlen($node->textContent) < 1) { mwarning('invalid (empty) tag name found in rule "' . $this->owner->toString() . '", IT WILL BE CLEANED', $node); $toBeCleaned[] = $node; } else { $f = $this->parentCentralStore->findOrCreate($node->textContent, $this); $this->o[] = $f; } } foreach ($toBeCleaned as $cleanMe) { $xml->removeChild($cleanMe); } }