/** * Add AUTHENTICATION string to XML node * *@param $p_sxml_node XML node to authenticate *@param $p_id Authenticate id *@return nothing **/ function addAuth($p_sxml_node, $p_id) { $pfConfigSecurity = new PluginFusioninventoryConfigSecurity(); if ($pfConfigSecurity->getFromDB($p_id)) { $sxml_authentication = $p_sxml_node->addChild('AUTHENTICATION'); $sxml_authentication->addAttribute('ID', $p_id); $sxml_authentication->addAttribute('VERSION', $pfConfigSecurity->getSNMPVersion($pfConfigSecurity->fields['snmpversion'])); if ($pfConfigSecurity->fields['snmpversion'] == '3') { $sxml_authentication->addAttribute('USERNAME', $pfConfigSecurity->fields['username']); if ($pfConfigSecurity->fields['authentication'] == '0') { // $sxml_authentication->addAttribute('AUTHPROTOCOL', ''); } else { $sxml_authentication->addAttribute('AUTHPROTOCOL', $pfConfigSecurity->getSNMPAuthProtocol($pfConfigSecurity->fields['authentication'])); } $sxml_authentication->addAttribute('AUTHPASSPHRASE', $pfConfigSecurity->fields['auth_passphrase']); if ($pfConfigSecurity->fields['encryption'] == '0') { // $sxml_authentication->addAttribute('PRIVPROTOCOL', ''); } else { $sxml_authentication->addAttribute('PRIVPROTOCOL', $pfConfigSecurity->getSNMPEncryption($pfConfigSecurity->fields['encryption'])); } $sxml_authentication->addAttribute('PRIVPASSPHRASE', $pfConfigSecurity->fields['priv_passphrase']); } else { $sxml_authentication->addAttribute('COMMUNITY', $pfConfigSecurity->fields['community']); } } }