You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2010/05/05 20:35:53 UTC
svn commit: r941419 [1/4] - in /trafficserver/traffic/trunk: proxy/logging/
proxy/mgmt2/ proxy/mgmt2/api2/ proxy/mgmt2/api2/include/
proxy/mgmt2/cluster/ proxy/mgmt2/tools/ proxy/mgmt2/utils/
proxy/mgmt2/web2/ test/SDKtest/synth_server/ test/plugin/INK...
Author: bcall
Date: Wed May 5 18:35:52 2010
New Revision: 941419
URL: http://svn.apache.org/viewvc?rev=941419&view=rev
Log:
TS-180 Removed #ifdef OEM code
Modified:
trafficserver/traffic/trunk/proxy/logging/LogFile.cc
trafficserver/traffic/trunk/proxy/mgmt2/AddConfigFilesHere.cc
trafficserver/traffic/trunk/proxy/mgmt2/Main.cc
trafficserver/traffic/trunk/proxy/mgmt2/Rollback.cc
trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.cc
trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.h
trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.cc
trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.h
trafficserver/traffic/trunk/proxy/mgmt2/api2/CoreAPI.cc
trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.cc
trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.h
trafficserver/traffic/trunk/proxy/mgmt2/api2/INKMgmtAPI.cc
trafficserver/traffic/trunk/proxy/mgmt2/api2/include/INKMgmtAPI.h
trafficserver/traffic/trunk/proxy/mgmt2/cluster/ClusterCom.cc
trafficserver/traffic/trunk/proxy/mgmt2/tools/NetConfig.cc
trafficserver/traffic/trunk/proxy/mgmt2/utils/WebMgmtUtils.cc
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttp.cc
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttpAuth.cc
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttpAuth.h
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttpMessage.cc
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttpMessage.h
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttpRender.cc
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttpRender.h
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttpSession.cc
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttpSession.h
trafficserver/traffic/trunk/test/SDKtest/synth_server/synth_server.c
trafficserver/traffic/trunk/test/plugin/INKHttpHooksTrans/INKHttpReenableStop.c
Modified: trafficserver/traffic/trunk/proxy/logging/LogFile.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogFile.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogFile.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogFile.cc Wed May 5 18:35:52 2010
@@ -462,99 +462,6 @@ LogFile::roll(long interval_start, long
Status("The logfile %s was rolled to %s.", m_name, roll_name);
-#ifdef OEM //check if we want the rolled log file be ftped
- FILE *f;
- char config_dir[512], file_name[512], buf[1024];
- char ftp_server_name[512], ftp_login[512], ftp_password[512], ftp_remote_dir[512];
- bool found;
-
-/*
-#ifdef MODULARIZED
- ink_assert(RecGetRecordString_Xmalloc("proxy.config.config_dir", &config_dir)== REC_ERR_OKAY);
-#else
- varStrFromName("proxy.config.config_dir", config_dir, 512);
- ink_assert(found);
-#endif
-*/
- sprintf(file_name, "%s%s%s%s%s", "../etc/trafficserver", DIR_SEP, "internal", DIR_SEP, "ftp_logging.config");
-
- if (access(file_name, F_OK) != 0)
- return 1;
- f = fopen(file_name, "r");
- if (f == NULL) {
- return 1;
- }
-
- fgets(buf, 1024, f);
- sscanf(buf, "%s\n", ftp_server_name);
- fgets(buf, 1024, f);
- sscanf(buf, "%s\n", ftp_login);
- fgets(buf, 1024, f);
- sscanf(buf, "%s\n", ftp_password);
- fgets(buf, 1024, f);
- sscanf(buf, "%s\n", ftp_remote_dir);
-
- char script_path[512];
- sprintf(script_path, "%s/configure/helper/INKMgmtAPIFtp.tcl", "../ui");
- char *args[] = {
- script_path,
- "put",
- ftp_server_name,
- ftp_login,
- ftp_password,
- roll_name,
- ftp_remote_dir,
- NULL
- };
-
- int status = 0;
- char buffer[1024];
- int nbytes;
- int stdoutPipe[2];
- pid_t pid;
- char output_buf[4096];
- int output_size = 4096;
- int count = 0;
- pipe(stdoutPipe);
-
- pid = fork();
- if (pid == 0) { // child process
- dup2(stdoutPipe[1], STDOUT_FILENO);
- close(stdoutPipe[0]);
-
- pid = execv(args[0], &args[0]);
- if (pid == -1) {
- fprintf(stderr, "[ftpProcessSpawn] unable to execv [%s,%s...]\n", args[0], args[1]);
- }
- _exit(1);
- } else if (pid == -1) { // failed to create child process
- fprintf(stderr, "[ftpProcessSpawn] unable to fork [%d '%s']\n", errno, strerror(errno));
- status = 1;
- } else { // parent process
- close(stdoutPipe[1]);
- /* read the output from child script process */
- while (nbytes = read(stdoutPipe[0], buffer, 1024)) {
- if ((count + nbytes) < output_size) {
- strncpy(&output_buf[count], buffer, nbytes);
- count += nbytes;
- } else {
- break;
- }
- }
- close(stdoutPipe[0]);
-
- waitpid(pid, &status, 0);
- if (!strncmp(output_buf, "ERROR:", 6)) {
- for (int i = 0; i < strlen(output_buf); i++) {
- if (output_buf[i] == '\n') {
- output_buf[i] = ' ';
- }
- }
- LogUtils::manager_alarm(LogUtils::LOG_ALARM_ERROR, "Ftp log files, %s", output_buf);
- }
- }
-
-#endif //OEM
return 1;
}
Modified: trafficserver/traffic/trunk/proxy/mgmt2/AddConfigFilesHere.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/AddConfigFilesHere.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/AddConfigFilesHere.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/AddConfigFilesHere.cc Wed May 5 18:35:52 2010
@@ -43,27 +43,6 @@ testcall(char *foo)
Debug("lm", "Received Callback that %s has changed\n", foo);
}
-#if defined(OEM)
-
-bool
-pluginInstalled()
-{
- Rollback *file_rb;
- version_t ver;
- textBuffer *file_content = NULL;
- bool retval = false;
- if (configFiles->getRollbackObj("plugin.config", &file_rb)) {
- ver = file_rb->getCurrentVersion();
- file_rb->getVersion(ver, &file_content);
- if (strstr(file_content->bufPtr(), "vscan.so") != NULL)
- retval = true;
- }
- if (file_content)
- delete file_content;
- return retval;
-}
-
-#endif
//
// initializeRegistry()
@@ -118,14 +97,5 @@ initializeRegistry()
configFiles->addFile("splitdns.config", false);
configFiles->addFile("ssl_multicert.config", false);
configFiles->addFile("stats.config.xml", false);
-#if defined(OEM)
- configFiles->addFile("net.config.xml", true);
- /* only if the vscan plugin is installed would this file be read */
- if (pluginInstalled()) {
- configFiles->addFile("plugins/vscan.config", false);
- configFiles->addFile("plugins/trusted-host.config", false);
- configFiles->addFile("plugins/extensions.config", false);
- }
-#endif
configFiles->registerCallback(testcall);
}
Modified: trafficserver/traffic/trunk/proxy/mgmt2/Main.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/Main.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/Main.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/Main.cc Wed May 5 18:35:52 2010
@@ -73,10 +73,6 @@
#include "P_RecCore.h"
-#if defined(OEM)
-#include "tools/ConfigAPI.h"
-#include "tools/SysAPI.h"
-#endif
#define FD_THROTTLE_HEADROOM (128 + 64) // TODO: consolidate with THROTTLE_FD_HEADROOM
@@ -1437,16 +1433,6 @@ fileUpdated(char *fname)
mgmt_log(stderr, "[fileUpdated] stats.config.xml file has been modified\n");
} else if (strcmp(fname, "congestion.config") == 0) {
lmgmt->signalFileChange("proxy.config.http.congestion_control.filename");
-#if defined(OEM)
- } else if (strcmp(fname, "net.config.xml") == 0) {
- mgmt_log(stderr, "[fileUpdated] net.config.xml file has been modified\n");
- } else if (strcmp(fname, "plugins/vscan.config") == 0) {
- mgmt_log(stderr, "[fileUpdated] plugins/vscan.config file has been modified\n");
- } else if (strcmp(fname, "plugins/trusted-host.config") == 0) {
- mgmt_log(stderr, "[fileUpdated] plugins/trusted-host.config file has been modified\n");
- } else if (strcmp(fname, "plugins/extensions.config") == 0) {
- mgmt_log(stderr, "[fileUpdated] plugins/extensions.config file has been modified\n");
-#endif
} else {
mgmt_elog(stderr, "[fileUpdated] Unknown config file updated '%s'\n", fname);
Modified: trafficserver/traffic/trunk/proxy/mgmt2/Rollback.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/Rollback.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/Rollback.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/Rollback.cc Wed May 5 18:35:52 2010
@@ -108,26 +108,6 @@ root_access_needed(root_access_needed_)
configDir = new char[configDirLen];
ink_snprintf(configDir, configDirLen, "%s%s", configTmp, DIR_SEP);
-#ifdef OEM
- // since these plugin files are not in the config directory,
- // need to reset the config dir and filename
- if (strcmp(fileName, "plugins/vscan.config") == 0 ||
- strcmp(fileName, "plugins/trusted-host.config") == 0 || strcmp(fileName, "plugins/extensions.config") == 0) {
- Tokenizer fileTokens("/");
- if (fileTokens.Initialize(fileName) != 2) {
- mgmt_log(stderr, "[Rollback::Rollback] Error initializing Rollback for %s", baseFileName);
- } else {
- delete[]configDir;
- configDir = new char[strlen(configTmp) + strlen(fileTokens[0]) + 5];
- ink_sprintf(configDir, ".%s%s%s%s%s", DIR_SEP, configTmp, DIR_SEP, fileTokens[0], DIR_SEP);
-
- delete[]fileName;
- fileNameLen = strlen(fileTokens[1]);
- fileName = new char[fileNameLen + 1];
- strcpy(fileName, fileTokens[1]);
- }
- }
-#endif
ink_mutex_init(&fileAccessLock, "RollBack Mutex");
Modified: trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.cc Wed May 5 18:35:52 2010
@@ -33,9 +33,6 @@
#include "CfgContextImpl.h"
#include "CfgContextUtils.h"
#include "INKMgmtAPI.h"
-#if defined(OEM)
-#include "CoreAPI.h"
-#endif
//--------------------------------------------------------------------------
// Defines
@@ -3310,378 +3307,6 @@ VirtIpAddrObj::getCfgEleCopy()
return (INKCfgEle *) copy_virt_ip_addr_ele(m_ele);
}
-#if defined(OEM)
-//--------------------------------------------------------------------------
-// RmServerObj
-//--------------------------------------------------------------------------
-RmServerObj::RmServerObj(INKRmServerEle * ele)
-{
- m_ele = ele;
- m_valid = true;
- m_valid = isValid(); // now validate
-}
-
-RmServerObj::RmServerObj(TokenList * tokens)
-{
- INKCfgEle cfg_ele;
- Token *token;
-
- m_ele = (INKRmServerEle *) INKRmServerEleCreate(INK_TYPE_UNDEFINED);
- m_ele->cfg_ele.error = INK_ERR_OKAY;
- m_valid = true;
-
- if (!tokens || tokens->length != 1) {
- goto FORMAT_ERR;
- }
-
- m_ele->cfg_ele.type = get_rule_type(tokens, INK_FNAME_RMSERVER);
- if (m_ele->cfg_ele.type == INK_TYPE_UNDEFINED) {
- goto FORMAT_ERR;
- }
-
- token = tokens->first();
- if (!(strcmp(token->name, RM_ADMIN_PORT) &&
- strcmp(token->name, RM_PNA_PORT) &&
- strcmp(token->name, RM_MAX_PROXY_CONN) &&
- strcmp(token->name, RM_MAX_GWBW) && strcmp(token->name, RM_MAX_PXBW) && strcmp(token->name, RM_PNA_RDT_PORT))) {
- if (!token->value) {
- goto FORMAT_ERR;
- } else {
- m_ele->Vname = xstrdup(token->name);
- m_ele->int_val = ink_atoi(token->value);
- goto FORMAT_RIGHT;
- }
- }
-
- if (!(strcmp(token->name, RM_REALM) && strcmp(token->name, RM_PNA_RDT_IP))) {
- if (!token->value) {
- goto FORMAT_ERR;
- } else {
- m_ele->Vname = xstrdup(token->name);
- m_ele->str_val = xstrdup(token->value);
- goto FORMAT_RIGHT;
- }
- }
-
-FORMAT_RIGHT:
- return;
-
-FORMAT_ERR:
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
- m_valid = false;
-
-}
-
-RmServerObj::~RmServerObj()
-{
- INKRmServerEleDestroy(m_ele);
-}
-
-char *
-RmServerObj::formatEleToRule()
-{
- // validate the rule first
- if (!isValid()) {
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
- return NULL;
- }
-
- char buf[MAX_RULE_SIZE];
- memset(buf, 0, MAX_RULE_SIZE);
-
- if (!(strcmp(m_ele->Vname, RM_ADMIN_PORT) &&
- strcmp(m_ele->Vname, RM_PNA_PORT) &&
- strcmp(m_ele->Vname, RM_MAX_PROXY_CONN) &&
- strcmp(m_ele->Vname, RM_MAX_GWBW) &&
- strcmp(m_ele->Vname, RM_MAX_PXBW) && strcmp(m_ele->Vname, RM_PNA_RDT_PORT))) {
- snprintf(buf, sizeof(buf), "%s=\"%d\"", m_ele->Vname, m_ele->int_val);
- goto Done;
- }
-
- if (!(strcmp(m_ele->Vname, RM_REALM) && strcmp(m_ele->Vname, RM_PNA_RDT_IP))) {
- snprintf(buf, sizeof(buf), "%s=\"%s\"", m_ele->Vname, m_ele->str_val);
- goto Done;
- }
-Done:
- return xstrdup(buf);
-}
-
-bool RmServerObj::isValid()
-{
- if (m_ele->cfg_ele.error != INK_ERR_OKAY) {
- m_valid = false;
- }
-
- if (!strcmp(m_ele->Vname, RM_PNA_RDT_IP) && !ccu_checkIpAddr(m_ele->str_val)) {
- //check valid IP
-
- m_valid = false;
- } else if (!strcmp(m_ele->Vname, RM_REALM)) {
- //check valid hostname, not done yet.
- } else if (!(strcmp(m_ele->Vname, RM_ADMIN_PORT) &&
- strcmp(m_ele->Vname, RM_PNA_PORT) &&
- strcmp(m_ele->Vname, RM_PNA_RDT_PORT)) && !ccu_checkPortNum(m_ele->int_val)) {
- //check valid port number
- m_valid = false;
- } else if (!(strcmp(m_ele->Vname, RM_MAX_PROXY_CONN) &&
- strcmp(m_ele->Vname, RM_MAX_GWBW) && strcmp(m_ele->Vname, RM_MAX_PXBW)) && (m_ele->int_val < 0)) {
- m_valid = false;
- }
- if (!m_valid)
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
-
- return m_valid;
-}
-
-INKCfgEle *
-RmServerObj::getCfgEleCopy()
-{
- return (INKCfgEle *) copy_rmserver_ele(m_ele);
-}
-
-//--------------------------------------------------------------------------
-// VscanObj
-//--------------------------------------------------------------------------
-VscanObj::VscanObj(INKVscanEle * ele)
-{
- m_ele = ele;
- m_valid = true;
- m_valid = isValid(); // now validate
-}
-
-// must have at least 1 token (token->name = attr_name, token->val = attr_val)
-VscanObj::VscanObj(TokenList * tokens)
-{
- Token *tok;
-
- m_ele = INKVscanEleCreate();
- m_ele->cfg_ele.error = INK_ERR_OKAY;
- m_valid = true;
-
- if (!tokens || (tokens->length != 1)) {
- goto FORMAT_ERR;
- }
-
- m_ele->cfg_ele.type = get_rule_type(tokens, INK_FNAME_VSCAN);
- if (m_ele->cfg_ele.type == INK_TYPE_UNDEFINED) {
- goto FORMAT_ERR;
- }
- // check first token; must exist
- tok = tokens->first();
- if (!tok->name) {
- goto FORMAT_ERR; // no attribute name
- } else {
- m_ele->attr_name = xstrdup(tok->name);
- }
-
- if (tok->value)
- m_ele->attr_val = xstrdup(tok->value);
-
- return;
-
-FORMAT_ERR:
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
- m_valid = false;
-}
-
-VscanObj::~VscanObj()
-{
- INKVscanEleDestroy(m_ele);
-}
-
-char *
-VscanObj::formatEleToRule()
-{
- if (!isValid()) {
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
- return NULL;
- }
- char buf[MAX_RULE_SIZE];
- memset(buf, 0, MAX_RULE_SIZE);
- snprintf(buf, sizeof(buf), "%s=%s", m_ele->attr_name, m_ele->attr_val);
- return xstrdup(buf);
-}
-
-bool VscanObj::isValid()
-{
- if (m_ele->cfg_ele.error != INK_ERR_OKAY) {
- m_valid = false;
- }
-
- if (!(m_ele->attr_name) || !(m_ele->attr_val))
- m_valid = false;
-
- if (!m_valid)
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
-
- return m_valid;
-}
-
-INKCfgEle *
-VscanObj::getCfgEleCopy()
-{
- return (INKCfgEle *) copy_vscan_ele(m_ele);
-}
-
-//--------------------------------------------------------------------------
-// VsTrustedHostObj
-//--------------------------------------------------------------------------
-VsTrustedHostObj::VsTrustedHostObj(INKVsTrustedHostEle * ele)
-{
- m_ele = ele;
- m_valid = true;
- m_valid = isValid(); // now validate
-}
-
-// must have 1 token name (token->name = host_name)
-VsTrustedHostObj::VsTrustedHostObj(TokenList * tokens)
-{
- Token *tok;
-
- m_ele = INKVsTrustedHostEleCreate();
- m_ele->cfg_ele.error = INK_ERR_OKAY;
- m_valid = true;
-
- if (!tokens || (tokens->length != 1)) {
- goto FORMAT_ERR;
- }
-
- m_ele->cfg_ele.type = get_rule_type(tokens, INK_FNAME_VS_TRUSTED_HOST);
- if (m_ele->cfg_ele.type == INK_TYPE_UNDEFINED) {
- goto FORMAT_ERR;
- }
- // check first token; must exist
- tok = tokens->first();
- if (!tok->name) {
- goto FORMAT_ERR; // no attribute name
- } else {
- m_ele->hostname = xstrdup(tok->name);
- }
- return;
-
-FORMAT_ERR:
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
- m_valid = false;
-}
-
-VsTrustedHostObj::~VsTrustedHostObj()
-{
- INKVsTrustedHostEleDestroy(m_ele);
-}
-
-char *
-VsTrustedHostObj::formatEleToRule()
-{
- if (!isValid()) {
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
- return NULL;
- }
- char buf[MAX_RULE_SIZE];
- memset(buf, 0, MAX_RULE_SIZE);
- snprintf(buf, sizeof(buf), "%s", m_ele->hostname);
- return xstrdup(buf);
-}
-
-bool VsTrustedHostObj::isValid()
-{
- if (m_ele->cfg_ele.error != INK_ERR_OKAY) {
- m_valid = false;
- }
-
- if (!(m_ele->hostname))
- m_valid = false;
-
- if (!m_valid)
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
-
- return m_valid;
-}
-
-INKCfgEle *
-VsTrustedHostObj::getCfgEleCopy()
-{
- return (INKCfgEle *) copy_vs_trusted_host_ele(m_ele);
-}
-
-
-//--------------------------------------------------------------------------
-// VsExtensionObj
-//--------------------------------------------------------------------------
-VsExtensionObj::VsExtensionObj(INKVsExtensionEle * ele)
-{
- m_ele = ele;
- m_valid = true;
- m_valid = isValid(); // now validate
-}
-
-// must have 1 token name (token->name = file_ext)
-VsExtensionObj::VsExtensionObj(TokenList * tokens)
-{
- Token *tok;
-
- m_ele = INKVsExtensionEleCreate();
- m_ele->cfg_ele.error = INK_ERR_OKAY;
- m_valid = true;
-
- if (!tokens || (tokens->length != 1)) {
- goto FORMAT_ERR;
- }
-
- m_ele->cfg_ele.type = get_rule_type(tokens, INK_FNAME_VS_EXTENSION);
- if (m_ele->cfg_ele.type == INK_TYPE_UNDEFINED) {
- goto FORMAT_ERR;
- }
- // check first token; must exist
- tok = tokens->first();
- if (!tok->name) {
- goto FORMAT_ERR; // no attribute name
- } else {
- m_ele->file_ext = xstrdup(tok->name);
- }
- return;
-
-FORMAT_ERR:
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
- m_valid = false;
-}
-
-VsExtensionObj::~VsExtensionObj()
-{
- INKVsExtensionEleDestroy(m_ele);
-}
-
-char *
-VsExtensionObj::formatEleToRule()
-{
- if (!isValid()) {
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
- return NULL;
- }
- char buf[MAX_RULE_SIZE];
- memset(buf, 0, MAX_RULE_SIZE);
- snprintf(buf, sizeof(buf), "%s", m_ele->file_ext);
- return xstrdup(buf);
-}
-
-bool VsExtensionObj::isValid()
-{
- if (m_ele->cfg_ele.error != INK_ERR_OKAY) {
- m_valid = false;
- }
- if (!(m_ele->file_ext))
- m_valid = false;
- if (!m_valid)
- m_ele->cfg_ele.error = INK_ERR_INVALID_CONFIG_RULE;
- return m_valid;
-}
-
-INKCfgEle *
-VsExtensionObj::getCfgEleCopy()
-{
- return (INKCfgEle *) copy_vs_extension_ele(m_ele);
-}
-
-#endif
/*****************************************************************
* CfgContext
Modified: trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.h?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.h (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextImpl.h Wed May 5 18:35:52 2010
@@ -608,104 +608,6 @@ private:
INKVirtIpAddrEle * m_ele;
};
-#ifdef OEM
-/* rmserver.cfg *******************************************/
-class RmServerObj:public CfgEleObj
-{
-public:
- RmServerObj(INKRmServerEle * ele);
- RmServerObj(TokenList * tokens);
- ~RmServerObj();
-
- virtual char *formatEleToRule();
- virtual bool isValid();
- virtual INKCfgEle *getCfgEleCopy();
- virtual INKCfgEle *getCfgEle()
- {
- return (INKCfgEle *) m_ele;
- }
- virtual INKRuleTypeT getRuleType()
- {
- return m_ele->cfg_ele.type;
- }
-
-private:
- INKRmServerEle * m_ele;
-};
-
-/* vscan.config *******************************************/
-class VscanObj:public CfgEleObj
-{
-public:
- VscanObj(INKVscanEle * ele);
- VscanObj(TokenList * tokens);
- ~VscanObj();
-
- virtual char *formatEleToRule();
- virtual bool isValid();
- virtual INKCfgEle *getCfgEleCopy();
- virtual INKCfgEle *getCfgEle()
- {
- return (INKCfgEle *) m_ele;
- }
- virtual INKRuleTypeT getRuleType()
- {
- return m_ele->cfg_ele.type;
- }
-
-private:
- INKVscanEle * m_ele;
-};
-
-/* trusted-host.config *******************************************/
-class VsTrustedHostObj:public CfgEleObj
-{
-public:
- VsTrustedHostObj(INKVsTrustedHostEle * ele);
- VsTrustedHostObj(TokenList * tokens);
- ~VsTrustedHostObj();
-
- virtual char *formatEleToRule();
- virtual bool isValid();
- virtual INKCfgEle *getCfgEleCopy();
- virtual INKCfgEle *getCfgEle()
- {
- return (INKCfgEle *) m_ele;
- }
- virtual INKRuleTypeT getRuleType()
- {
- return m_ele->cfg_ele.type;
- }
-
-private:
- INKVsTrustedHostEle * m_ele;
-};
-
-/* extensions.config *******************************************/
-class VsExtensionObj:public CfgEleObj
-{
-public:
- VsExtensionObj(INKVsExtensionEle * ele);
- VsExtensionObj(TokenList * tokens);
- ~VsExtensionObj();
-
- virtual char *formatEleToRule();
- virtual bool isValid();
- virtual INKCfgEle *getCfgEleCopy();
- virtual INKCfgEle *getCfgEle()
- {
- return (INKCfgEle *) m_ele;
- }
- virtual INKRuleTypeT getRuleType()
- {
- return m_ele->cfg_ele.type;
- }
-
-private:
- INKVsExtensionEle * m_ele;
-};
-
-#endif
/*****************************************************************
* CfgContext
Modified: trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.cc Wed May 5 18:35:52 2010
@@ -25,9 +25,6 @@
#include "ink_platform.h"
#include "CfgContextUtils.h"
#include "Tokenizer.h"
-#if defined(OEM)
-#include "CoreAPI.h"
-#endif
/***************************************************************************
* Conversion Functions
***************************************************************************/
@@ -1566,16 +1563,6 @@ filename_to_string(INKFileNameT file)
case INK_FNAME_VADDRS:
return xstrdup("vaddrs.config");
-#if defined(OEM)
- case INK_FNAME_RMSERVER:
- return xstrdup("rmserver.cfg");
- case INK_FNAME_VSCAN:
- return xstrdup("plugins/vscan.config");
- case INK_FNAME_VS_TRUSTED_HOST:
- return xstrdup("plugins/trusted-host.config");
- case INK_FNAME_VS_EXTENSION:
- return xstrdup("plugins/extensions.config");
-#endif
default: /* no such config file */
return NULL;
@@ -2125,27 +2112,6 @@ create_ele_obj_from_rule_node(Rule * rul
case INK_VADDRS: /* vaddrs.config */
ele = (CfgEleObj *) new VirtIpAddrObj(token_list);
break;
-#if defined(OEM)
- case INK_RM_ADMIN_PORT: /* rmserver.cfg */
- case INK_RM_PNA_PORT:
- case INK_RM_MAX_PROXY_CONN:
- case INK_RM_MAX_GWBW:
- case INK_RM_MAX_PXBW:
- case INK_RM_REALM:
- case INK_RM_PNA_RDT_PORT:
- case INK_RM_PNA_RDT_IP:
- ele = (CfgEleObj *) new RmServerObj(token_list);
- break;
- case INK_VSCAN:
- ele = (CfgEleObj *) new VscanObj(token_list);
- break;
- case INK_VS_TRUSTED_HOST:
- ele = (CfgEleObj *) new VsTrustedHostObj(token_list);
- break;
- case INK_VS_EXTENSION:
- ele = (CfgEleObj *) new VsExtensionObj(token_list);
- break;
-#endif
default:
return NULL; //invalid rule type
}
@@ -2264,26 +2230,6 @@ create_ele_obj_from_ele(INKCfgEle * ele)
case INK_VADDRS: /* vaddrs.config */
ele_obj = (CfgEleObj *) new VirtIpAddrObj((INKVirtIpAddrEle *) ele);
break;
-#if defined(OEM)
- case INK_RM_ADMIN_PORT: /* rmserver.cfg */
- case INK_RM_PNA_PORT:
- case INK_RM_MAX_PROXY_CONN:
- case INK_RM_MAX_GWBW:
- case INK_RM_REALM:
- case INK_RM_PNA_RDT_PORT:
- case INK_RM_PNA_RDT_IP:
- ele_obj = (CfgEleObj *) new RmServerObj((INKRmServerEle *) ele);
- break;
- case INK_VSCAN:
- ele_obj = (CfgEleObj *) new VscanObj((INKVscanEle *) ele);
- break;
- case INK_VS_TRUSTED_HOST:
- ele_obj = (CfgEleObj *) new VsTrustedHostObj((INKVsTrustedHostEle *) ele);
- break;
- case INK_VS_EXTENSION:
- ele_obj = (CfgEleObj *) new VsExtensionObj((INKVsExtensionEle *) ele);
- break;
-#endif
case INK_TYPE_UNDEFINED:
default:
return NULL; // error
@@ -2446,35 +2392,6 @@ get_rule_type(TokenList * token_list, IN
case INK_FNAME_VADDRS: /* vaddrs.config */
return INK_VADDRS;
-#if defined(OEM)
- case INK_FNAME_RMSERVER:
- tok = token_list->first();
- if (strcmp(tok->name, RM_ADMIN_PORT) == 0) {
- return INK_RM_ADMIN_PORT;
- } else if (strcmp(tok->name, RM_PNA_PORT) == 0) {
- return INK_RM_PNA_PORT;
- } else if (strcmp(tok->name, RM_REALM) == 0) {
- return INK_RM_REALM;
- } else if (strcmp(tok->name, RM_MAX_PROXY_CONN) == 0) {
- return INK_RM_MAX_PROXY_CONN;
- } else if (strcmp(tok->name, RM_MAX_GWBW) == 0) {
- return INK_RM_MAX_GWBW;
- } else if (strcmp(tok->name, RM_MAX_PXBW) == 0) {
- return INK_RM_MAX_PXBW;
- } else if (strcmp(tok->name, RM_PNA_RDT_PORT) == 0) {
- return INK_RM_PNA_RDT_PORT;
- } else if (strcmp(tok->name, RM_PNA_RDT_IP) == 0) {
- return INK_RM_PNA_RDT_IP;
- } else {
- return INK_TYPE_UNDEFINED;
- }
- case INK_FNAME_VSCAN: /* vscan.config */
- return INK_VSCAN;
- case INK_FNAME_VS_TRUSTED_HOST: /* trusted-host.config */
- return INK_VS_TRUSTED_HOST;
- case INK_FNAME_VS_EXTENSION: /* extensions.config */
- return INK_VS_EXTENSION;
-#endif
case INK_FNAME_UNDEFINED:
default:
return INK_TYPE_UNDEFINED;
@@ -3188,81 +3105,6 @@ copy_comment_ele(INKCommentEle * ele)
return nele;
}
-#if defined(OEM)
-INKRmServerEle *
-copy_rmserver_ele(INKRmServerEle * ele)
-{
- if (!ele)
- return NULL;
-
- INKRmServerEle *nele = INKRmServerEleCreate(INK_TYPE_UNDEFINED);
- if (!nele)
- return NULL;
-
- copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
- if (ele->Vname)
- nele->Vname = xstrdup(ele->Vname);
- if (ele->str_val)
- nele->str_val = xstrdup(ele->str_val);
- nele->int_val = ele->int_val;
-
- return nele;
-}
-
-INKVscanEle *
-copy_vscan_ele(INKVscanEle * ele)
-{
- if (!ele)
- return NULL;
-
- INKVscanEle *nele = INKVscanEleCreate();
- if (!nele)
- return NULL;
-
- copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
- if (ele->attr_name)
- nele->attr_name = xstrdup(ele->attr_name);
- if (ele->attr_val)
- nele->attr_val = xstrdup(ele->attr_val);
-
- return nele;
-}
-
-INKVsTrustedHostEle *
-copy_vs_trusted_host_ele(INKVsTrustedHostEle * ele)
-{
- if (!ele)
- return NULL;
-
- INKVsTrustedHostEle *nele = INKVsTrustedHostEleCreate();
- if (!nele)
- return NULL;
-
- copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
- if (ele->hostname)
- nele->hostname = xstrdup(ele->hostname);
-
- return nele;
-}
-
-INKVsExtensionEle *
-copy_vs_extension_ele(INKVsExtensionEle * ele)
-{
- if (!ele)
- return NULL;
-
- INKVsExtensionEle *nele = INKVsExtensionEleCreate();
- if (!nele)
- return NULL;
-
- copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
- if (ele->file_ext)
- nele->file_ext = xstrdup(ele->file_ext);
-
- return nele;
-}
-
-#endif
/***************************************************************************
* Functions needed by implementation but must be hidden from user
***************************************************************************/
Modified: trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.h?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.h (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/api2/CfgContextUtils.h Wed May 5 18:35:52 2010
@@ -199,12 +199,6 @@ INKStorageEle *copy_storage_ele(INKStora
INKUpdateEle *copy_update_ele(INKUpdateEle * ele);
INKVirtIpAddrEle *copy_virt_ip_addr_ele(INKVirtIpAddrEle * ele);
INKCommentEle *copy_comment_ele(INKCommentEle * ele);
-#ifdef OEM
-INKRmServerEle *copy_rmserver_ele(INKRmServerEle * ele);
-INKVscanEle *copy_vscan_ele(INKVscanEle * ele);
-INKVsTrustedHostEle *copy_vs_trusted_host_ele(INKVsTrustedHostEle * ele);
-INKVsExtensionEle *copy_vs_extension_ele(INKVsExtensionEle * ele);
-#endif
/***************************************************************************
* Functions needed by implementation but must be hidden from user
Modified: trafficserver/traffic/trunk/proxy/mgmt2/api2/CoreAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/api2/CoreAPI.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/api2/CoreAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/api2/CoreAPI.cc Wed May 5 18:35:52 2010
@@ -46,10 +46,6 @@
#include "CoreAPIShared.h"
#include "CfgContextUtils.h"
#include "EventCallback.h"
-#if defined(OEM)
-#include "INKMgmtAPI.h"
-#include "CfgContextManager.h"
-#endif
extern int diags_init; // from Main.cc
@@ -578,72 +574,6 @@ ReadFile(INKFileNameT file, char **text,
Debug("FileOp", "[get_lines_from_file] START\n");
-#if defined(OEM)
- if (file == INK_FNAME_RMSERVER) {
- char *fileBuff, *NfileBuff, *ps;
- Tokenizer lineTok("\n");
- tok_iter_state lineTok_state;
- char *line;
- long NfileBuffsize;
- int llength;
- char *new_line;
-
- if ((ReadRmCfgFile(&fileBuff)) != INK_ERR_OKAY) {
- return INK_ERR_FAIL;
- }
- // Debug("config", "Filebuff size :%d\n", strlen(fileBuff));
- NfileBuffsize = strlen(fileBuff) * 2;
- NfileBuff = new char[NfileBuffsize];
- memset((void *) NfileBuff, 0, NfileBuffsize);
- lineTok.Initialize(fileBuff);
-
- line = (char *) lineTok.iterFirst(&lineTok_state);
- ps = NfileBuff;
- while (line) {
- if (strstr(line, RM_ADMIN_PORT)) {
- new_line = RmdeXMLize(line, &llength);
- sprintf(ps, "%s", new_line);
- if (!new_line) {
- xfree(new_line);
- }
- ps += llength;
- } else if (strstr(line, RM_LISTTAG_SCU_ADMIN)) {
- sprintf(ps, "#%s\n", line);
- ps += strlen(line) + 2;
- RmReadCfgList(&lineTok, &lineTok_state, &ps, INK_RM_LISTTAG_SCU_ADMIN);
- } else if (strstr(line, RM_LISTTAG_CNN_REALM)) {
- sprintf(ps, "#%s\n", line);
- ps += strlen(line) + 2;
- RmReadCfgList(&lineTok, &lineTok_state, &ps, INK_RM_LISTTAG_CNN_REALM);
- } else if (strstr(line, RM_LISTTAG_ADMIN_FILE)) {
- sprintf(ps, "#%s\n", line);
- ps += strlen(line) + 2;
- RmReadCfgList(&lineTok, &lineTok_state, &ps, INK_RM_LISTTAG_ADMIN_FILE);
- } else if (strstr(line, RM_LISTTAG_AUTH)) {
- sprintf(ps, "#%s\n", line);
- ps += strlen(line) + 2;
- RmReadCfgList(&lineTok, &lineTok_state, &ps, INK_RM_LISTTAG_AUTH);
- } else if (strstr(line, RM_LISTTAG_PROXY)) {
- sprintf(ps, "#%s\n", line);
- ps += strlen(line) + 2;
- RmReadCfgList(&lineTok, &lineTok_state, &ps, INK_RM_LISTTAG_PROXY);
- } else if (strstr(line, RM_LISTTAG_PNA_RDT)) {
- sprintf(ps, "#%s\n", line);
- ps += strlen(line) + 2;
- RmReadCfgList(&lineTok, &lineTok_state, &ps, INK_RM_LISTTAG_PNA_RDT);
- } else {
- sprintf(ps, "#%s\n", line);
- ps += strlen(line) + 2;
- }
- line = (char *) lineTok.iterNext(&lineTok_state);
- }
- delete[]fileBuff;
- *text = NfileBuff;
- *size = NfileBuffsize;
- *version = 1;
- return INK_ERR_OKAY;
- }
-#endif
fname = filename_to_string(file);
if (!fname)
@@ -696,43 +626,6 @@ WriteFile(INKFileNameT file, char *text,
int ret;
version_t ver;
-#if defined(OEM)
- if (file == INK_FNAME_RMSERVER) {
- char *NfileBuff, *ps;
- Tokenizer lineTok("\n");
- tok_iter_state lineTok_state;
- char *line, *new_line;
- int llength;
- long NfileBuffsize;
-
- lineTok.Initialize(text);
- line = (char *) lineTok.iterFirst(&lineTok_state);
- NfileBuffsize = strlen(text) * 2;
- NfileBuff = new char[NfileBuffsize];
- memset((void *) NfileBuff, 0, NfileBuffsize);
- ps = NfileBuff;
- while (line) {
- if (*line == '#') {
- sprintf(ps, "%s\n", line + 1); /* need this \n, since the old \n is used by tokenizer */
- ps += strlen(line);
- } else {
- new_line = RmXMLize(line, &llength);
- sprintf(ps, "%s", new_line);
- if (!new_line) {
- xfree(new_line);
- }
- ps += llength;
- }
- line = (char *) lineTok.iterNext(&lineTok_state);
- }
- if (WriteRmCfgFile(NfileBuff) != INK_ERR_OKAY) {
- delete[]NfileBuff;
- return INK_ERR_WRITE_FILE;
- }
- delete[]NfileBuff;
- return INK_ERR_OKAY;
- }
-#endif
fname = filename_to_string(file);
if (!fname)
@@ -1114,259 +1007,3 @@ EncryptToFile(const char *passwd, const
/*-------------------------------------------------------------
* rmserver.cfg
*-------------------------------------------------------------*/
-#if defined(OEM)
-
-INKString
-GetRmCfgPath()
-{
- INKString path;
-#ifndef _WIN32
-
- char buf[1024];
- FILE *ts_file, *rec_file, *pid_file;
- int i = 0, num_args = 0, found_pid_path = 0;
- char buffer[1024];
- char proxy_restart_cmd[1024];
- char ts_base_dir[1024];
- char rec_config[1024];
- static char *restart_cmd_args[100];
- INKString tmp;
- INKString temp;
- INKString tmp2;
- char *env_path;
-
- if ((env_path = getenv("TS_ROOT"))) {
- ink_strncpy(ts_base_dir, env_path, sizeof(ts_base_dir));
- } else {
- if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
- ink_strncpy(ts_base_dir, "/usr/local",sizeof(ts_base_dir));
- } else {
- fgets(buffer, 1024, ts_file);
- fclose(ts_file);
- while (!isspace(buffer[i])) {
- ts_base_dir[i] = buffer[i];
- i++;
- }
- ts_base_dir[i] = '\0';
- }
- }
-
- sprintf(rec_config, "%s/etc/trafficserver/records.config", ts_base_dir);
-
- if ((rec_file = fopen(rec_config, "r")) == NULL) {
- fprintf(stderr, "Error: unable to open %s.\n", rec_config);
- return NULL;
- }
-
- while (fgets(buffer, 1024, rec_file) != NULL) {
- if (strstr(buffer, "proxy.config.rni.proxy_restart_cmd") != NULL) {
- if ((tmp = strstr(buffer, "STRING ")) != NULL) {
- tmp += strlen("STRING ");
- for (i = 0; tmp[i] != '\n' && tmp[i] != '\0'; i++) {
- proxy_restart_cmd[i] = tmp[i];
- }
- proxy_restart_cmd[i] = '\0';
-
- tmp = proxy_restart_cmd;
- while ((tmp2 = strtok(tmp, " \t")) != NULL) {
- restart_cmd_args[num_args++] = strdup(tmp2);
- tmp = NULL;
- }
- restart_cmd_args[num_args] = NULL;
- }
- }
- }
- fclose(rec_file);
-
- path = xstrdup(restart_cmd_args[num_args - 1]);
- // printf("rmservercfgpath: %s \n",path);
- if (!path) {
- fprintf(stderr, "Error[get_rmserver_path]:rmserver.cfg path not found!\n");
- /***************************************************************
- strcpy(temp,path);
- strcpy(rmserver_path,path);
-
- tmp = temp;
- if ((tmp1 = strstr(tmp, "/rmserver.cfg")) != NULL)
- tmp[tmp1-tmp] = '\0';
- if(!tmp) {
- fprintf(stderr,"Error:rmserver.cfg not found in identified path!\n");
- return INK_ERR_FAIL;
- ***************************************************************/
- return NULL;
- }
-
-#endif
- return path;
-}
-
-/*
-DeXMLize the line and get rid of the quotes
-*/
-
-INKString
-RmdeXMLize(INKString XMLline, int *lengthp)
-{
- INKString linecp;
- INKString head;
- INKString tail;
- INKString quote_1;
-
- linecp = xstrdup(XMLline);
- memset((void *) linecp, 0, strlen(linecp));
- head = strstr(XMLline, "<Var");
- tail = strstr(XMLline, "\"/>");
- quote_1 = strstr(XMLline, "\"");
-
- if (head && tail && quote_1) {
- memcpy(linecp, (void *) (head + 4), (int) quote_1 - (int) head - 4);
- memcpy(linecp + (int) quote_1 - (int) head - 4, (void *) (quote_1 + 1), (int) tail - (int) quote_1 - 1);
- linecp = strcat(linecp, "\n");
- *lengthp = strlen(linecp);
- } else {
- *lengthp = 0;
- }
- return linecp;
-}
-
-INKString
-RmXMLize(INKString line, int *lengthp)
-{
- INKString XMLline;
-
- XMLline = new char[strlen(line) + 9];
- memset(XMLline, 0, strlen(line) + 9);
- sprintf(XMLline, "%s%s%s\n", "<Var ", line, "/>");
- *lengthp = strlen(XMLline);
- //Debug ("CoreAPI", "XMLline as %s\n", XMLline);
- return XMLline;
-}
-
-INKError
-ReadRmCfgFile(char **Buffp)
-{
-
- INKString path;
- long fsize;
- FILE *fp;
-
- //read the rmserver.cfg file
- path = GetRmCfgPath();
- if (!path) {
- fprintf(stderr, "Error:rmserver.cfg path not found!\n");
- return INK_ERR_FAIL;
- }
- if ((fp = fopen(path, "r")) == NULL) {
- fprintf(stderr, "Error: unable to open %s\n", path);
- return INK_ERR_READ_FILE;
- }
- if (path) {
- xfree(path);
- }
- /* Get the file size to alloc an text buffer */
- if (fseek(fp, 0, SEEK_END) < 0) {
- mgmt_fatal(stderr, "[CoreAPI::ReadFile] Failed seek in conf file: '%s'\n", path);
- return INK_ERR_FAIL;
- } else {
- fsize = ftell(fp);
- rewind(fp);
- *Buffp = new char[fsize + 1];
- memset(*Buffp, 0, fsize + 1);
- if (fread(*Buffp, sizeof(char), fsize, fp) == (size_t) fsize) {
- fclose(fp);
- return INK_ERR_OKAY;
- } else {
- fclose(fp);
- return INK_ERR_READ_FILE;
- }
- }
-}
-
-/*
- This function process the list in XML file with Certain interested Tags.
- */
-void
-RmReadCfgList(Tokenizer * Tp, tok_iter_state * Tstate, char **buffp, INKRmServerListT ListType)
-{
-
- char *line, *new_line;
- bool deXMLed;
- int llength;
-
- line = (char *) Tp->iterNext(Tstate);
- do {
- deXMLed = false;
- switch (ListType) {
- case INK_RM_LISTTAG_SCU_ADMIN:
- case INK_RM_LISTTAG_CNN_REALM:
- case INK_RM_LISTTAG_ADMIN_FILE:
- case INK_RM_LISTTAG_AUTH:
- /* process the REALM */
- if (strstr(line, RM_REALM)) {
- new_line = RmdeXMLize(line, &llength);
- deXMLed = true;
- }
- break;
- case INK_RM_LISTTAG_PROXY:
- /* prcess the RTSP/PNA/MAXs */
- if (strstr(line, RM_PNA_PORT) ||
- strstr(line, RM_MAX_PROXY_CONN) || strstr(line, RM_MAX_GWBW) || strstr(line, RM_MAX_PXBW)) {
- new_line = RmdeXMLize(line, &llength);
- deXMLed = true;
- }
- break;
- case INK_RM_LISTTAG_PNA_RDT:
- /* process the PNARedirector */
- if (strstr(line, RM_PNA_RDT_PORT) || strstr(line, RM_PNA_RDT_IP)) {
- new_line = RmdeXMLize(line, &llength);
- deXMLed = true;
- }
- break;
- }
- if (!deXMLed) {
- sprintf(*buffp, "#%s\n", line);
- *buffp += (strlen(line) + 2);
- } else {
- sprintf(*buffp, "%s", new_line);
- if (!new_line) {
- xfree(new_line);
- }
- *buffp += llength;
- }
- line = (char *) Tp->iterNext(Tstate);
- } while (!strstr(line, "/List"));
-
- sprintf(*buffp, "#%s\n", line);
- *buffp += (strlen(line) + 2);
- return;
-}
-
-INKError
-WriteRmCfgFile(char *text)
-{
-
- INKString path;
- FILE *fp;
- INKError rc;
-
- //read the rmserver.cfg file
- path = GetRmCfgPath();
- if (!path) {
- fprintf(stderr, "Error:rmserver.cfg path not found!\n");
- return INK_ERR_FAIL;
- }
- if ((fp = fopen(path, "w")) == NULL) {
- fprintf(stderr, "Error: unable to open %s\n", path);
- return INK_ERR_READ_FILE;
- }
- long fsize = strlen(text);
- if (fwrite((void *) text, sizeof(char), fsize, fp) == (size_t) fsize) {
- rc = INK_ERR_OKAY;
- } else {
- rc = INK_ERR_WRITE_FILE;
- }
- fclose(fp);
- return rc;
-}
-
-#endif
Modified: trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.cc Wed May 5 18:35:52 2010
@@ -244,16 +244,6 @@ Rule::parse(const char *const_rule, INKF
return updateParse(rule);
case INK_FNAME_VADDRS: /* vaddrs.config */
return vaddrsParse(rule);
-#if defined(OEM)
- case INK_FNAME_RMSERVER: /* rmserver.cfg */
- return rmserverParse(rule);
- case INK_FNAME_VSCAN: /* vscan.config */
- return vscanParse(rule);
- case INK_FNAME_VS_TRUSTED_HOST: /* trusted-host.config */
- return vsTrustedHostParse(rule);
- case INK_FNAME_VS_EXTENSION: /* extensions.config */
- return vsExtensionParse(rule);
-#endif
default:
return NULL;
}
@@ -1029,74 +1019,6 @@ Rule::storageParse(char *rule)
return m_tokenList;
}
-#if defined(OEM)
-/**
- * RmServerParse
- * ------------
- * The line should be in XXX=VVV format
- *
- **/
-TokenList *
-Rule::rmserverParse(char *rule)
-{
- return cacheParse(rule, 1, 1);
-}
-
-/*
- Rule::vscanParse
- parse plugins/vscan.config
- each line is in attr_name=attr_value format
- */
-TokenList *
-Rule::vscanParse(char *rule)
-{
- return cacheParse(rule, 1, 1);
-}
-
-/*
- Rule::vsTrustedHostParse
- parse plugins/trusted-host.config
- each line is in <hostname> format
- ex: internal.inktomi.com
- */
-TokenList *
-Rule::vsTrustedHostParse(char *rule)
-{
- Tokenizer ruleTok(" \t");
- int numRuleTok = ruleTok.Initialize(rule);
- tok_iter_state ruleTok_state;
- const char *tokenStr = ruleTok.iterFirst(&ruleTok_state);
-
- if (numRuleTok != 1) {
- setErrorHint("Expecting one token");
- return NULL;
- }
-
- Token *token;
- TokenList *m_tokenList = NEW(new TokenList());
-
- // at least one token, anyways
- token = NEW(new Token());
- token->setName(tokenStr);
- m_tokenList->enqueue(token);
-
- return m_tokenList;
-}
-
-/*
- Rule::vsExtensionParse
- parse plugins/extensions.config
- each line is in <file_extension> format
- ex: txt
- */
-TokenList *
-Rule::vsExtensionParse(char *rule)
-{
- // currently, format is same as trusted, no need to duplicate the code
- // this fact may change later
- return vsTrustedHostParse(rule);
-}
-#endif
/*
* bool Rule::inQuote(char *str)
@@ -1208,17 +1130,6 @@ RuleList::parse(char *fileBuf, const cha
} else if (strstr(filename, "storage.config")) {
m_filetype = INK_FNAME_STORAGE; /* storage.config */
}
-#if defined(OEM)
- else if (strstr(filename, "rmserver.cfg")) {
- m_filetype = INK_FNAME_RMSERVER; /* rmserver.cfg */
- } else if (strstr(filename, "plugins/vscan.config")) {
- m_filetype = INK_FNAME_VSCAN; /* vscan.config */
- } else if (strstr(filename, "plugins/trusted-host.config")) {
- m_filetype = INK_FNAME_VS_TRUSTED_HOST; /* trusted-host.config */
- } else if (strstr(filename, "plugins/extensions.config")) {
- m_filetype = INK_FNAME_VS_EXTENSION; /* extensions.config */
- }
-#endif
else {
m_filetype = INK_FNAME_UNDEFINED;
}
Modified: trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.h?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.h (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/api2/GenericParser.h Wed May 5 18:35:52 2010
@@ -221,12 +221,6 @@ private:
TokenList *logsParse(char *rule);
TokenList *pluginParse(char *rule);
TokenList *storageParse(char *rule);
-#if defined(OEM)
- TokenList *rmserverParse(char *rule);
- TokenList *vscanParse(char *rule);
- TokenList *vsTrustedHostParse(char *rule);
- TokenList *vsExtensionParse(char *rule);
-#endif
TokenList *log_hostsParse(char *rule);
bool inQuote(const char *str);
};
Modified: trafficserver/traffic/trunk/proxy/mgmt2/api2/INKMgmtAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/api2/INKMgmtAPI.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/api2/INKMgmtAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/api2/INKMgmtAPI.cc Wed May 5 18:35:52 2010
@@ -1743,128 +1743,6 @@ INKVirtIpAddrEleDestroy(INKVirtIpAddrEle
}
}
-#if defined(OEM)
-/*-------------------------------------------------------------
- * INKRmServerEle
- *-------------------------------------------------------------*/
-INKRmServerEle *
-INKRmServerEleCreate(INKRuleTypeT type)
-{
- INKRmServerEle *ele;
- ele = (INKRmServerEle *) xmalloc(sizeof(INKRmServerEle));
- if (!ele)
- return NULL;
-
- ele->cfg_ele.type = type;
- ele->Vname = NULL;
- ele->str_val = NULL;
- ele->int_val = -1;
- return ele;
-}
-
-void
-INKRmServerEleDestroy(INKRmServerEle * ele)
-{
- if (ele) {
- if (ele->Vname)
- xfree(ele->Vname);
- if (ele->str_val)
- xfree(ele->str_val);
- xfree(ele);
- }
-}
-
-/*-------------------------------------------------------------
- * INKVscanEle
- *-------------------------------------------------------------*/
-INKVscanEle *
-INKVscanEleCreate()
-{
- INKVscanEle *ele;
- ele = (INKVscanEle *) xmalloc(sizeof(INKVscanEle));
- if (!ele)
- return NULL;
-
- ele->cfg_ele.type = INK_VSCAN;
- ele->cfg_ele.error = INK_ERR_OKAY;
- ele->attr_name = NULL;
- ele->attr_val = NULL;
-
- return ele;
-}
-
-void
-INKVscanEleDestroy(INKVscanEle * ele)
-{
- if (ele) {
- if (ele->attr_name)
- xfree(ele->attr_name);
- if (ele->attr_val)
- xfree(ele->attr_val);
- xfree(ele);
- }
- return;
-}
-
-/*-------------------------------------------------------------
- * INKVsTrustedHostEle
- *-------------------------------------------------------------*/
-INKVsTrustedHostEle *
-INKVsTrustedHostEleCreate()
-{
- INKVsTrustedHostEle *ele;
- ele = (INKVsTrustedHostEle *) xmalloc(sizeof(INKVsTrustedHostEle));
- if (!ele)
- return NULL;
-
- ele->cfg_ele.type = INK_VS_TRUSTED_HOST;
- ele->cfg_ele.error = INK_ERR_OKAY;
- ele->hostname = NULL;
-
- return ele;
-}
-
-void
-INKVsTrustedHostEleDestroy(INKVsTrustedHostEle * ele)
-{
- if (ele) {
- if (ele->hostname)
- xfree(ele->hostname);
- xfree(ele);
- }
- return;
-}
-
-/*-------------------------------------------------------------
- * INKVsExtensionEle
- *-------------------------------------------------------------*/
-INKVsExtensionEle *
-INKVsExtensionEleCreate()
-{
- INKVsExtensionEle *ele;
- ele = (INKVsExtensionEle *) xmalloc(sizeof(INKVsExtensionEle));
- if (!ele)
- return NULL;
-
- ele->cfg_ele.type = INK_VS_EXTENSION;
- ele->cfg_ele.error = INK_ERR_OKAY;
- ele->file_ext = NULL;
-
- return ele;
-}
-
-void
-INKVsExtensionEleDestroy(INKVsExtensionEle * ele)
-{
- if (ele) {
- if (ele->file_ext)
- xfree(ele->file_ext);
- xfree(ele);
- }
- return;
-}
-
-#endif
/***************************************************************************
* API Core
***************************************************************************/
Modified: trafficserver/traffic/trunk/proxy/mgmt2/api2/include/INKMgmtAPI.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/api2/include/INKMgmtAPI.h?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/api2/include/INKMgmtAPI.h (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/api2/include/INKMgmtAPI.h Wed May 5 18:35:52 2010
@@ -482,19 +482,6 @@ typedef enum
INK_STORAGE, /* storage.config */
INK_UPDATE_URL, /* update.config */
INK_VADDRS, /* vaddrs.config */
-#ifdef OEM
- INK_RM_ADMIN_PORT, /* rmserver.cfg */
- INK_RM_REALM,
- INK_RM_PNA_PORT,
- INK_RM_MAX_PROXY_CONN,
- INK_RM_MAX_GWBW,
- INK_RM_MAX_PXBW,
- INK_RM_PNA_RDT_PORT,
- INK_RM_PNA_RDT_IP,
- INK_VSCAN, /* vscan.config */
- INK_VS_TRUSTED_HOST, /* trusted-host.config */
- INK_VS_EXTENSION, /* extensions.config */
-#endif
INK_TYPE_UNDEFINED,
INK_TYPE_COMMENT /* for internal use only */
} INKRuleTypeT;
@@ -1104,16 +1091,6 @@ typedef enum
inkapi void INKUpdateEleDestroy(INKUpdateEle * ele);
inkapi INKVirtIpAddrEle *INKVirtIpAddrEleCreate();
inkapi void INKVirtIpAddrEleDestroy(INKVirtIpAddrEle * ele);
-#ifdef OEM
- inkapi INKRmServerEle *INKRmServerEleCreate(INKRuleTypeT);
- inkapi void INKRmServerEleDestroy(INKRmServerEle * ele);
- inkapi INKVscanEle *INKVscanEleCreate();
- inkapi void INKVscanEleDestroy(INKVscanEle * ele);
- inkapi INKVsTrustedHostEle *INKVsTrustedHostEleCreate();
- inkapi void INKVsTrustedHostEleDestroy(INKVsTrustedHostEle * ele);
- inkapi INKVsExtensionEle *INKVsExtensionEleCreate();
- inkapi void INKVsExtensionEleDestroy(INKVsExtensionEle * ele);
-#endif
/*--- Ele helper operations -------------------------------------*/
/* INKIsValid: checks if the fields in the ele are all valid
Modified: trafficserver/traffic/trunk/proxy/mgmt2/cluster/ClusterCom.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/cluster/ClusterCom.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/cluster/ClusterCom.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/cluster/ClusterCom.cc Wed May 5 18:35:52 2010
@@ -1583,9 +1583,6 @@ ClusterCom::constructSharedFilePacket(ch
/* Some files are local only */
if (strcmp(line, "ipnat.conf") == 0 || strcmp(line, "storage.config") == 0 ||
-#if defined(OEM)
- strcmp(line, "net.config.xml") == 0 ||
-#endif
strcmp(line, "lm.config") == 0 || // legacy: should remove
strcmp(line, "internal.config") == 0) { // legacy: should remove
continue;
Modified: trafficserver/traffic/trunk/proxy/mgmt2/tools/NetConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/tools/NetConfig.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/tools/NetConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/tools/NetConfig.cc Wed May 5 18:35:52 2010
@@ -1371,283 +1371,6 @@ set_search_domain(char *search_name)
}
-#ifdef OEM
-//Input: connection_speed - 10, 100, 1000 Mb/sec or 0 for autonegotiate
-// duplex - true - full duplex - false half duplex
-
-int
-setNICConnection(char *nic_name, int connection_speed, bool duplex, bool auto_negotiate)
-{
- char buf[1024], tmp_buf[1024], module_path[1024], module_path_new[1024];
- FILE *fp, *fp1, *fp2;
- const char *mv_binary = MV_BINARY;
- const char *rmmod_binary = RMMOD_BINARY;
- const char *insmod_binary = INSMOD_BINARY;
- int status;
- pid_t pid;
- bool file_exists = true;
- char *tmp, *tmp1, *options, *modname;
- bool found = false;
-
-#if (HOST_OS == linux)
- if ((fp2 = fopen("/dev/.nic", "r")) == NULL) {
- perror("[net_config] failed to open NIC configuration file");
- return 1;
- }
- snprintf(module_path, sizeof(module_path), "%s", MODULE_CONFIG);
- if ((fp = fopen(module_path, "r")) == NULL) {
- file_exists = false;
- perror("[net_config] module file doesn't exist\n");
- }
- snprintf(module_path_new, sizeof(module_path_new), "%s.new", MODULE_CONFIG);
- if ((fp1 = fopen(module_path_new, "w")) == NULL) {
- perror("[net_config] failed to open new module configuration file");
- return 1;
- }
- //first read in the NIC configuration file data
- while (!feof(fp2) && !found) {
- if (strcasestr(buf, nic_name)) {
- found = true;
- } else
- fgets(buf, 1024, fp2);
- }
- fclose(fp2);
-
- ink_strncpy(tmp_buf, buf, sizeof(tmp_buf));
-
- //buf includes the options for the card, let's do a quick validation and parsing
- //This should probably be moved to a seperate function
-
- //if (tmp = strstr(buf, "options")) {
- //let's analyse the options according to the input
- bool map = false;
- if (auto_negotiate) {
- if (tmp = strcasestr(buf, "auto")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strcasestr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- //now clear the begining of options and modename
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- map = true;
- }
- }
- }
- if (connection_speed == 10 && !duplex) {
- if (tmp = strstr(buf, "10h")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strstr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- map = true;
- //now clear the begining of options and modename
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- }
- }
- }
- if (connection_speed == 10 && duplex) {
- if (tmp = strstr(buf, "10f")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strstr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- map = true;
- //now clear the begining of options and modename
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- }
- }
- }
- if (connection_speed == 100 && !duplex) {
- if (tmp = strstr(buf, "100h")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strstr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- map = true;
- //now clear the begining of options and modename
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- //printf("!!!!finally options has %s and modname has %s\n", options, modname);
- }
- }
- }
- if (connection_speed == 100 && duplex) {
- if (tmp = strstr(buf, "100f")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strstr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- map = true;
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- }
- }
- }
- if (!map) {
- perror("[net_config] module config file has wrong syntax");
- if (fp)
- fclose(fp);
- if (fp1)
- fclose(fp1);
- return 1;
- }
- //now setup the card for this round
- //bring the interface down
- char *ifconfig_binary = IFCONFIG;
-
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- wait(&status);
- } else {
- int res = execl(ifconfig_binary, "ifconfig", nic_name, "down", (char*)NULL);
- if (res != 0) {
- perror("[net_confg] couldn't bring interface down");
- }
- _exit(res);
- }
-
- // rmmod the driver
-
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- wait(&status);
- } else {
- int res = execl(rmmod_binary, "rmmod", modname, (char*)NULL);
- if (res != 0) {
- perror("[net_confg] couldn't rmmod the ethernet driver");
- }
- _exit(res);
- }
-
- //now insmod the driver with the right options
-
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- wait(&status);
- } else {
- int res = execl(insmod_binary, "insmod", modname, options, (char*)NULL);
- if (res != 0) {
- perror("[net_confg] couldn't insmod the ethernet driver");
- }
- _exit(res);
- }
-
- //lastly, we need to ifconfig up the nic again
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- wait(&status);
- } else {
- //trying something a bit different
- int res = execl("/etc/rc.d/init.d/network", "network", "start", (char*)NULL);
- //int res = execl(ifconfig_binary, "ifconfig", nic_name, "up", NULL);
- if (res != 0) {
- perror("[net_confg] couldn't bring interface up");
- }
- _exit(res);
- }
-
-
- // fix it for next boot
-
- bool alias_found = false, options_found = false;
-
- if (file_exists) {
- fgets(buf, 1024, fp);
- while (!feof(fp)) {
- //check alias
- if ((tmp = strcasestr(buf, "alias")) && !alias_found) {
- if (tmp1 = strcasestr(buf, nic_name)) {
- tmp = NULL;
- if ((tmp = strstr(tmp1, modname)) == NULL) {
- if (fp)
- fclose(fp);
- if (fp1)
- fclose(fp1);
- perror("[net_cofig] modules.conf file syntax is wrong - aborting");
- return 1;
- }
- alias_found = true;
- fprintf(fp1, buf);
- }
- } else if ((tmp = strstr(buf, "options")) && !options_found) {
- if (tmp1 = strstr(buf, modname)) {
- //change it to the new options:
- if (!alias_found) {
- fprintf(fp1, "alias %s %s\n", nic_name, modname);
- alias_found = true;
- }
- fprintf(fp1, "options %s %s\n", modname, options);
- options_found = true;
- }
- }
- //not interesting
- fprintf(fp1, buf);
- fgets(buf, 1024, fp);
- }
- // fix file - last round
- if (!alias_found)
- fprintf(fp1, "alias %s %s\n", nic_name, modname);
- if (!options_found)
- fprintf(fp1, "options %s %s\n", modname, options);
- if (fp)
- fclose(fp);
- if (fp1)
- fclose(fp1);
-
- //move then new file over the old file
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- wait(&status);
- } else {
- int res;
- res = execl(mv_binary, "mv", module_path_new, module_path, (char*)NULL);
- if (res != 0) {
- perror("[net_config] mv of new module config file failed ");
- }
- _exit(res);
- }
- } else { //file doesn't exist
- if ((fp = fopen(module_path, "w")) == NULL) {
- perror("[net_config] could't open module file for writing\n");
- return 1;
- }
- fprintf(fp, "alias %s %s\n", nic_name, modname);
- fprintf(fp, "options %s %s\n", modname, options);
- if (fp)
- fclose(fp);
- }
-#endif
- return 0;
-}
-
-bool
-isLineCommented(char *line)
-{
- char *p = line;
- while (*p) {
- if (*p == '#')
- return true;
- if (!isspace(*p) && *p != '#')
- return false;
- p++;
- }
- return true;
-}
-
-#endif
int
rm_stop_proxy()
@@ -1794,11 +1517,6 @@ main(int argc, char **argv)
case 5:
down_interface(argv[2]);
break;
-#ifdef OEM
- case 6:
- setNICConnection(argv[2], atoi(argv[3]), atoi(argv[4]), atoi(argv[5]));
- break;
-#endif
case 7:
rm_stop_proxy();
break;
@@ -3246,269 +2964,6 @@ set_search_domain(char *search_name)
}
-#ifdef OEM
-//Input: connection_speed - 10, 100, 1000 Mb/sec or 0 for autonegotiate
-// duplex - true - full duplex - false half duplex
-
-int
-setNICConnection(char *nic_name, int connection_speed, bool duplex, bool auto_negotiate)
-{
- char buf[1024], tmp_buf[1024], module_path[1024], module_path_new[1024];
- FILE *fp, *fp1, *fp2;
- const char *mv_binary = MV_BINARY;
- const char *rmmod_binary = RMMOD_BINARY;
- const char *insmod_binary = INSMOD_BINARY;
- int status;
- pid_t pid;
- bool file_exists = true;
- char *tmp, *tmp1, *options, *modname;
- bool found = false;
-
-#if (HOST_OS == linux)
- if ((fp2 = fopen("/dev/.nic", "r")) == NULL) {
- perror("[net_config] failed to open NIC configuration file");
- return 1;
- }
- snprintf(module_path, sizeof(module_path), "%s", MODULE_CONFIG);
- if ((fp = fopen(module_path, "r")) == NULL) {
- file_exists = false;
- perror("[net_config] module file doesn't exist\n");
- }
- snprintf(module_path_new, sizeof(module_path_new), "%s.new", MODULE_CONFIG);
- if ((fp1 = fopen(module_path_new, "w")) == NULL) {
- perror("[net_config] failed to open new module configuration file");
- return 1;
- }
- //first read in the NIC configuration file data
- while (!feof(fp2) && !found) {
- if (strcasestr(buf, nic_name)) {
- found = true;
- } else
- fgets(buf, 1024, fp2);
- }
- fclose(fp2);
-
- ink_strncpy(tmp_buf, buf, sizeof(tmp_buf));
-
- //buf includes the options for the card, let's do a quick validation and parsing
- //This should probably be moved to a seperate function
-
- //if (tmp = strstr(buf, "options")) {
- //let's analyse the options according to the input
- bool map = false;
- if (auto_negotiate) {
- if (tmp = strcasestr(buf, "auto")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strcasestr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- //now clear the begining of options and modename
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- map = true;
- }
- }
- }
- if (connection_speed == 10 && !duplex) {
- if (tmp = strstr(buf, "10h")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strstr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- map = true;
- //now clear the begining of options and modename
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- }
- }
- }
- if (connection_speed == 10 && duplex) {
- if (tmp = strstr(buf, "10f")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strstr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- map = true;
- //now clear the begining of options and modename
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- }
- }
- }
- if (connection_speed == 100 && !duplex) {
- if (tmp = strstr(buf, "100h")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strstr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- map = true;
- //now clear the begining of options and modename
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- //printf("!!!!finally options has %s and modname has %s\n", options, modname);
- }
- }
- }
- if (connection_speed == 100 && duplex) {
- if (tmp = strstr(buf, "100f")) {
- options = strtok(tmp, ">"); //this should have the options
- if (tmp1 = strstr(tmp_buf, "modname")) {
- modname = strtok(tmp1, ">");
- map = true;
- options = strstr(options, "=");
- options++;
- modname = strstr(modname, "=");
- modname++;
- }
- }
- }
- if (!map) {
- perror("[net_config] module config file has wrong syntax");
- if (fp)
- fclose(fp);
- if (fp1)
- fclose(fp1);
- return 1;
- }
- //now setup the card for this round
- //bring the interface down
- char *ifconfig_binary = IFCONFIG;
-
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- waitpid(pid, &status, 0);
- } else {
- int res = execl(ifconfig_binary, "ifconfig", nic_name, "down", (char*)NULL);
- if (res != 0) {
- perror("[net_confg] couldn't bring interface down");
- }
- _exit(res);
- }
-
- // rmmod the driver
-
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- waitpid(pid, &status, 0);
- } else {
- int res = execl(rmmod_binary, "rmmod", modname, (char*)NULL);
- if (res != 0) {
- perror("[net_confg] couldn't rmmod the ethernet driver");
- }
- _exit(res);
- }
-
- //now insmod the driver with the right options
-
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- waitpid(pid, &status, 0);
- } else {
- int res = execl(insmod_binary, "insmod", modname, options, (char*)NULL);
- if (res != 0) {
- perror("[net_confg] couldn't insmod the ethernet driver");
- }
- _exit(res);
- }
-
- //lastly, we need to ifconfig up the nic again
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- waitpid(pid, &status, 0);
- } else {
- //trying something a bit different
- int res = execl("/etc/rc.d/init.d/network", "network", "start", (char*)NULL);
- //int res = execl(ifconfig_binary, "ifconfig", nic_name, "up", NULL);
- if (res != 0) {
- perror("[net_confg] couldn't bring interface up");
- }
- _exit(res);
- }
-
-
- // fix it for next boot
-
- bool alias_found = false, options_found = false;
-
- if (file_exists) {
- fgets(buf, 1024, fp);
- while (!feof(fp)) {
- //check alias
- if ((tmp = strcasestr(buf, "alias")) && !alias_found) {
- if (tmp1 = strcasestr(buf, nic_name)) {
- tmp = NULL;
- if ((tmp = strstr(tmp1, modname)) == NULL) {
- if (fp)
- fclose(fp);
- if (fp1)
- fclose(fp1);
- perror("[net_cofig] modules.conf file syntax is wrong - aborting");
- return 1;
- }
- alias_found = true;
- fprintf(fp1, buf);
- }
- } else if ((tmp = strstr(buf, "options")) && !options_found) {
- if (tmp1 = strstr(buf, modname)) {
- //change it to the new options:
- if (!alias_found) {
- fprintf(fp1, "alias %s %s\n", nic_name, modname);
- alias_found = true;
- }
- fprintf(fp1, "options %s %s\n", modname, options);
- options_found = true;
- }
- }
- //not interesting
- fprintf(fp1, buf);
- fgets(buf, 1024, fp);
- }
- // fix file - last round
- if (!alias_found)
- fprintf(fp1, "alias %s %s\n", nic_name, modname);
- if (!options_found)
- fprintf(fp1, "options %s %s\n", modname, options);
- if (fp)
- fclose(fp);
- if (fp1)
- fclose(fp1);
-
- //move then new file over the old file
- if ((pid = fork()) < 0) {
- exit(1);
- } else if (pid > 0) {
- waitpid(pid, &status, 0);
- } else {
- int res;
- res = execl(mv_binary, "mv", module_path_new, module_path, (char*)NULL);
- if (res != 0) {
- perror("[net_config] mv of new module config file failed ");
- }
- _exit(res);
- }
- } else { //file doesn't exist
- if ((fp = fopen(module_path, "w")) == NULL) {
- perror("[net_config] could't open module file for writing\n");
- return 1;
- }
- fprintf(fp, "alias %s %s\n", nic_name, modname);
- fprintf(fp, "options %s %s\n", modname, options);
- if (fp)
- fclose(fp);
- }
-#endif
- return 0;
-}
-
-#endif
int
main(int argc, char **argv)
@@ -3546,11 +3001,6 @@ main(int argc, char **argv)
case 5:
down_interface(argv[2]);
break;
-#ifdef OEM
- case 6:
- setNICConnection(argv[2], atoi(argv[3]), atoi(argv[4]), atoi(argv[5]));
- break;
-#endif
default:
return 1;
}
Modified: trafficserver/traffic/trunk/proxy/mgmt2/utils/WebMgmtUtils.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/utils/WebMgmtUtils.cc?rev=941419&r1=941418&r2=941419&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/utils/WebMgmtUtils.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/utils/WebMgmtUtils.cc Wed May 5 18:35:52 2010
@@ -1046,10 +1046,7 @@ computeXactMax()
// CALLEE must deallocate the returned hash table with
// ink_hash_table_destroy_and_xfree_values(InkHashTable *ht_ptr)
//
-#ifdef OEM
-// OEM version supports select multiple
-// once this is stablized, will merge this code to GA
InkHashTable *
processFormSubmission(char *submission)
{
@@ -1062,8 +1059,6 @@ processFormSubmission(char *submission)
char *value;
char *submission_copy;
int pairNum;
- char *old_value;
- char buffer[2048];
if (submission == NULL) {
ink_hash_table_destroy(nameVal);
@@ -1092,15 +1087,6 @@ processFormSubmission(char *submission)
value = NULL;
} else {
value = xstrdup(pair[1]);
- if (ink_hash_table_lookup(nameVal, (char *) name, (void **) &old_value)) {
- if (old_value) {
- strcpy(buffer, old_value);
- strcat(buffer, "&");
- value = xstrdup(strcat(buffer, value));
- ink_hash_table_delete(nameVal, name);
- xfree(old_value);
- }
- }
substituteUnsafeChars(value);
}
@@ -1113,61 +1099,6 @@ processFormSubmission(char *submission)
return nameVal;
}
-#else
-
-InkHashTable *
-processFormSubmission(char *submission)
-{
-
- InkHashTable *nameVal = ink_hash_table_create(InkHashTableKeyType_String);
- Tokenizer updates("&\n\r");
- Tokenizer pair("=");
- int numUpdates;
- char *name;
- char *value;
- char *submission_copy;
- int pairNum;
-
- if (submission == NULL) {
- ink_hash_table_destroy(nameVal);
- return NULL;
- }
-
- submission_copy = xstrdup(submission);
- numUpdates = updates.Initialize(submission_copy, SHARE_TOKS);
-
- for (int i = 0; i < numUpdates; i++) {
- pairNum = pair.Initialize(updates[i]);
-
- // We should have gotten either either 1 or 2 tokens
- // One token indicates an variable being set to
- // blank. Two indicates the variable being set to
- // a value. If the submission is invalid, just forget
- // about it.
- if (pairNum == 1 || pairNum == 2) {
- name = xstrdup(pair[0]);
- substituteUnsafeChars(name);
-
- // If the value is blank, store it as a null
- // since BaseRecords represents empty as NULL
- // as opposed to the empty string
- if (pairNum == 1) {
- value = NULL;
- } else {
- value = xstrdup(pair[1]);
- substituteUnsafeChars(value);
- }
-
- ink_hash_table_insert(nameVal, name, value);
- xfree(name);
- }
- }
- xfree(submission_copy);
-
- return nameVal;
-}
-#endif
-
// InkHashTable* processFormSubmission_noSubstitute(char* submission)
//
// A generic way to handle a HTML form submission.