public function load_from_domxml($xml) { $this->xmlroot = $xml; $this->name = DH::findAttribute('name', $xml); if ($this->name === FALSE) { derr("name not found\n"); } // // // Begin of <disabled> extraction // // // $this->extract_disabled_from_domxml(); // End of <disabled> properties extraction // // // // Begin of <description> extraction // // // $this->extract_description_from_domxml(); // End of <description> extraction // $this->load_source(); $this->load_destination(); $this->load_tags(); $this->load_from(); $this->load_to(); // // Begin <negate-source> extraction // $negatedSourceRoot = DH::findFirstElement('negate-source', $xml); if ($negatedSourceRoot !== false) { $this->negatedSource = yesNoBool($negatedSourceRoot->textContent); } else { $this->negatedSource = false; } // End of <negate-source> // // Begin <negate-destination> extraction // $negatedDestinationRoot = DH::findFirstElement('negate-destination', $xml); if ($negatedDestinationRoot !== false) { $this->negatedDestination = yesNoBool($negatedDestinationRoot->textContent); } else { $this->negatedDestination = false; } // End of <negate-destination> // <protocol> extraction // $protocolRoot = DH::findFirstElementOrCreate('protocol', $xml, 'tcp'); $this->_protocol = $protocolRoot->textContent; // // <port> extraction // $portRoot = DH::findFirstElementOrCreate('port', $xml); $this->_port = $protocolRoot->textContent; // }
public function load_from_domxml($xml) { $this->xmlroot = $xml; $this->name = DH::findAttribute('name', $xml); if ($this->name === FALSE) { derr("name not found\n"); } //print "found rule name '".$this->name."'\n"; // // // Begin of <disabled> extraction // // // $this->extract_disabled_from_domxml(); // End of <disabled> properties extraction // // // // Begin of <description> extraction // // // $this->extract_description_from_domxml(); // End of <description> extraction // $this->load_source(); $this->load_destination(); $this->load_tags(); $this->load_from(); $this->load_to(); // // // Begin <application> application extraction // // // $tmp = DH::findFirstElementOrCreate('application', $xml); $this->apps->load_from_domxml($tmp); // end of <application> application extraction // // // Begin <service> extraction // // // $tmp = DH::findFirstElementOrCreate('service', $xml); $this->services->load_from_domxml($tmp); // end of <service> zone extraction // // Begin <log-setting> extraction // $tmp = $this->logstartroot = DH::findFirstElement('log-setting', $xml); if ($tmp === false) { $this->logSetting = false; } else { $this->logSetting = $tmp->textContent; } // End of <log-setting> // // Begin <log-start> extraction // $this->logstartroot = DH::findFirstElementOrCreate('log-start', $xml, 'no'); $this->logstart = yesNoBool($this->logstartroot->textContent); // End of <log-start> // // Begin <log-end> extraction // $this->logendroot = DH::findFirstElementOrCreate('log-end', $xml, 'yes'); $this->logend = yesNoBool($this->logendroot->textContent); // End of <log-start> // // Begin <profile-setting> extraction // $this->secprofroot = DH::findFirstElement('profile-setting', $xml); if ($this->secprofroot === false) { $this->secprofroot = null; } $this->extract_security_profile_from_domxml(); // End of <profile-setting> // // Begin <negate-source> extraction // $negatedSourceRoot = DH::findFirstElement('negate-source', $xml); if ($negatedSourceRoot !== false) { $this->negatedSource = yesNoBool($negatedSourceRoot->textContent); } else { $this->negatedSource = false; } // End of <negate-source> // // Begin <negate-destination> extraction // $negatedDestinationRoot = DH::findFirstElement('negate-destination', $xml); if ($negatedDestinationRoot !== false) { $this->negatedDestination = yesNoBool($negatedDestinationRoot->textContent); } else { $this->negatedDestination = false; } // End of <negate-destination> // // Begin <action> extraction // $tmp = DH::findFirstElement('action', $xml); if ($tmp !== false) { $actionFound = array_search($tmp->textContent, self::$RuleActions); if ($actionFound === false) { mwarning("unsupported action '{$tmp->textContent}' found, allow assumed", $tmp); } else { $this->action = $actionFound; } } else { mwarning("'<action> not found, assuming 'allow'", $xml); } // End of <rule-type> // // Begin <rule-type> extraction // if ($this->owner->version >= 61) { $tmp = DH::findFirstElement('rule-type', $xml); if ($tmp !== false) { $typefound = array_search($tmp->textContent, self::$RuleTypes); if ($typefound === false) { mwarning("unsupported rule-type '{$tmp->textContent}', universal assumed", $tmp); } else { $this->ruleType = $typefound; } } } // End of <rule-type> }