/*-------------------------------------------------------------------------------------- * Purpose: Save the queue settings to the config file. * Input: none * Output: returns 0 on success, 1 on failure. * Dan Massey @ July 22, 2008 * -------------------------------------------------------------------------------------*/ int saveQueueSettings() { int err = 0; // save queue tag if ( openConfigElement(XML_QUEUE_TAG) ) { err = 1; log_warning("Failed to save queue to config file."); } // save pacing on threshold if ( setConfigValueAsFloat(XML_QUEUE_PACING_ON, QueueConfig.pacingOnThresh) ) { err = 1; log_warning("Failed to save queue's PacingOnThresh to config file."); } // save pacing off threshold if ( setConfigValueAsFloat(XML_QUEUE_PACING_OFF, QueueConfig.pacingOffThresh) ) { err = 1; log_warning("Failed to save queue's PacingOffThresh to config file."); } // save alpha if ( setConfigValueAsFloat(XML_QUEUE_ALPHA, QueueConfig.alpha) ) { err = 1; log_warning("Failed to save queue's alpha value to config file."); } // save min writes limit if ( setConfigValueAsInt(XML_QUEUE_MIN_WRITES_LIMIT, QueueConfig.minWritesPerInterval) ) { err = 1; log_warning("Failed to save queue's min writes limit per interval to config file."); } // save pacing Interval if ( setConfigValueAsInt(XML_QUEUE_PACING_INTERVAL, QueueConfig.pacingInterval) ) { err = 1; log_warning("Failed to save queue's pacing interval to config file."); } // save log Interval if ( setConfigValueAsInt(XML_QUEUE_LOG_INTERVAL, QueueConfig.logInterval) ) { err = 1; log_warning("Failed to save queue's log interval to config file."); } // save queue tag if ( closeConfigElement(XML_QUEUE_TAG) ) { err = 1; log_warning("Failed to save queue to config file."); } return err; };
/*-------------------------------------------------------------------------------------- * Purpose: Save the login control settings to the config file. * Input: none * Output: retuns 0 on success, 1 on failure * Kevin Burnett @ November 18, 2008 * -------------------------------------------------------------------------------------*/ int saveLoginControlSettings() { int err = 0; // save login tag if (openConfigElement(XML_LOGIN_TAG)) { err = 1; log_warning("failed to save Login to Config file: %s", strerror(errno)); } // save listen addr if (setConfigValueAsString(XML_LOGIN_ADDRESS_TAG, LoginSettings.listenAddr)) { err = 1; log_warning("failed to save Login Address to Config File: %s", strerror(errno)); } // save listen port if (setConfigValueAsInt(XML_LOGIN_PORT_TAG, LoginSettings.listenPort)) { err = 0; log_warning("failed to save Login Port to Config File: %s", strerror(errno)); } // save access password if (setConfigValueAsString(XML_LOGIN_ACCESS_PASSWORD_TAG, LoginSettings.accessPassword)) { err = 1; log_warning("failed to save Access Password to Config File: %s", strerror(errno)); } // save enable password if (setConfigValueAsString(XML_LOGIN_ENABLE_PASSWORD_TAG, LoginSettings.enablePassword)) { err = 1; log_warning("failed to save Enable Password to Config File: %s", strerror(errno)); } // make sure the acl exits then get the name to save char * cliName = NULL; if(LoginSettings.cliAcl!=NULL) cliName = LoginSettings.cliAcl->name; if (setConfigValueAsString(XML_LOGIN_CLI_ACL_TAG, cliName)) { err = 1; log_warning("failed to save ACL to Config File: %s", strerror(errno)); } // make sure the client update acl exists then get the name char * clientUpdateName = NULL; if(LoginSettings.clientUpdateAcl!=NULL) clientUpdateName = LoginSettings.clientUpdateAcl->name; if (setConfigValueAsString(XML_LOGIN_CLIENT_UPDATE_ACL_TAG, clientUpdateName)) { err = 1; log_warning("failed to save ACL to Config File: %s", strerror(errno)); } // make sure the client rib acl exists then get the name char * clientRIBName = NULL; if(LoginSettings.clientRIBAcl!=NULL) clientRIBName = LoginSettings.clientRIBAcl->name; if (setConfigValueAsString(XML_LOGIN_CLIENT_RIB_ACL_TAG, clientRIBName)) { err = 1; log_warning("failed to save ACL to Config File: %s", strerror(errno)); } // make sure the acl exits then get the name char * mrtName = NULL; if(LoginSettings.mrtAcl!=NULL) mrtName = LoginSettings.mrtAcl->name; if (setConfigValueAsString(XML_LOGIN_MRT_ACL_TAG, mrtName)) { err = 1; log_warning("failed to save ACL to Config File: %s", strerror(errno)); } // save closing login tag if(closeConfigElement()) { err = 1; log_warning("failed to save Login to Config file: %s", strerror(errno)); } return err; }
/*-------------------------------------------------------------------------------------- * Purpose: Save the chains settings to the config file. * Input: none * Output: returns 0 on success, 1 on failure * He Yan @ July 22, 2008 * -------------------------------------------------------------------------------------*/ int saveChainsSettings() { int err = 0; int i; // open the chains module if (openConfigElement(XML_CHAINS_LIST_TAG)) { err = 1; log_warning("Failed to save chains list tag to config file."); } for(i = 0; i < MAX_CHAIN_IDS; i++) { if( Chains[i] != NULL ) { // open a chain if (openConfigElement(XML_CHAIN_TAG)) { err = 1; log_warning("Failed to save chain tag to config file."); } // save addr if ( setConfigValueAsString(XML_CHAIN_ADDR, Chains[i]->addr) ) { err = 1; log_warning("Failed to save chain(%d) address to config file."); } // save port if ( setConfigValueAsInt(XML_U_CHAIN_PORT, Chains[i]->Uport) ) { err = 1; log_warning("Failed to save Update chain(%d) port to config file."); } if ( setConfigValueAsInt(XML_R_CHAIN_PORT, Chains[i]->Rport) ) { err = 1; log_warning("Failed to save RIB chain(%d) port to config file."); } // save enabled flag if ( setConfigValueAsInt(XML_CHAIN_ENABLED, Chains[i]->enabled) ) { err = 1; log_warning("Failed to save chain(%d) enaled flag to config file."); } // save retry interval if( setConfigValueAsInt(XML_CHAIN_RETRY_INTERVAL, Chains[i]->connectRetryInterval) ) { err = 1; log_warning("Failed to save chain(%d) connection retry interval to config file."); } // close the chain if (closeConfigElement(XML_CHAIN_TAG)) { err = 1; log_warning("Failed to save chain tag to config file."); } } } // close the chains module if (closeConfigElement(XML_CHAINS_LIST_TAG)) { err = 1; log_warning("Failed to save chains list tag to config file."); } return err; }