public function rewriteSNAT_XML() { if ($this->snattype == 'none') { $this->xmlroot->removeChild($this->snatroot); $this->snatroot = null; return; } if (!isset($this->snatroot) || is_null($this->snatroot)) { $this->snatroot = array('name' => 'source-translation', 'children' => array()); $this->xmlroot['children'][] =& $this->snatroot; } else { $this->snatroot['children'] = array(); } if ($this->snattype == 'dynamic-ip-and-port') { $subroot = array('name' => 'dynamic-ip-and-port'); $this->snatroot['children'][] =& $subroot; if (is_null($this->snatinterface)) { $subsubroot = array('name' => 'translated-address2', 'children' => array()); $subroot['children'] = array(0 => &$subsubroot); $this->snathosts->xmlroot =& $subsubroot; $this->snathosts->rewriteXML(); } else { $subsubroot = array('name' => 'interface-address', 'children' => array()); $subroot['children'] = array(0 => &$subsubroot); $subsubroot['children'][] = array('name' => 'interface', 'content' => $this->snatinterface); if (count($this->snathosts) > 0) { $tmpA = array(); Hosts_to_xmlA($tmpA, $this->snathosts, 'ip'); $tmpAk = array_keys($tmpA); $subsubroot['children'][] =& $tmpA[$tmpAk[0]]; } } } else { if ($this->snattype == 'static-ip') { $subroot = array('name' => 'static-ip', 'children' => array()); $this->snatroot['children'][] =& $subroot; $tmpA = array(); Hosts_to_xmlA($tmpA, $this->snathosts, 'translated-address'); //print_r($tmpA); $tmpAk = array_keys($tmpA); $subroot['children'][] = $tmpA[$tmpAk[0]]; $subroot['children'][] = array('name' => 'bi-directional', 'content' => $this->snatbidir); //print_r($this->snathosts); } else { derr("NAT type not supported for rule '" . $this->NAT . "'\n"); } } //print_r($this->snatroot); }