/* * This function takes all its parameters from config file. */ SimConfig* sim_xml_config_new_config_from_node (SimXmlConfig *xmlconfig, xmlNodePtr node) { SimConfig *config; xmlNodePtr children; gboolean aux = FALSE; g_return_val_if_fail (SIM_IS_XML_CONFIG (xmlconfig), NULL); g_return_val_if_fail (node != NULL, NULL); if (strcmp ((gchar *) node->name, OBJECT_CONFIG)) { g_message ("Invalid config node %s", node->name); return NULL; } config = sim_config_new (); children = node->xmlChildrenNode; while (children) { if (!strcmp ((gchar *) children->name, OBJECT_LOG)) sim_xml_config_set_config_log (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_DATASOURCES)) sim_xml_config_set_config_datasources (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_DIRECTIVE)) sim_xml_config_set_config_directive (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_REPUTATION)) sim_xml_config_set_config_reputation (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_SERVER)) sim_xml_config_set_config_server (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_SMTP)) sim_xml_config_set_config_smtp (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_NOTIFIES)) sim_xml_config_set_config_notifies (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_FRAMEWORK)) sim_xml_config_set_config_framework (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_FORENSIC_STORAGE)) { sim_xml_config_set_config_forensic_storage (xmlconfig, config, children); aux = TRUE; } if (!strcmp ((gchar *) children->name, OBJECT_IDM)) { sim_xml_config_set_config_idm (xmlconfig, config, children); config->idm.activated = TRUE; } children = children->next; } if (aux) config->forensic_storage.sem_activated = TRUE; else config->forensic_storage.sem_activated = FALSE; return config; }
/* * This function takes all its parameters from config file. */ SimConfig* sim_xml_config_new_config_from_node (SimXmlConfig *xmlconfig, xmlNodePtr node) { SimConfig *config; SimAction *action; GNode *rule_root; xmlNodePtr children; g_return_val_if_fail (xmlconfig, NULL); g_return_val_if_fail (SIM_IS_XML_CONFIG (xmlconfig), NULL); g_return_val_if_fail (node != NULL, NULL); if (strcmp ((gchar *) node->name, OBJECT_CONFIG)) { g_message ("Invalid config node %s", node->name); return NULL; } config = sim_config_new (); children = node->xmlChildrenNode; while (children) { if (!strcmp ((gchar *) children->name, OBJECT_LOG)) sim_xml_config_set_config_log (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_DATASOURCES)) sim_xml_config_set_config_datasources (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_DIRECTIVE)) sim_xml_config_set_config_directive (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_SCHEDULER)) sim_xml_config_set_config_scheduler (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_SERVER)) sim_xml_config_set_config_server (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_SMTP)) sim_xml_config_set_config_smtp (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_NOTIFIES)) sim_xml_config_set_config_notifies (xmlconfig, config, children); //FIXME: This multilevel code is unstable and unmaintained, uncomment this at your own risk. //if (!strcmp ((gchar *) children->name, OBJECT_RSERVERS)) // sim_xml_config_set_config_rservers (xmlconfig, config, children); if (!strcmp ((gchar *) children->name, OBJECT_FRAMEWORK)) sim_xml_config_set_config_framework (xmlconfig, config, children); children = children->next; } return config; }