コード例 #1
0
 /**
  * @param DOMElement $xml
  */
 public function load_from_domxml($xml)
 {
     $this->xmlroot = $xml;
     $this->name = DH::findAttribute('name', $xml);
     if ($this->name === FALSE) {
         derr("virtual-router name not found\n");
     }
     $node = DH::findFirstElementOrCreate('interface', $xml);
     $this->attachedInterfaces->load_from_domxml($node);
     $node = DH::findXPath('/routing-table/ip/static-route/entry', $xml);
     if ($node !== false) {
         for ($i = 0; $i < $node->length; $i++) {
             $newRoute = new StaticRoute('***tmp**', $this);
             $newRoute->load_from_xml($node->item($i));
             $this->_staticRoutes[] = $newRoute;
         }
     }
 }
コード例 #2
0
 public function load_from_domxml(DOMElement $xml)
 {
     $this->xmlroot = $xml;
     $this->isTmp = false;
     $this->name = DH::findAttribute('name', $xml);
     if ($this->name === FALSE) {
         derr("zone name not found\n", $xml);
     }
     if (strlen($this->name) < 1) {
         derr("Zone name '" . $this->name . "' is not valid", $xml);
     }
     $networkNode = DH::findFirstElement('network', $xml);
     if ($networkNode === false) {
         return;
     }
     foreach ($networkNode->childNodes as $node) {
         if ($node->nodeType != XML_ELEMENT_NODE) {
             continue;
         }
         if ($node->tagName == 'layer3') {
             $this->_type = 'layer3';
             $this->attachedInterfaces->load_from_domxml($node);
         } else {
             if ($node->tagName == 'external') {
                 $this->_type = 'external';
                 foreach ($node->childNodes as $memberNode) {
                     if ($memberNode->nodeType != XML_ELEMENT_NODE) {
                         continue;
                     }
                     $this->externalVsys[$memberNode->textContent] = $memberNode->textContent;
                 }
                 $this->attachedInterfaces->load_from_domxml($node);
             }
         }
     }
 }
コード例 #3
0
 /**
  * !! Should not be used outside of a PANConf constructor. !!
  *
  */
 public function load_from_domxml($xml)
 {
     $this->xmlroot = $xml;
     // this VSYS has a name ?
     $this->name = DH::findAttribute('name', $xml);
     if ($this->name === FALSE) {
         derr("VirtualSystem name not found\n", $xml);
     }
     //print "VSYS '".$this->name."' found\n";
     // this VSYS has a display-name ?
     $displayNameNode = DH::findFirstElement('display-name', $xml);
     if ($displayNameNode !== FALSE) {
         $this->_alternativeName = $displayNameNode->textContent;
     }
     //
     // loading the imported objects list
     //
     $this->importroot = DH::findFirstElementOrCreate('import', $xml);
     $networkRoot = DH::findFirstElementOrCreate('network', $this->importroot);
     $tmp = DH::findFirstElementOrCreate('interface', $networkRoot);
     $this->importedInterfaces->load_from_domxml($tmp);
     //
     $this->rulebaseroot = DH::findFirstElementOrCreate('rulebase', $xml);
     if ($this->owner->owner === null) {
         //
         // Extract Tag objects
         //
         if ($this->owner->version >= 60) {
             $tmp = DH::findFirstElementOrCreate('tag', $xml);
             $this->tagStore->load_from_domxml($tmp);
         }
         // End of Tag objects extraction
         //
         // Extract address objects
         //
         $tmp = DH::findFirstElementOrCreate('address', $xml);
         $this->addressStore->load_addresses_from_domxml($tmp);
         //print "VSYS '".$this->name."' address objectsloaded\n" ;
         // End of address objects extraction
         //
         // Extract address groups in this DV
         //
         $tmp = DH::findFirstElementOrCreate('address-group', $xml);
         $this->addressStore->load_addressgroups_from_domxml($tmp);
         //print "VSYS '".$this->name."' address groups loaded\n" ;
         // End of address groups extraction
         //												//
         // Extract service objects in this VSYS			//
         //												//
         $tmp = DH::findFirstElementOrCreate('service', $xml);
         $this->serviceStore->load_services_from_domxml($tmp);
         //print "VSYS '".$this->name."' service objects\n" ;
         // End of <service> extraction
         //												//
         // Extract service groups in this VSYS			//
         //												//
         $tmp = DH::findFirstElementOrCreate('service-group', $xml);
         $this->serviceStore->load_servicegroups_from_domxml($tmp);
         //print "VSYS '".$this->name."' service groups loaded\n" ;
         // End of <service-group> extraction
     }
     //
     // Extract Zone objects
     //
     $tmp = DH::findFirstElementOrCreate('zone', $xml);
     $this->zoneStore->load_from_domxml($tmp);
     // End of Zone objects extraction
     if ($this->owner->owner === null) {
         //
         // Security Rules extraction
         //
         $tmproot = DH::findFirstElementOrCreate('security', $this->rulebaseroot);
         $tmprulesroot = DH::findFirstElementOrCreate('rules', $tmproot);
         $this->securityRules->load_from_domxml($tmprulesroot);
         //
         // Nat Rules extraction
         //
         $tmproot = DH::findFirstElementOrCreate('nat', $this->rulebaseroot);
         $tmprulesroot = DH::findFirstElementOrCreate('rules', $tmproot);
         $this->natRules->load_from_domxml($tmprulesroot);
         //
         // Decryption Rules extraction
         //
         $tmproot = DH::findFirstElementOrCreate('decryption', $this->rulebaseroot);
         $tmprulesroot = DH::findFirstElementOrCreate('rules', $tmproot);
         $this->decryptionRules->load_from_domxml($tmprulesroot);
         //
         // Decryption Rules extraction
         //
         $tmproot = DH::findFirstElementOrCreate('application-override', $this->rulebaseroot);
         $tmprulesroot = DH::findFirstElementOrCreate('rules', $tmproot);
         $this->appOverrideRules->load_from_domxml($tmprulesroot);
     }
 }