You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2013/11/14 21:34:13 UTC
[11/16] TS-2349: Move traffic_shell to the cmd subdirectory
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/775ad1dc/cmd/traffic_shell/UtilCmds.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_shell/UtilCmds.cc b/cmd/traffic_shell/UtilCmds.cc
new file mode 100644
index 0000000..74ed09e
--- /dev/null
+++ b/cmd/traffic_shell/UtilCmds.cc
@@ -0,0 +1,196 @@
+/** @file
+
+ A brief file description
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+/****************************************************************
+ * Filename: UtilCmds.cc
+ * Purpose: This file contains the CLI's utility commands.
+ *
+ *
+ ****************************************************************/
+
+#include "UtilCmds.h"
+#include "createArgument.h"
+#include "CliMgmtUtils.h"
+#include "CliDisplay.h"
+#include "ink_error.h"
+#include "ink_defs.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+////////////////////////////////////////////////////////////////
+// DebugCmd
+//
+// This is the callback function for the "debug" command.
+//
+// Parameters:
+// clientData -- information about parsed arguments
+// interp -- the Tcl interpreter
+// argc -- number of command arguments
+// argv -- the command arguments
+//
+int
+DebugCmd(ClientData clientData, Tcl_Interp * interp, int argc, const char *argv[])
+{
+ /* call to processArgForCommand must appear at the beginning
+ * of each command's callback function
+ */
+ if (processArgForCommand(interp, argc, argv) != CLI_OK) {
+ return CMD_ERROR;
+ }
+
+ if (processHelpCommand(argc, argv) == CLI_OK)
+ return CMD_OK;
+
+ cli_cmdCallbackInfo *cmdCallbackInfo;
+ cli_parsedArgInfo *argtable, *infoPtr;
+
+ cmdCallbackInfo = (cli_cmdCallbackInfo *) clientData;
+ argtable = cmdCallbackInfo->parsedArgTable;
+
+ Cli_Debug("DebugCmd\n");
+
+ for (infoPtr = argtable; (infoPtr->parsed_args != 0); infoPtr++) {
+
+ // call appropriate function based on the 1st argument
+
+ switch (infoPtr->parsed_args) {
+ case CMD_DEBUG_ON:
+ Cli_Debug("debug on sub-command\n");
+ return (DebugOn());
+
+ case CMD_DEBUG_OFF:
+ Cli_Debug("debug off sub-command\n");
+ return (DebugOff());
+ }
+ }
+ return CLI_OK;
+}
+
+
+////////////////////////////////////////////////////////////////
+// DebugCmdArgs
+//
+// Register "debug" command arguments with the Tcl interpreter.
+//
+int
+DebugCmdArgs()
+{
+ Cli_Debug("DebugCmdArgs\n");
+
+ createArgument("on", 1, CLI_ARGV_CONSTANT, (char *) NULL, CMD_DEBUG_ON, "Turn Debug Statements ON", (char *) NULL);
+
+ createArgument("off", 1, CLI_ARGV_CONSTANT, (char *) NULL, CMD_DEBUG_OFF, "Turn Debug Statements OFF", (char *) NULL);
+
+ return CLI_OK;
+}
+
+////////////////////////////////////////////////////////////////
+//
+// "debug" sub-command implementations
+//
+////////////////////////////////////////////////////////////////
+
+
+// debug on sub-command
+// used to turn on debug print statements
+int
+DebugOn()
+{
+ CliPrintLevelT level = Cli_GetPrintLevel();
+ level = (CliPrintLevelT) ((int) level | (int) CLI_PRINT_DEBUG);
+ Cli_SetPrintLevel(level);
+ return CLI_OK;
+}
+
+// debug off sub-command
+// used to turn off debug print statements
+int
+DebugOff()
+{
+ CliPrintLevelT level = Cli_GetPrintLevel();
+ level = (CliPrintLevelT) ((int) level & ~(int) CLI_PRINT_DEBUG);
+ Cli_SetPrintLevel(level);
+ return CLI_OK;
+}
+
+
+////////////////////////////////////////////////////////////////
+// Cmd_ConfigRoot
+//
+// This is the callback function for the "config:root" command.
+//
+// Parameters:
+// clientData -- information about parsed arguments
+// interp -- the Tcl interpreter
+// argc -- number of command arguments
+// argv -- the command arguments
+//
+int
+Cmd_ConfigRoot(ClientData /* clientData ATS_UNUSED */, Tcl_Interp * interp, int argc, const char *argv[])
+{
+ /* call to processArgForCommand must appear at the beginning
+ * of each command's callback function
+ */
+ if (processArgForCommand(interp, argc, argv) != CLI_OK) {
+ return CMD_ERROR;
+ }
+
+ if (processHelpCommand(argc, argv) == CLI_OK)
+ return CMD_OK;
+
+ if (cliCheckIfEnabled("config:root") == CLI_ERROR) {
+ return CMD_ERROR;
+ }
+
+ Cli_Debug("Cmd_ConfigRoot\n");
+
+ if (getuid() == 0) {
+ Cli_Printf("Already root user.\n");
+ return CLI_OK;
+
+ }
+ char ts_path[1024];
+ if (GetTSDirectory(ts_path,sizeof(ts_path))) {
+ return CLI_ERROR;
+ }
+
+ char command[1024];
+ snprintf(command, sizeof(command),
+ "/bin/su - root -c \"%s/start_traffic_shell\"", ts_path);
+
+ // start traffic_shell as root user
+ // su will prompt user for root password
+ int pid = fork();
+ if (pid == 0) {
+ if (system(command) == -1)
+ exit(2);
+ else
+ exit(1);
+ }
+
+ waitpid(pid, NULL, 0);
+
+ return CLI_OK;
+}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/775ad1dc/cmd/traffic_shell/UtilCmds.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_shell/UtilCmds.h b/cmd/traffic_shell/UtilCmds.h
new file mode 100644
index 0000000..ad1c705
--- /dev/null
+++ b/cmd/traffic_shell/UtilCmds.h
@@ -0,0 +1,94 @@
+/** @file
+
+ A brief file description
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+/****************************************************************
+ * Filename: UtilCmds.h
+ * Purpose: This file contains the CLI's utility commands.
+ *
+ *
+ ****************************************************************/
+
+
+/* This includes a commited hacked version of tcl which has an external dependancy
+ on cli-specific code and thus, this tcl build cannot be used with other
+ code, and normal non-hacked tcl cannot be used with cli. Even more beutiful
+ is the fact that the hacks are no-where documented. I managed to scrape
+ them up and role them into a patch which can be found in
+ $CVSROOT/contrib/tcl-tclx/common/patches for reference in case someone
+ ever should feel like comming up with something a little more well thought out.
+ Oh, did I mention also that apperently, no thought was put toward how to make
+ this work with more than one platform, or is that obvious just by looking
+ at the structure?
+*/
+//#include "inktcl/include/tcl.h"
+/* There is is in all it's glory :( */
+
+
+#include "createArgument.h"
+#include "definitions.h"
+
+#ifndef __UTIL_CMDS_H__
+#define __UTIL_CMDS_H__
+
+// enumerated type which captures all "debug" command options
+typedef enum
+{
+ CMD_DEBUG_ON = 1,
+ CMD_DEBUG_OFF
+} cliDebugCommand;
+
+////////////////////////////////////////////////////////////////
+// DebugCmd
+//
+// This is the callback function for the "debug" command.
+//
+// Parameters:
+// clientData -- information about parsed arguments
+// interp -- the Tcl interpreter
+// argc -- number of command arguments
+// argv -- the command arguments
+//
+int DebugCmd(ClientData clientData, Tcl_Interp * interp, int argc, const char *argv[]);
+
+////////////////////////////////////////////////////////////////
+// DebugCmdArgs
+//
+// Register "debug" command arguments with the Tcl interpreter.
+//
+int DebugCmdArgs();
+
+////////////////////////////////////////////////////////////////
+//
+// "debug" sub-command implementations
+//
+////////////////////////////////////////////////////////////////
+
+// debug on sub-command
+int DebugOn();
+
+// debug off sub-command
+int DebugOff();
+
+int Cmd_ConfigRoot(ClientData clientData, Tcl_Interp * interp, int argc, const char *argv[]);
+
+#endif // __UTIL_CMDS_H__
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/775ad1dc/cmd/traffic_shell/cliAppInit.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_shell/cliAppInit.cc b/cmd/traffic_shell/cliAppInit.cc
new file mode 100644
index 0000000..461b9f6
--- /dev/null
+++ b/cmd/traffic_shell/cliAppInit.cc
@@ -0,0 +1,165 @@
+/** @file
+
+ A brief file description
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+/*
+ * cliAppInit.c --
+ *
+ *
+ * This file initiliazes the application by calling all
+ * the new commands and thier respective arguments
+ *
+ *
+ *
+ * Dated : 12/13/2000.
+ */
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <iostream>
+
+//#include "tclExtend.h"
+#include "tcl.h"
+#include <unistd.h>
+#include <sys/types.h>
+#include "CliMgmtUtils.h"
+#include "createCommand.h"
+#include "hashtable.h"
+#include "createArgument.h"
+#include "definitions.h"
+#include "ShowCmd.h"
+#include "ConfigCmd.h"
+#include "CliCreateCommands.h"
+#include "ink_defs.h"
+
+#if HAVE_EDITLINE_READLINE_H
+#include <editline/readline.h>
+#elif HAVE_READLINE_READLINE_H
+#include <readline/readline.h>
+#if HAVE_READLINE_HISTORY_H
+#include <readline/history.h>
+#endif
+#endif
+
+
+Tcl_Interp *interp;
+extern Tcl_HashTable CommandHashtable;
+
+int
+Tcl_AppInit(Tcl_Interp * app_interp)
+{
+ /*
+ * Intialize the Tcl interpreter.
+ */
+ if (Tcl_Init(app_interp) == TCL_ERROR)
+ return TCL_ERROR;
+
+ interp = app_interp;
+
+#ifdef TCL_MEM_DEBUG
+ Tcl_InitMemory(interp);
+#endif
+
+ cliCreateCommandHashtable();
+
+ // root users are automatically enabled
+ if (getuid() == 0) {
+ enable_restricted_commands = true;
+ }
+
+
+ if (CliCreateCommands() != CLI_OK)
+ return CMD_ERROR;
+
+ Tcl_SetVar(interp, "tcl_rcFileName", "~/.tshellstartup", TCL_GLOBAL_ONLY);
+
+/* Evaluating a application specific tcl script After creating
+ all the commands and sourcing the statup file */
+/* Always this should be at the end of this function. */
+ /*
+ * Parse command-line arguments. A leading "-file" argument is
+ * ignored (a historical relic from the distant past). If the
+ * next argument doesn't start with a "-" then strip it off and
+ * use it as the name of a script file to process.
+ */
+
+ const char *fileName = Tcl_GetVar(interp, "argv", TCL_LEAVE_ERR_MSG);
+ /*
+ * Invoke the script specified on the command line, if any.
+ */
+
+ if (fileName[0] != '\0') {
+ int listArgc;
+ const char **listArgv;
+
+ if (Tcl_SplitList(interp, fileName, &listArgc, &listArgv) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ int length = strlen(listArgv[0]);
+ if ((length >= 2) && (strncmp(listArgv[0], "-file", length) == 0)) {
+ for (int index = 1; index < listArgc; index++) {
+ Tcl_ResetResult(interp);
+ if (Tcl_EvalFile(interp, listArgv[index]) != TCL_OK) {
+ Tcl_AddErrorInfo(interp, "");
+ Tcl_DeleteInterp(interp);
+ Tcl_Exit(1);
+ }
+ }
+ }
+ ckfree((char *) listArgv);
+ }
+
+ Tcl_ResetResult(interp);
+
+ return TCL_OK;
+}
+
+#if HAVE_LIBREADLINE
+
+// TCL main read, eval, print loop. We don't use Tcl_Main because we want to
+// use readline to get line editing and command history.
+void Tcl_ReadlineMain(void)
+{
+ char * line;
+
+ for (;;) {
+ line = readline("trafficserver> ");
+ if (line == NULL) {
+ // Received EOF. Bound this into a TCL exit command just like Tcl_Main
+ // does.
+ Tcl_Eval(interp, "exit;");
+ }
+
+ if (*line) {
+ add_history(line);
+ Tcl_Eval(interp, line);
+ }
+
+ free(line);
+ }
+
+ exit(0);
+}
+
+#endif // HAVE_LIBREADLINE
+
+// vim: set ts=2 sw=2 et :
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/775ad1dc/cmd/traffic_shell/cliParseArg.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_shell/cliParseArg.cc b/cmd/traffic_shell/cliParseArg.cc
new file mode 100644
index 0000000..72e6039
--- /dev/null
+++ b/cmd/traffic_shell/cliParseArg.cc
@@ -0,0 +1,457 @@
+/** @file
+
+ contains the implementation for parsing CLI arguments
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ @section Description
+ cliParseArgument(int argc,char **argv,cli_ArgvInfo *argTable)
+ compares the given arguments with the expected arguments and
+ returns error if they are not same
+ If arguments are are valid it converts string arguments to the proper type
+ */
+
+#include <tcl.h>
+#include <string.h>
+#include <stdlib.h>
+#include "createArgument.h"
+#include "definitions.h"
+#include "CliDisplay.h"
+#include "ink_string.h"
+#include "ink_defs.h"
+
+int checkintrange(char *range, int value);
+int checkfloatrange(char *range, float value);
+char **findRequired(cli_ArgvInfo * argtable);
+extern Tcl_Interp *interp;
+
+/*
+ * Forward declarations for procedures defined in this file:
+ */
+static void PrintUsage _ANSI_ARGS_((Tcl_Interp * interp, cli_CommandInfo * commandinfo));
+
+
+
+int
+cliParseArgument(int argc, const char **argv, cli_CommandInfo * commandInfo)
+{
+ cli_ArgvInfo *infoPtr, *prevMatchPtr = NULL, *prevPtr = NULL;
+ cli_parsedArgInfo *parsedInfoPtr, *prev_parsedInfoPtr = NULL;
+ int srcIndex = 1;
+ bool gotMatch = false, gotInt = false;
+ int missing = 0;
+ int length, i;
+ char curArg[256], buf[256];
+ char *endPtr;
+ bool got_required;
+ cli_ArgvInfo *argTable = commandInfo->argtable;
+ char **reqd_args = commandInfo->reqd_args;
+ cli_parsedArgInfo *parsedArgTable = commandInfo->parsedArgTable;
+
+
+
+ argc--; /*first argument is command name */
+
+
+/* Special option for help handled here, No need to create an -help */
+ /* I assume that the first thing will always start with - */
+
+ if (argc == 1) {
+ length = strlen(argv[1]);
+ if ((length >= 2) && ((strncmp(argv[1], "-help", length) == 0) || (strncmp(argv[1], "-h", length) == 0))) {
+ PrintUsage(interp, commandInfo);
+ return TCL_OK;
+ } else if (strcmp(argv[1], "----") == 0) {
+ /* Special case with readline options */
+ /* Readline always sends "----" */
+ return TCL_OK;
+ }
+ }
+
+
+ /* check for required arguments */
+ if (reqd_args != (char **) NULL) {
+ missing = 0;
+ for (i = 0; reqd_args[i] != NULL; i++) {
+ got_required = false;
+ srcIndex = 1;
+ while (srcIndex <= argc) {
+ if (!strcmp(reqd_args[i], argv[srcIndex])) {
+ got_required = true;
+ break;
+ }
+ srcIndex++;
+ }
+ if (got_required == false) {
+ missing++;
+ if (missing == 1)
+ Tcl_AppendResult(interp, reqd_args[i], (char *) NULL);
+ else
+ Tcl_AppendResult(interp, " , ", reqd_args[i], (char *) NULL);
+ }
+ }
+
+ if (missing == 1) {
+ Tcl_AppendResult(interp, " is required ", (char *) NULL);
+ return TCL_ERROR;
+ } else if (missing > 1) {
+ Tcl_AppendResult(interp, " are required ", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ }
+/* Initialise Parsed Argtable */
+ for (i = 0; i < 100; i++) {
+ parsedArgTable[i].parsed_args = CLI_PARSED_ARGV_DATA;
+ parsedArgTable[i].arg_float = CLI_DEFAULT_INT_OR_FLOAT_VALUE;
+ parsedArgTable[i].arg_int = CLI_DEFAULT_INT_OR_FLOAT_VALUE;
+
+ if (parsedArgTable[i].data && (parsedArgTable[i].data != (char *) NULL)) {
+ ats_free(parsedArgTable[i].data);
+ parsedArgTable[i].data = (char *) NULL;
+
+ }
+ if (parsedArgTable[i].arg_string && parsedArgTable[i].arg_string != (char *) NULL) {
+ ats_free(parsedArgTable[i].arg_string);
+ parsedArgTable[i].arg_string = (char *) NULL;
+ }
+ }
+
+/* Error checking for commandline arguments based on createargument options */
+ parsedInfoPtr = parsedArgTable;
+ srcIndex = 1;
+ while (argc > 0) {
+ ink_strlcpy(curArg, argv[srcIndex], sizeof(curArg));
+ argc--;
+ srcIndex++;
+ length = strlen(curArg);
+ gotMatch = false;
+ for (infoPtr = argTable; (infoPtr->key != NULL); infoPtr++) {
+ if (!strcmp(infoPtr->key, curArg)) {
+ gotMatch = true;
+ if (infoPtr->position != CLI_ARGV_NO_POS) { /* Don't do position checking for
+ CLI_ARGV_NO_POS */
+ /* check if the 1st position argument comes at 1st position */
+ if ((infoPtr->position == CLI_PARENT_ARGV) && (srcIndex - 1) != 1) {
+ Tcl_AppendResult(interp, "\"", curArg, "\" is at wrong place Try ", argv[0], " -help", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ if (infoPtr->position != CLI_PARENT_ARGV) {
+ if ((srcIndex - 1) == 1) {
+ Tcl_AppendResult(interp, "\"", curArg, "\" is at wrong place Try ", argv[0], " -help", (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ if (prevMatchPtr != NULL) {
+ if (prevMatchPtr->arg_ref != infoPtr->position) {
+ Tcl_AppendResult(interp, "\"", curArg, "\" is at wrong place Try ", argv[0], " -help", (char *) NULL);
+ return TCL_ERROR;
+ }
+ }
+
+ }
+ }
+ }
+
+ if (prevMatchPtr != NULL && prevPtr == prevMatchPtr) {
+ if (prevMatchPtr->type == CLI_ARGV_OPTION_NAME_VALUE) {
+ if (prev_parsedInfoPtr->arg_string) {
+ ats_free(prev_parsedInfoPtr->arg_string);
+ prev_parsedInfoPtr->arg_string = NULL;
+ }
+ }
+ }
+
+ parsedInfoPtr->arg_usage = infoPtr->help;
+
+ /* Position checking over check for type */
+
+ switch (infoPtr->type) {
+ case CLI_ARGV_CONSTANT:
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ if (argc != 0) {
+ snprintf(buf, sizeof(buf), "Too many arguments Try %s -help", argv[0]);
+ Tcl_AppendResult(interp, buf, (char *) NULL);
+ return TCL_ERROR;
+ }
+ break;
+ case CLI_ARGV_INT:
+ if (argc <= 0) {
+ Tcl_AppendResult(interp, "\"", curArg, "\" option requires an additional integer argument", "\n",
+ infoPtr->help, (char *) NULL);
+ return TCL_ERROR;
+ }
+ parsedInfoPtr->arg_int = strtol(argv[srcIndex], &endPtr, 0);
+ if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
+ Tcl_AppendResult(interp, infoPtr->key, " requires integer argument ", "\n", infoPtr->help, (char *) NULL);
+ return TCL_ERROR;
+ }
+ if (infoPtr->range_set == true) {
+ if (parsedInfoPtr->arg_int < infoPtr->l_range.int_r1 || parsedInfoPtr->arg_int > infoPtr->u_range.int_r2) {
+ snprintf(buf, sizeof(buf), "value of %s is out of range %d - %d", infoPtr->key, infoPtr->l_range.int_r1,
+ infoPtr->u_range.int_r2);
+
+ Tcl_AppendResult(interp, buf, (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ }
+ srcIndex++;
+ argc--;
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ break;
+
+ case CLI_ARGV_OPTION_INT_VALUE:
+ gotInt = 0;
+ if (argc > 0) {
+ parsedInfoPtr->arg_int = strtol(argv[srcIndex], &endPtr, 0);
+ if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
+ parsedInfoPtr->arg_int = CLI_DEFAULT_INT_OR_FLOAT_VALUE;
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ break;
+ }
+ gotInt = 1;
+ if (infoPtr->range_set == true) {
+ if (parsedInfoPtr->arg_int < infoPtr->l_range.int_r1 || parsedInfoPtr->arg_int > infoPtr->u_range.int_r2) {
+ snprintf(buf, sizeof(buf), "value of %s is out of range %d - %d", infoPtr->key, infoPtr->l_range.int_r1,
+ infoPtr->u_range.int_r2);
+
+ Tcl_AppendResult(interp, buf, (char *) NULL);
+ return TCL_ERROR;
+ }
+ }
+ srcIndex++;
+ argc--;
+ }
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ break;
+
+ case CLI_ARGV_STRING:
+ if (argc <= 0) {
+ Tcl_AppendResult(interp, "\"", curArg, "\" option requires an additional argument", (char *) NULL);
+ return TCL_ERROR;
+ }
+ parsedInfoPtr->arg_string = ats_strdup(argv[srcIndex]);
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ srcIndex++;
+ argc--;
+ break;
+ case CLI_ARGV_OPTION_NAME_VALUE:
+ if (argc > 0) {
+ parsedInfoPtr->arg_string = ats_strdup(argv[srcIndex]);
+ }
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ break;
+ case CLI_ARGV_FLOAT:
+ if (argc <= 0) {
+ Tcl_AppendResult(interp, "\"", curArg, "\" option requires an additional floating-point argument",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ // Solaris is messed up, in that strtod() does not honor C99/SUSv3 mode.
+ parsedInfoPtr->arg_float = strtold(argv[srcIndex], &endPtr);
+ if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
+ Tcl_AppendResult(interp, infoPtr->key, " requires floating-point argument",
+ "\n", infoPtr->help, (char *) NULL);
+ return TCL_ERROR;
+ }
+ if (infoPtr->range_set == true) {
+ if (parsedInfoPtr->arg_float < infoPtr->l_range.float_r1 ||
+ parsedInfoPtr->arg_float > infoPtr->u_range.float_r2) {
+ snprintf(buf, sizeof(buf), "value of %s out of range %f - %f", infoPtr->key, infoPtr->l_range.float_r1,
+ infoPtr->u_range.float_r2);
+ Tcl_AppendResult(interp, buf, (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ }
+ srcIndex++;
+ argc--;
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ break;
+
+ case CLI_ARGV_OPTION_FLOAT_VALUE:
+ if (argc > 0) {
+ parsedInfoPtr->arg_float = strtold(argv[srcIndex], &endPtr);
+ if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
+ parsedInfoPtr->arg_float = CLI_DEFAULT_INT_OR_FLOAT_VALUE;
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ break;
+ }
+ if (infoPtr->range_set == true) {
+ if (parsedInfoPtr->arg_float < infoPtr->l_range.float_r1 ||
+ parsedInfoPtr->arg_float > infoPtr->u_range.float_r2) {
+ snprintf(buf, sizeof(buf), "value of %s out of range %f - %f", infoPtr->key, infoPtr->l_range.float_r1,
+ infoPtr->u_range.float_r2);
+ Tcl_AppendResult(interp, buf, (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ }
+ srcIndex++;
+ argc--;
+ }
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ break;
+
+ case CLI_ARGV_FUNC:
+ break;
+
+ case CLI_ARGV_CONST_OPTION:
+
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ break;
+ default:
+ parsedInfoPtr->parsed_args = infoPtr->arg_ref;
+ break;
+
+
+ }
+ prevMatchPtr = infoPtr;
+ }
+ if (gotMatch == true)
+ break;
+
+ }
+ if (gotMatch == false) {
+ if (prevMatchPtr != NULL) {
+ /*if prev argument is of type CLI_ARGV_CONST_OPTION then this has to be valid
+ argument so return error */
+ if (prevMatchPtr->type == CLI_ARGV_CONST_OPTION) {
+ snprintf(buf, sizeof(buf), "unrecognized argument %s\n %s", curArg, prevMatchPtr->help);
+ Tcl_AppendResult(interp, buf, (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ if ((prevPtr == prevMatchPtr) && (prevMatchPtr->type == CLI_ARGV_OPTION_FLOAT_VALUE)) {
+ Tcl_AppendResult(interp, prevMatchPtr->key, " requires floating point argument", "\n", prevMatchPtr->help,
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ if ((prevPtr == prevMatchPtr) && (prevMatchPtr->type == CLI_ARGV_OPTION_INT_VALUE)) {
+ if (gotInt == 0) {
+ Tcl_AppendResult(interp, prevMatchPtr->key, " requires integer argument", "\n", prevMatchPtr->help,
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+ }
+
+
+ if (prevMatchPtr->type != CLI_ARGV_OPTION_NAME_VALUE) {
+ parsedInfoPtr->data = ats_strdup(curArg);
+ parsedInfoPtr->parsed_args = CLI_PARSED_ARGV_DATA;
+ } else
+ parsedInfoPtr--;
+
+ } else {
+ parsedInfoPtr->data = ats_strdup(curArg);
+ parsedInfoPtr->parsed_args = CLI_PARSED_ARGV_DATA;
+ }
+ }
+ prev_parsedInfoPtr = parsedInfoPtr;
+ parsedInfoPtr++;
+ prevPtr = infoPtr;
+
+ }
+ parsedInfoPtr->parsed_args = CLI_PARSED_ARGV_END;
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * PrintUsage --
+ *
+ * Generate a help string describing command-line options.
+ *
+ * Results:
+ * The interp's result will be modified to hold a help string
+ * describing all the options in argTable, plus all those
+ * in the default table unless CLI_ARGV_NO_DEFAULTS is
+ * specified in flags.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+static void
+PrintUsage(Tcl_Interp * /* interp ATS_UNUSED */, cli_CommandInfo * commandInfo)
+{
+ cli_ArgvInfo *infoPtr;
+ cli_ArgvInfo *argTable = commandInfo->argtable;
+ int width, numSpaces;
+
+ /*
+ * First, compute the width of the widest option key, so that we
+ * can make everything line up.
+ */
+ width = 4;
+ char *cmdHelpString = commandInfo->helpString;
+ int length = strlen(commandInfo->command_name);
+
+ if (length > width) {
+ width = length;
+ }
+
+ /* Now for arguments */
+
+ for (infoPtr = argTable; infoPtr->key != NULL; infoPtr++) {
+ length = strlen(infoPtr->key);
+ if (length > width) {
+ width = length;
+ }
+ }
+
+ // display command name
+ Cli_Printf("\n%s", commandInfo->command_name);
+ numSpaces = width + 1 - strlen(commandInfo->command_name);
+
+ while (numSpaces > 0) {
+ Cli_Printf(" ");
+ numSpaces--;
+ }
+
+ // display command help string
+ Cli_Printf(" %s", cmdHelpString);
+
+ for (infoPtr = argTable; infoPtr->key != NULL; infoPtr++) {
+ if (infoPtr->position >= 100) {
+ Cli_Printf("\n ");
+ } else {
+ Cli_Printf("\n ");
+ }
+
+ // display option name
+ Cli_Printf("%s", infoPtr->key);
+ numSpaces = width + 1 - strlen(infoPtr->key);
+
+ while (numSpaces > 0) {
+ Cli_Printf(" ");
+ numSpaces--;
+ }
+ // display option parameters
+ Cli_Printf(" %s", infoPtr->help);
+ }
+
+ Cli_Printf("\n\n");
+}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/775ad1dc/cmd/traffic_shell/cli_detailed_command_list.txt
----------------------------------------------------------------------
diff --git a/cmd/traffic_shell/cli_detailed_command_list.txt b/cmd/traffic_shell/cli_detailed_command_list.txt
new file mode 100644
index 0000000..54b2776
--- /dev/null
+++ b/cmd/traffic_shell/cli_detailed_command_list.txt
@@ -0,0 +1,1623 @@
+FEATURE INTRODUCTION
+
+Feature name:
+
+ traffic_shell
+
+Synopsis of Feature:
+
+ traffic_shell is a true "command line interface." It accepts
+commands in a unix shell-like fashion. traffic_shell supports command
+completion, command history, man pages, and context sensitive help.
+Not only is this type of interface more familiar to network engineers
+everywhere, but it is also easier to document, maintain, and extend.
+ traffic_shell is TCL-based which simplifies the development of new
+commands. It also supports scripting which means that a user can
+source and execute a file that contains traffic_shell commands.
+ traffic_shell currently provides full configuration and monitoring
+functionality for Traffic Server.
+ traffic_shell is built on the same Management API as the
+Traffic Server WebUI. The Management API (written in C code) handles
+updating config files and restarting TS or reloading config variables
+for changes to take effect.
+
+Configurations of Traffic Server affected:
+
+ Platforms: Linux, Linux for OEMs, Solaris SPARC
+ Configurations: All TS configurations
+
+References on Feature:
+
+ Scroll down to the section of this document titled:
+ COMPLETE COMMAND SET SPECIFICATION
+ This section contains an exhaustive list of all traffic_shell
+ commands, along with a description of syntax and sample output.
+
+ENGINEERING DESCRIPTION
+
+Modes of operation of Feature:
+
+ No special records.config setup is required.
+
+ The CLI supports the following operation modes. Note that a
+ "user" can be a person, a script, or some other mechanism for remote
+ control of network devices via command line interface.
+
+ -- Interactive:
+ "traffic_shell"
+ Similar to unix shell, CLI can be the login shell for administrators.
+ User types command at a prompt.
+ CLI processes command and displays the result.
+ User can execute a file which contains a list of commands.
+
+ -- Execute file:
+ "traffic_shell -f filename" where file contains a list of CLI commands.
+ CLI runs commands and sends results to stdout.
+
+ When entered at the Unix shell prompt, the "traffic_shell -f
+filename" command starts traffic_shell and runs a TCL script
+"filename" which typically contains traffic_shell commands. Since
+traffic_shell is a TCL interpreter, the script can also contain any
+valid combination of TCL constructs. If the TCL interpreter
+encounters the "exit" keyword, then control returns to the shell from
+which the user typed "traffic_shell -f <filename>". If the
+interpreter reaches the end of script execution without encountering
+"exit", then the traffic_shell prompt appears and the user can
+continue to use traffic_shell interactively.
+
+Risk points of feature:
+
+ Certain configuration changes force a reset of Traffic
+ Server. These restarts are performed by functions in the
+ Management API.
+
+Effect on SDK/API:
+
+ None. In the future, traffic_shell may be enhanced to provide
+ configurability of certain plugins.
+
+Module tests, diagnostic output, and statistics on feature
+
+ None.
+
+Engineering description of Feature:
+
+ The CLI is a standalone executable that is part of a Traffic
+ Server installation.
+
+ The CLI is implemented in a combination of TCL and C++. The
+ shell and parsing functionality uses TCL. Commands themselves are
+ typically written in C++. The CLI uses the traffic_manager Management
+ API to make Traffic Server configuration changes.
+
+ The overall CLI architecture is as follows:
+
+ - traffic_shell ---------------------------
+ | |
+ | --------------------------------------- |
+ | Shell and parser implemented in TCL/C++ |
+ | --------------------------------------- |
+ | ^ |
+ | ----------------|------------------- |
+ | CLI commands implemented in C++ (.a) |
+ | ------------------------------------ |
+ | ^ |
+ | --------|---------- |
+ | Management API (.a) |
+ | ------------------- |
+ | |
+ -------------------------------------------
+
+Notes and comments by developing engineer:
+
+ None.
+
+TESTS DESCRIPTIONS
+
+Test description:
+
+ QA developed expect scripts for each traffic_shell command to
+ simulate commands from user level, and also to check the output
+ of CLI.
+
+ Each script covers one command along with all of its
+ sub-commands and arguments.
+
+ Each Config Command script has a flow as follows:
+ - Valid test:
+ . Send valid syntax command to CLI.
+ . Check the value of affected variable from either the CLI or
+ from traffic_line -r <variable>.
+ . Set errors if the output of CLI does not match expected result.
+ - Negative test:
+ . Send commands with invalid arguments to CLI.
+ . CLI should handled unregconized arguments gracefully.
+ . Set error if CLI does not handle invalid arguments correctly.
+
+ Same logic flow for Show commands.
+
+
+ To run the test scripts:
+ ----------------------------
+ There are two files:
+ cli-config-tests.tar for config commands.
+ cli-show-tests.tar for show commands.
+
+Copy these files into a "cli" subdirectory of the traffic_server "bin"
+directory, and untar them. Start traffic_server and run scripts
+within cli directory.
+
+- For Config, run cli-test.exp + <individual test>
+
+ For example:
+ cli% ./cli-test.exp config-name
+ This will test config:name command
+
+- For Show, run show-test.exp + <individual test>
+
+Test development notes:
+
+- These scripts are by no means complete. Anyone can add more testcases
+in by copying/modifying existing testcases. These tests are pretty primitive
+for now.
+
+- When running tests, please make sure you enlarge your terminal as large as
+possible to accomodate the CLI output. The EOL character might affect string
+comparision in expect.
+
+- Some of variables are set to random values. So please be sure to save your
+config directory or install new traffic server after you complete CLI test :-)
+This will be make better in the future.
+
+*******************************************************
+COMPLETE COMMAND SET SPECIFICATION
+*******************************************************
+
+
+
+traffic_shell command set specification
+
+NOTE: This document does not distinguish phase-1 commands and functionality.
+
+There may be some inconsistencies between the command descriptions and the
+actual implementation. In particular, column alignment is not exactly specified
+in this document. Also, the values below are for example purposes only.
+
+==============
+CLI Features
+==============
+
+ 1) CLI supports command completion i.e if the user types first one
+ or two characters of a valid command and presses tab key it completes
+ the command.
+
+ 2) CLI supports command abbreviation i.e if user types first one or two
+ characters of a valid command and presses enter CLI will display all
+ the commands whic start with the abbreviation typed by user If there
+ is only one command matching the command abbreviation CLI directly
+ executes the command.
+
+ 3) CLI supports history command which shows the history of previously
+ typed commands.
+
+ 4) CLI supports up and down arrow keys to see through previous
+ commands.
+
+ 5) All CLI commands can be classified in two catogories Show commands
+ and Config commands. Show Commands display system information. Show
+ Commands can be executed in normal mode. A list of possible show
+ commands described below can be seen by just typing show on command
+ line.
+
+ 6) Config commands let the user configure or set system information
+ and settings Config commands can be executed in privileged mode
+ enabled by admin password. A list of possible config commands
+ described below can be seen by just typing config on command line.
+
+
+================
+Command Overview
+================
+
+Normal mode commands
+ % prompt
+----------------------------
+
+enable Enable privileged commands
+ Prompt for password. Password can be blank.
+ syntax: enable
+ args: none
+
+ ts> enable
+ Password: (no characters displayed)
+ ts#
+
+exit Exit CLI
+ syntax: exit
+ args: none
+
+ ts> exit
+
+help Help
+ Display list of commands with one line description.
+ Or display help for a particular subcommand.
+ syntax: help [ subcommand ]
+ args: subcommand (optional)
+
+show Show system information
+
+ See "Show Command" below for list of subcommands.
+ syntax: show:< show-sub-command >
+ args: show-sub-command = optional subcommand
+ behavior: If show-sub-command is ommitted, then display the list of
+ possible show-sub-commands.
+
+Enable mode commands
+ includes all Normal mode commands
+ # prompt
+----------------------------
+
+config Enter configuration mode
+ See "Configure Command" below for list of subcommands.
+ syntax: config:< config-sub-command >
+ args: config-sub-command = optional subcommand
+ behavior: If config-sub-command is ommitted, then display the list of
+ possible config-sub-commands.
+
+disable Disable privileged commands
+ No parameters. Puts CLI back into Normal Mode.
+ syntax: disable
+ args: none
+ behavior: Switch to Normal Mode.
+
+ ts# disable
+ ts>
+
+exit Exit CLI
+ syntax: exit
+ args: none
+
+help Help
+ Same as Normal Mode but includes Configure Command.
+ Display list of commands with one line description.
+ Or display help for a particular subcommand.
+ syntax: help [ subcommand ]
+ args: subcommand (optional)
+
+show Show system information
+ Same as Normal Mode but includes privileged commands.
+ See "Show Command" below for list of subcommands.
+ syntax: show:< show-sub-command >
+ args: show-sub-command = optional subcommand
+ behavior: If show-sub-command is ommitted, then display the list of
+ possible show-sub-commands.
+
+
+Show command
+------------
+Parameter Description
+-----------------------------------
+status Proxy status on/off
+ syntax: show:status
+ args: none
+ behavior: Display status as follows:
+
+ ts> show:status
+ Proxy -- on
+ ts>
+
+ implementation: Determine whether proxy is up and running.
+
+version Traffic Server and Traffic Manager version
+ syntax: show:version
+ args: none
+ behavior: Display Traffic_Server and Traffic Manager version number as follows:
+
+ ts> show:version
+ traffic_server version --- 5.0.0
+ traffic_manager version -- 5.0.0
+ ts>
+
+security Security Configuration (only in Enable Mode)
+ (TS IP allow, MGMT allow, Login allow)
+
+ syntax: show:security
+ args: none
+ behavior: Display IP address access lists for TS, MGMT, and login.
+
+ ts> show:security
+
+ Traffic Server Access
+ (ip_allow.config contents)
+
+ ts>
+
+ implementation:
+ Traffic Server Access specified in ip_allow.config (use MGMT API)
+
+cluster Cluster Configuration
+
+ syntax: show:cluster
+ args: none
+ behavior: Display cluster port
+
+ ts> show:cluster
+
+ Cluster Port ----------- 14988 (proxy.config.cluster.cluster_port)
+ Cluster RS Port -------- 14990 (proxy.config.cluster.rsport)
+ Cluster MC Port -------- 14991 (proxy.config.cluster.mcport)
+
+http HTTP Configuration
+ (timeout values, headers, authorization)
+
+ syntax: show:http
+ args: none
+ behavior: Display HTTP Configuration
+
+ ts> show:http
+ HTTP Caching ------------------ on (proxy.config.http.cache.http)
+ HTTP Server Port -------------- 14980 (proxy.config.http.server_port)
+
+ Keep-Alive Timeout Inbound ---- 10 s (proxy.config.http.keep_alive_no_activity_timeout_in)
+ Keep-Alive Timeout Outbound --- 10 s (proxy.config.http.keep_alive_no_activity_timeout_out)
+ Inactivity Timeout Inbound ---- 120 s (proxy.config.http.transaction_no_activity_timeout_in)
+ Inactivity Timeout Outbound --- 120 s (proxy.config.http.transaction_no_activity_timeout_out)
+ Activity Timeout Inbound ------ 7200 s (proxy.config.http.transaction_active_timeout_in)
+ Activity Timeout Outbound ----- 7200 s (proxy.config.http.transaction_active_timeout_out)
+ Maximum Number of Alternates -- 3 (proxy.config.cache.limits.http.max_alts)
+ Remove the following common headers
+ From (proxy.config.http.anonymize_remove_from)
+ Referer (proxy.config.http.anonymize_remove_referer)
+ User-Agent (proxy.config.http.anonymize_remove_user_agent)
+ Cookie (proxy.config.http.anonymize_remove_cookie)
+ Remove additional headers
+ list (proxy.config.http.anonymize_other_header_list)
+ Insert or Remove Client IP address
+ Insert (proxy.config.http.anonymize_insert_client_ip)
+ Remove (proxy.config.http.anonymize_remove_client_ip)
+ ts>
+
+icp ICP Configuration
+ (on/off, rules, port, timeouts)
+ syntax: show:icp [ peers ]
+ args: optional "peers" argument
+ behavior: Display ICP Configuration
+
+ ts> show:icp
+ ICP Mode --------------- off (proxy.config.icp.enabled)
+ ICP Port --------------- 3130 (proxy.config.icp.icp_port)
+ ICP Multicast Enabled -- off (proxy.config.icp.multicast_enabled)
+ ICP Query Timeout ------ 2 s (proxy.config.icp.query_timeout)
+ ts>
+
+ ts> show:icp peers
+ icp.config rules
+ ----------------
+ (Display rules from icp.config)
+ ts>
+
+proxy Proxy Configuration
+
+ syntax: show:proxy
+ args: none
+ behavior: Display basic proxy configuration
+
+ ts> show:proxy
+ Name -- foo (proxy.config.proxy_name)
+ ts>
+
+cache Cache Configuration
+ (active protocols, bypass, storage, freshness,
+ expires, variable content, rules)
+ syntax: show:cache [ rules | storage ]
+ args: optional "rules" or "storage"
+
+ ts> show:cache
+ HTTP Caching ------------------- on (proxy.config.http.cache.http)
+ Ignore User Requests To Bypass Cluster --- off (proxy.config.http.cache.cluster_cache_local)
+ Ignore User Requests To Bypass Cache --- off (proxy.config.http.cache.ignore_client_no_cache)
+ Maximum HTTP Object Size --- NONE (proxy.config.cache.max_doc_size)
+
+ Freshness
+ Verify Freshness By Checking -- (proxy.config.http.cache.when_to_revalidate)
+ When the object has expired
+ Minimum freshness information for a document to be cacheable -- (proxy.config.http.cache.required_headers)
+ Nothing
+ If object has no expiration date:
+ leave it in cache for at least ---- 3600 s (proxy.config.http.cache.heuristic_min_lifetime)
+ but no more than ------------------ 86400 s (proxy.config.http.cache.heuristic_max_lifetime)
+
+ Variable Content
+ Do not cache responses to URLs that contain "?", ";", "cgi" or end in ".asp" (proxy.config.http.cache.cache_urls_that_look_dynamic value)
+ Alternates ------------ on (proxy.config.http.cache.enable_default_vary_headers)
+ Vary on HTTP Header Fields:
+ Text ---------------- Cookie (proxy.config.http.cache.vary_default_text)
+ Images -------------- NULL (proxy.config.http.cache.vary_default_images)
+ Other --------------- NULL (proxy.config.http.cache.vary_default_other)
+ Cache responses to requests containing cookies for: (proxy.config.http.cache.cache_responses_to_cookies)
+ content-types which are not text
+ ts>
+
+ ts> show:cache rules
+ Display rules from cache.config
+ ts>
+
+ ts> show:cache storage
+ Display rules from storage.config
+ ts>
+
+virtual-ip Virtual IP Address Configuration
+ syntax: show:virtual-ip
+ args: none
+ behavior: Display virtual IP configuration
+
+
+ ts_shell>show:virtual-ip
+
+ 2 Elements in Record
+
+ 0 1.1.1.1 23 23
+ 1 1.1.1.1 23 24
+
+ ts>
+
+
+hostdb Host Database Configuration
+ syntax: show:hostdb
+ args: none
+ behavior: Display Host DB Configuration
+
+ ts> show:hostdb
+ Lookup Timeout ----------- 120 s (proxy.config.hostdb.lookup_timeout)
+ Foreground Timeout ------- 1440 s (proxy.config.hostdb.timeout)
+ Background Timeout ------- 720 s (proxy.config.hostdb.verify_after)
+ Invalid Host Timeout ----- 0 s (proxy.config.hostdb.fail.timeout)
+ Re-DNS on Reload --------- off (proxy.config.hostdb.re_dns_on_reload)
+ Resolve Attempt Timeout -- 20 s (proxy.config.dns.lookup_timeout)
+ Number of Retries -------- 5 (proxy.config.dns.retries)
+ ts>
+
+dns-resolver DNS Resolver Configuration
+ syntax: show:dns-resolver
+ args: none
+ behavior: Display DNS Resolver Configuration
+
+ ts> show:dns-resolver
+ Local Domain Expansion -- on (proxy.config.dns.search_default_domains)
+ .com Domain Expansion --- on (proxy.config.http.enable_url_expandomatic)
+ ts>
+
+logging Logging Configuration
+ syntax: show:logging
+ args: none
+ behavior: Display Logging Configuration
+
+ ts> show:logging
+ Logging Mode ------------- xxx (proxy.config.log.logging_enabled)
+
+ Management
+ Log Space Limit -------- 2000 MB (proxy.config.log.max_space_mb_for_logs)
+ Log Space Headroom ----- 10 MB (proxy.config.log.max_space_mb_headroom)
+
+ Log Collation ------------ off (proxy.local.log.collation_mode)
+ Host ------------------- NULL (proxy.config.log.collation_host)
+ Port ------------------- 8085 (proxy.config.log.collation_port)
+ Secret ----------------- foobar (proxy.config.log.collation_secret)
+ Host Tagged ------------ off (proxy.config.log.collation_host_tagged)
+ Space Limit for Orphan Files -- 25 MB (proxy.config.log.max_space_mb_for_orphan_logs)
+
+ Squid Format ---- on (proxy.config.log.squid_log_enabled)
+ File Type ----- ASCII (proxy.config.log.squid_log_is_ascii)
+ File Name ----- squid (proxy.config.log.squid_log_name)
+ File Header --- NULL (proxy.config.log.squid_log_header)
+
+ Netscape Common -- off (proxy.config.log.common_log_enabled)
+ File Type ------ ASCII (proxy.config.log.common_log_is_ascii)
+ File Name ------ common (proxy.config.log.common_log_name)
+ File Header ---- NULL (proxy.config.log.common_log_header)
+
+ Netscape Extended -- off (proxy.config.log.extended_log_enabled)
+ File Type -------- ASCII (proxy.config.log.extended_log_is_ascii)
+ File Name -------- extended (proxy.config.log.extended_log_name)
+ File Header ------ NULL (proxy.config.log.extended_log_header)
+
+ Netscape Extended2 -- off (proxy.config.log.extended2_log_enabled)
+ File Type --------- ASCII (proxy.config.log.extended2_log_is_ascii)
+ File Name --------- extended2 (proxy.config.log.extended2_log_name)
+ File Header ------- NULL (proxy.config.log.extended2_log_header)
+
+ Splitting
+ ICP Log Splitting -- off (proxy.config.log.separate_icp_logs)
+ HTTP Host Log Splitting -- off (proxy.config.log.separate_host_logs)
+
+ Custom Logs -- off (proxy.config.log.custom_logs_enabled)
+
+ Rolling -------- on (proxy.config.log.rolling_enabled)
+ Roll Offset Hour --- 0 (proxy.config.log.rolling_offset_hr)
+ Roll Interval ------ 86400 s (proxy.config.log.rolling_interval_sec)
+ Auto-delete rolled files when space is low -- on (proxy.config.log.auto_delete_rolled_files)
+ ts>
+
+ssl SSL Ports
+ syntax: show:ssl
+ args: none
+ behavior: Display SSL Port related configuration.
+
+ ts> show:ssl
+ Restrict CONNECT connections to Ports -- 443 563 (proxy.config.http.connect_ports)
+ ts>
+
+parent Parent Configuration
+ (on/off, parents, rules)
+ syntax: show:parent
+ args: none
+ behavior: Display Parent Configuration.
+
+ ts> show:parent
+ Parent Caching: OFF (proxy.config.http.parent_proxy_routing_enable)
+ Parent Cache: NONE (proxy.config.http.parent_proxies)
+ ts>
+
+ syntax: show:parent rules
+ behavior: Display Parent configuration rules file.
+
+ ts> show:parent rules
+ parent.config rules
+ -------------------
+ Display rules from parent.config
+ ts>
+
+remap Remap Rules
+ syntax: show:remap
+ args: none
+ behavior: Display remap configuration.
+
+ ts> show:remap
+ remap.config rules
+ ------------------
+ (Display rules from remap.config)
+ ts>
+
+socks SOCKS Configuration
+ (on/off, stats)
+ syntax: show:socks [ rules ]
+ args: none
+ behavior: Display SOCKS Configuration.
+
+ ts> show:socks
+ SOCKS -------------------- off (proxy.config.socks.socks_needed)
+ SOCKS Default Servers ---- x.x.x.x (proxy.config.socks.default_servers)
+ SOCKS Accept Port -------- 1080 (proxy.config.socks.accept_port)
+ SOCKS HTTP Port ---------- 80 (proxy.config.socks.http_port)
+ SOCKS Timeout ------------ 100 s (proxy.config.socks.socks_timeout)
+ ts>
+
+ ts> show:socks rules
+ socks.config rules
+ ------------------
+ (Display socks.config rules)
+ ts>
+
+port-tunnels Port Tunnelling Configuration
+
+ syntax: show:port-tunnels
+
+ ts# show:port-tunnels
+
+ server-other-ports -- 7890
+
+ To view the corresponding rule of the remap.config file in the following format
+ map tunnel://<proxy_ip>:<port_num>/tunnel://<dest_server>:<dest_port>
+ Use show:remap
+
+scheduled-update Scheduled Update Configuration
+ syntax: show:scheduled-update [ rules ]
+ args: show update.config file
+ behavior: Display Scheduled Update Configuration.
+
+ ts> show:scheduled-update
+ Scheduled Update -------------- on (proxy.config.update.enabled)
+ Update Error Retry Count ------ 10 (proxy.config.update.retry_count)
+ Update Error Retry Interval --- 2 s (proxy.config.update.retry_interval)
+ Maximum Concurrent Updates ---- 100 (proxy.config.update.concurrent_updates)
+ Force Immediate Update -------- off (proxy.config.update.force)
+ ts>
+
+ ts> show:scheduled-update rules
+ update.config rules
+ -------------------
+ (Display list of rules from update.config)
+ ts>
+
+
+Status subcommands
+------------------
+Parameter Description
+-----------------------------------
+proxy-stats Proxy Vital Stats
+ oldCLI->root->monitor->node
+ (hit rate, bandwidth savings, open connections)
+ syntax: show:proxy-stats
+ args: none
+ behavior: Display statistics related to the overall proxy.
+
+ ts> show:proxy-stats
+ Document Hit Rate ------------ 0% * (proxy.node.cache_hit_ratio)
+ Bandwidth Savings ------------ 0% * (proxy.node.bandwidth_hit_ratio)
+ Cache Percent Free ----------- 0% (proxy.node.cache.percent_free)
+
+ Open Server Connections ------ 0 (proxy.node.current_server_connections)
+ Open Client Connections ------ 0 (proxy.node.current_client_connections)
+ Cache Transfers In Progress -- 0 (proxy.node.current_cache_connections)
+
+ Client Throughput ------------ 0.00 MBit/Sec (proxy.node.client_throughput_out)
+ Transactions Per Second ------ 0 (proxy.node.user_agent_xacts_per_second)
+
+ * Value represents 10 second average.
+ ts>
+
+http-trans-stats HTTP Transaction Summary
+ (hits, misses, aborts, other)
+ oldCLI->root->monitor->protocols->http-trans
+ syntax: show:http-trans-state
+ args: none
+ behavior: Display statistics related to HTTP transactions.
+
+ ts> show:http-trans-stats
+ HTTP Transaction Frequency and Speeds (proxy.node.http.transaction_*)
+ Transaction Type Frequency Speed (ms)
+ --Hits--
+ Fresh ----------------------- 0% 0 (frac_avg_10s.hit_fresh,
+ msec_avg_10s.hit_fresh)
+ Stale Revalidated ----------- 0% 0 (frac_avg_10s.hit_revalidated,
+ msec_avg_10s.hit_revalidated)
+ --Misses--
+ Now Cached ------------------ 0% 0 (frac_avg_10s.miss_cold,
+ msec_avg_10s.miss_cold)
+ Server No Cache ------------- 0% 0 (frac_avg_10s.miss_not_cacheable,
+ msec_avg_10s.miss_not_cacheable)
+ Stale Reloaded -------------- 0% 0 (frac_avg_10s.miss_changed,
+ msec_avg_10s.miss_changed)
+ Client No Cache ------------- 0% 0 (frac_avg_10s.miss_client_no_cache,
+ msec_avg_10s.miss_client_no_cache)
+ --Errors--
+ Connection Failures --------- 0% 0 (frac_avg_10s.errors.connect_failed,
+ msec_avg_10s.errors.connect_failed)
+ Other Errors ---------------- 0% 0 (frac_avg_10s.errors.other,
+ msec_avg_10s.errors.other)
+ --Aborted Transactions--
+ Client Aborts --------------- 0% 0 (frac_avg_10s.errors.aborts,
+ msec_avg_10s.errors.aborts)
+ Questionable Client Aborts -- 0% 0 (frac_avg_10s.errors.possible_aborts,
+ msec_avg_10s.errors.possible_aborts)
+ Partial Request Hangups ----- 0% 0 (frac_avg_10s.errors.early_hangups,
+ msec_avg_10s.errors.early_hangups)
+ Pre-Request Hangups --------- 0% 0 (frac_avg_10s.errors.empty_hangups,
+ msec_avg_10s.errors.empty_hangups)
+ Pre-Connect Hangups --------- 0% 0 (frac_avg_10s.errors.pre_accept_hangups,
+ msec_avg_10s.errors.pre_accept_hangups)
+ --Other Transactions--
+ Unclassified ---------------- 0% 0 (frac_avg_10s.other.unclassified,
+ msec_avg_10s.other.unclassified)
+ ts>
+
+http-stats HTTP Protocol Summary
+ oldCLI->root->monitor->protocols->http
+ syntax: show:http-stats
+ args: none
+ behavior: Display HTTP Protocol statistics.
+
+ ts> show:http-stats
+ --Client-- (proxy.process.http.*)
+ Total Document Bytes ------ 150.5 MB (user_agent_response_document_total_size)
+ Total Header Bytes -------- 23.5 MB (user_agent_response_header_total_size)
+ Total Connections --------- 0 (current_client_connections)
+ Transactions In Progress -- 0 (current_client_transactions)
+ --Server--
+ Total Document Bytes ------ 150.4 MB (origin_server_response_document_total_size)
+ Total Header Bytes -------- 16.3 MB (origin_server_response_header_total_size)
+ Total Connections --------- 0 (current_server_connections)
+ Transactions In Progress -- 0 (current_server_transactions)
+ ts>
+
+icp-stats ICP Statistics
+ syntax: show:icp-stats
+ args: none
+ behavior: Display ICP statistics.
+
+ ts> show:icp-stats
+ --Queries Originating From This Node-- (proxy.process.icp.*)
+ Query Requests ------------------------------ 0 (icp_query_requests)
+ Query Messages Sent ------------------------- 0 (total_udp_send_queries)
+ Peer Hit Messages Received ------------------ 0 (icp_query_hits)
+ Peer Miss Messages Received ----------------- 0 (icp_query_misses)
+ Total Responses Received -------------------- 0 (icp_remote_responses)
+ Average ICP Message Response Time ----------- 0.00 ms (total_icp_response_time)
+ Average ICP Request Time -------------------- 0.00 ms (total_icp_request_time)
+ --Queries Originating from ICP Peers--
+ Query Messages Received --------------------- 0 (icp_remote_query_requests)
+ Remote Query Hits --------------------------- 0 (cache_lookup_success)
+ Remote Query Misses ------------------------- 0 (cache_lookup_fail)
+ Successful Response Messages Sent to Peers -- 0 (query_response_write)
+ ts>
+
+cache-stats Overall Cache Statistics
+ oldCLI->root->monitor->cache
+ syntax: show:cache-stats
+ args: none
+ behavior: Display overall cache statistics.
+
+ ts> show:cache-stats (proxy.process.cache.*)
+ Bytes Used --- 42.3 GB (bytes_used)
+ Cache Size --- 42.4 GB (bytes_total)
+ --RAM Cache--
+ Bytes -------- 45443072 (ram_cache.bytes)
+ Hits --------- 31339939 (ram_cache.hits)
+ Misses ------- 18382137 (ram_cache.misses)
+ --Lookups--
+ In Progress -- 0 (lookup.active)
+ Hits --------- 0 (lookup.success)
+ Misses ------- 0 (lookup.failure)
+ --Reads--
+ In Progress -- 0 (read.active)
+ Hits --------- 30116923 (read.success)
+ Misses ------- 26817128 (read.failure)
+ --Writes--
+ In Progress -- 1 (write.active)
+ Successes ---- 25354918 (write.success)
+ Failures ----- 75520 (write.failure)
+ --Updates--
+ In Progress -- 0 (update.active)
+ Successes ---- 101888 (update.success)
+ Failures ----- 1753 (update.failure)
+ --Removes--
+ In Progress -- 0 (remove.active)
+ Successes ---- 0 (remove.success)
+ Failures ----- 0 (remove.failure)
+ ts>
+
+hostdb-stats Host Database Statistics
+ syntax: show:hostdb-stats
+ args: none
+ behavior: Display Host Database statistics.
+
+ ts> show:hostdb-stats
+ Host Database Hit Rate -- 100% * (proxy.node.hostdb.hit_ratio)
+ DNS Lookups Per Second -- 0.00 (proxy.node.dns.lookups_per_second)
+
+ *Value represents 10 second average.
+ ts>
+
+dns-stats DNS Statistics
+ syntax: show:dns-stats
+ args: none
+ behavior: Display DNS statistics.
+
+ ts> show:dns-stats
+ DNS Lookups Per Second -- 0.00 (proxy.node.dns.lookups_per_second)
+ ts>
+
+logging-stats Logging Statistics
+ syntax: show:logging-stats
+ args: none
+ behavior: Display Logging statistics.
+
+ ts> show:logging-stats
+ Currently Open Log Files --------- 0 (proxy.process.log.log_files_open)
+ Space Used For Log Files --------- 0 (proxy.process.log.log_files_space_used)
+ Number of Access Events Logged --- 0 (proxy.process.log.event_log_access)
+ Number of Access Events Skipped -- 0 (proxy.process.log.event_log_access_skip)
+ Number of Error Events Logged ---- 0 (proxy.process.log.event_log_error)
+ ts>
+
+network Network Settings
+ syntax: show:network
+ args: none
+ behavior: Display information about different Network Parameters
+
+ traffic_shell> show:network
+
+ Hostname ---------------- foo.example.com
+ Default Gateway --------- 192.168.0.1
+ Search Domain ----------- example.com
+ DNS IP Addresses--------- 192.168.0.2
+
+ NIC eth0
+ Status ---------------- up
+ Start on Boot --------- onboot
+ Start Protocol -------- none
+ IP Address ------------ 192.168.0.10
+ Netmask --------------- 255.255.255.0
+ Gateway --------------- default
+
+ NIC eth1
+ Status ---------------- up
+ Start on Boot --------- onboot
+ Start Protocol -------- none
+ IP Address ------------ 192.168.0.11
+ Netmask --------------- 255.255.255.0
+ Gateway --------------- default
+
+ traffic_shell>
+
+
+Configure submodes (from Enable mode)
+
+Some config commands require hard restart or restart for changes to take effect.
+In these cases, one of the following messages will appear onscreen.
+
+Restart required.
+ Change will take effect after next Restart.
+ Use the "config:restart" command to restart now.
+
+Hard Restart required.
+ Change will take effect after next Hard Restart.
+ Use the "config:hard-restart" command to restart now.
+
+-------------------------------------
+Parameter Description
+-----------------------------------
+get Get records.config variable value
+ syntax: config:get <variable>
+ args: <variable> = variable from records.config
+ behavior: Retrieve and display the variable from records.config.
+
+ ts# config:get proxy.config.http.server_port
+ proxy.config.http.server_port = 8080
+ ts#
+
+set Set records.config variable value
+ syntax: config:set <variable> <value>
+ args: <variable> = variable from records.config
+ <value> = value of variable
+ behavior: Set the variable from records.config to the specified value.
+
+ ts# config:set proxy.config.http.server_port 8080
+ +OK
+ ts#
+
+name Proxy Name
+ syntax: config:name <proxyname>
+ args: <proxyname> = name of proxy
+ behavior: Set proxyname to <proxyname>
+
+ ts# config:name config1
+ +OK
+ ts#
+
+ ts# config:name
+ config1
+ ts#
+
+start Start Proxy Software
+ syntax: config:start
+ args: none
+ behavior: Run start_traffic_server.
+
+ ts# config:start
+ +OK
+ ts#
+
+stop Stop Proxy Software
+ syntax: config:stop
+ args: none
+ behavior: Run stop_traffic_server.
+
+ ts# config:stop
+ +OK
+ ts#
+
+write Write Upgrade File (IFC file)
+ syntax: config:write ifc-head ts-version <ts_version> build-date <date> platform <platform> nodes <no_of_nodes>
+ config:write feature <feature-string>
+ config:write tar <tarfilelist>
+ config:write tar-info <tarball-name> filelist <filelist>
+ config:write tar-common <filelist>
+ config:write bin-dir <dir-file-lists>
+ config:write bin-group <filelist>
+ config:write bin-common <filelist>
+ config:write lib-dir <dir-file-lists>
+ config:write lib-group <filelist>
+ config:write lib-common <filelist>
+ config:write config-dir <dir-file-filelists>
+ config:write config-group <filelist>
+ config:write config-common <filelist>
+ config:write common <filelist>
+ args:
+ <ts_version> = <int>.<int>.<int>
+ <date> = <mm>:<dd>:<yy>
+ <platform> = <string>
+ <no_of_nodes> = -1 (default) | 0 (single node) | n (n+1 nodes)
+ <feature-string> = <string>
+ <filelists> = list of files, separated by ,
+ <dir-file-filelists> = list of subdirectory, followed by filelists in each subdirectory. Subdirectories are separated by ; and file lists are separated by ,
+
+behavior: Write the text IFC file according to the current install status.
+
+
+read Read Update File
+ syntax: config:read path <path> file <filename>
+ args: <path> = <string>
+ <filename> = <string>
+
+behavior: Read the upgrade file and display it. For debugging purpose only.
+
+reset-stats Reset Statistics
+ syntax: config:reset-stats
+ args: none
+ behavior: Reset all statistics.
+
+ ts# config:reset-stats
+ +OK
+ ts#
+
+http HTTP Configuration
+ (timeout values, headers, authorization)
+ syntax: config:http status <on | off>
+ record: (proxy.config.http.cache.http)
+
+ ts# config:http status on
+ ts#
+
+ syntax: config:http <timeout> <seconds>
+ args: <timeout> can be one of the following
+ keep-alive-timeout-in (proxy.config.http.keep_alive_no_activity_timeout_in)
+ keep-alive-timeout-out (proxy.config.http.keep_alive_no_activity_timeout_out)
+ inactive-timeout-in (proxy.config.http.transaction_no_activity_timeout_in)
+ inactive-timeout-out (proxy.config.http.transaction_no_activity_timeout_out)
+ active-timeout-in (proxy.config.http.transaction_active_timeout_in)
+ active-timeout-out (proxy.config.http.transaction_active_timeout_out)
+
+ ts# config:http keep-alive-timeout-in 10
+ ts#
+
+ syntax: config:http <remove-from | remove-referer | remove-user | remove-cookie> <on | off>
+ behavior: remove the specified header
+ args: <remove-from> (proxy.config.http.anonymize_remove_from)
+ <remove-referer> (proxy.config.http.anonymize_remove_referer)
+ <remove-user> (proxy.config.http.anonymize_remove_user_agent)
+ (remove-cookie> (proxy.config.http.anonymize_remove_cookie)
+
+ ts# config:http remove-from on
+ ts#
+
+ syntax: config:http remove-header <headers>
+ behavior: remove headers specified in list of headers
+ args: <headers> (proxy.config.http.anonymize_other_header_list)
+
+ ts# config:http remove-header "field1 field2"
+ ts#
+
+ syntax: config:http <insert-ip | remove-ip> <on | off>
+ behavior: insert or remove client IP from header
+ args: <insert-ip> (proxy.config.http.anonymize_insert_client_ip)
+ <remove-ip> (proxy.config.http.anonymize_remove_client_ip)
+
+ syntax: config:http proxy <fwd | rev | fwd-rev>
+ behavior: enable http proxying in fwd/rev/fwd-rev modes
+
+ ts# config:http proxy
+ fwd
+ ts# config:http proxy rev
+ ts#
+
+
+ssl SSL Configuration
+ (on,off,port)
+ syntax: config:ssl status <on | off>
+ record: (proxy.config.ssl.enabled)
+
+ ts# config:ssl status on
+ ts# config:ssl status off
+
+ syntax: config:ssl port <portnum>
+ record: (proxy.config.ssl.server_port)
+
+ ts# config:ssl port 1234
+ ts#
+
+
+icp ICP Configuration
+ (on/off, rules, port, timeouts)
+ syntax: config:icp mode <receive | send-receive | disabled>
+ record: (proxy.config.icp.enabled value)
+ receive = 1, send-receive = 2, disabled = 0
+
+ ts# config:icp mode receive
+ ts#
+
+ syntax: config:icp port <portnum>
+ record: (proxy.config.icp.icp_port)
+
+ ts# config:icp port 3130
+ ts#
+
+ syntax: config:icp multicast <on | off>
+ record: (proxy.config.icp.multicast_enabled)
+
+ ts# config:icp multicast on
+ ts#
+
+ syntax: config:icp query-timeout <seconds>
+ record: (proxy.config.icp.query_timeout)
+
+ ts# config:icp query-timeout 2
+ ts#
+
+ syntax: config:icp peers <url>
+ behavior: Retrieve icp.config file from URL.
+
+ ts# config:icp peers http://example.com/icp.config
+ ts#
+
+cache Cache Configuration
+ (active protocols, bypass, storage, freshness,
+ expires, variable content, rules, clear)
+ syntax: config:cache <protocol> <on | off>
+ args: <protocol> = <http>
+ <on | off> specifies the given protocol is cached
+ behavior: Enable/Disable caching of various protocols.
+
+ ts# config:cache http on (proxy.config.http.cache.http)
+ +OK
+ ts#
+
+ ts# config:cache http
+ on
+ ts#
+
+ syntax: config:cache cluster-bypass <on | off>
+ args: <on | off> turn cluster-bypass on/off.
+
+ ts# config:cache cluster-bypass on (proxy.config.http.cache.cluster_cache_local)
+ +OK
+ ts#
+
+ ts# config:cache cluster-bypass
+ on
+ ts#
+
+ syntax: config:cache ignore-bypass <on | off>
+ args: <on | off> turn ignore-bypass on/off.
+
+ ts# config:cache ignore-bypass on (proxy.config.http.cache.ignore_client_no_cache)
+ +OK
+ ts#
+
+ ts# config:cache ignore-bypass
+ on
+ ts#
+
+ syntax: config:cache max-object-size <bytes>
+ args: if bytes=0 then there is no maximum
+
+ ts# config:cache max-object-size 0 (proxy.config.cache.max_doc_size)
+ +OK
+ ts#
+
+ ts# config:cache max-object-size
+ 0
+ ts#
+
+ syntax: config:cache max-alternates <num>
+ args: if num=0 then there is no maximum
+
+ ts# config:cache max-alternates 0
+ +OK
+ ts#
+
+ ts# config:cache max-alternates
+ 0
+ ts#
+
+ syntax: config:cache file [url]
+ args: [url] = location of remote cache.config file
+ behavior: Retrieve and install cache.config file from URL.
+
+ ts# config:cache file http://example.com/cache.config
+ +OK
+ ts#
+
+ syntax: config:cache freshness verify <when-expired | no-date | always | never>
+ records.config: proxy.config.http.cache.when_to_revalidate
+ args: when-expired = 0, no-date=1, always=2, never=3
+
+ ts# config:cache freshness verify when-expired
+ +OK
+ ts#
+
+ syntax: config:cache freshness minimum <explicit | last-modified | nothing>
+ records.config: proxy.config.http.cache.required_headers
+ args: explicit = 2, last-modified = 1, nothing = 0
+
+ ts# config:cache freshness minimum explicit
+ +OK
+ ts#
+
+ syntax: config:cache freshness no-expire-limit greater-than <seconds> less-than <seconds>
+ records.config: proxy.config.http.cache.heuristic_min_lifetime, heuristic_max_lifetime
+ args: <seconds> is an integer
+
+ ts# config:cache freshness no-expire-limit greater-than 900 less-than 7200
+ +OK
+ ts#
+
+ syntax: config:cache dynamic <on | off>
+ records: proxy.config.http.cache.cache_urls_that_look_dynamic
+
+ ts# config:cache dynamic on
+ +OK
+ ts#
+
+ syntax: config:cache alternates <on | off>
+ records: proxy.config.http.cache.enable_default_vary_headers
+
+ ts# config:cache alternates on
+ +OK
+ ts#
+
+ syntax: config:cache vary <text | images | other> <field>
+ records: proxy.config.http.cache.vary_default_(text,images,other)
+ args: <field> is a string
+
+ ts# config:cache vary text Cookie
+ +OK
+ ts#
+
+ syntax: config:cache cookies <none | all | images | non-text>
+ records: proxy.config.http.cache.cache_responses_to_cookies
+ args: none = 0, all = 1, images = 2, non-text = 3
+
+ ts# config:cache cookies none
+ +OK
+ ts#
+
+ syntax: config:cache clear (clear cache and start traffic server)
+ args: none
+
+ ts# config:cache clear
+ Traffic Server is running.
+ Clear Cache failed.
+ ts# config:cache clear
+ +OK
+
+
+hostdb Host Database Configuration
+ syntax: config:hostdb lookup-timeout <seconds>
+ records: proxy.config.hostdb.lookup_timeout
+
+ ts# config:hostdb lookup-timeout 30
+ +OK
+ ts#
+
+ syntax: config:hostdb foreground-timeout <seconds>
+ records: proxy.config.hostdb.timeout (seconds)
+
+ ts# config:hostdb foreground-timeout 12
+ +OK
+ ts#
+
+ syntax: config:hostdb background-timeout <seconds>
+ records: proxy.config.hostdb.verify_after 24
+
+ ts# config:hostdb background-timeout 24
+ +OK
+ ts#
+
+ syntax: config:hostdb invalid-host-timeout <seconds>
+ records: proxy.config.hostdb.fail.timeout
+
+ ts# config:hostdb invalid-host-timeout 30
+ +OK
+ ts#
+
+ syntax: config:hostdb re-dns-on-reload <on | off>
+ records: proxy.config.hostdb.re_dns_on_reload
+
+ ts# config:hostdb re-dns-on-reload on
+ +OK
+ ts#
+
+ syntax: config:hostdb clear (clear hostdb and start traffic server)
+ args: none
+
+ ts# config:hostdb clear
+ Traffic Server is running.
+ Clear HostDB failed.
+
+ ts# config:hostdb clear
+ +OK
+ ts#
+
+dns DNS Configuration
+ syntax: config:dns resolve-timeout <seconds>
+ records: proxy.config.dns.lookup_timeout
+
+ ts# config:dns resolve-timeout 10
+ +OK
+ ts#
+
+ syntax: config:dns retries <number>
+ records: proxy.config.dns.retries
+
+ ts# config:dns retries 3
+ +OK
+ ts#
+
+logging Logging Configuration
+ syntax: config:logging event <enabled | trans-only | error-only | disabled>
+ records: proxy.config.log.logging_enabled
+
+ ts# config:logging event enabled
+ +OK
+ ts#
+
+ ts# config:logging event
+ enabled
+ ts#
+
+ syntax: config:logging mgmt-directory <dir>
+ records: proxy.config.log.logfile_dir
+
+ ts# config:logging mgmt-directory /usr/local/var/log/trafficserver
+ +OK
+ ts#
+
+ syntax: config:logging space-limit <mb>
+ args: <mb> = log space limit (MB)
+ records: proxy.config.log.max_space_mb_for_logs
+
+ ts# config:logging space-limit 10
+ +OK
+ ts#
+
+ syntax: config:logging space-headroom <mb>
+ args: <mb> = log space headroom (MB)
+ records: proxy.config.log.max_space_mb_headroom
+
+ ts# config:logging space-headroom 100
+ +OK
+ ts#
+
+ syntax: config:logging collation-status <inactive | host | send-standard | send-custom | send-all>
+ args: inactive = 0, host = 1, send-standard = 2, send-custom = 3, send-all = 4
+ records: proxy.local.log.collation_mode
+
+ ts# config:logging collation-status inactive
+ +OK
+ ts#
+
+ ts# config:log collation-status send-custom
+ +OK
+ ts#
+
+ syntax: config:logging collation-host <host>
+ args: <host> is a remote collation host
+ records: proxy.config.log.collation_host
+
+ ts# config:log collation-host config1
+ +OK
+ ts#
+
+ syntax: config:logging collation secret <secret> tagged <on | off> orphan-limit <orphan>
+ args: <secret> = string
+ <orphan> = size in MB
+ records: <secret> = proxy.config.log.collation_port
+ tagged = proxy.config.log.collation_host_tagged
+ <orphan> = proxy.config.log.collation_secret
+
+ ts# config:logging collation secret foobar tagged on orphan-limit 10
+ +OK
+ ts#
+
+ syntax: config:logging format <squid | netscape-common | netscape-ext | netscape-ext2>
+ <on | off> type <ascii | binary> file <file> header <header>
+
+ squid
+ args: <on | off> = proxy.config.log.squid_log_enabled
+ type = proxy.config.log.squid_log_is_ascii <ascii=1, binary=0>
+ file = proxy.config.log.squid_log_name
+ header = proxy.config.log.squid_log_header
+ netscape-common
+ args: <on | off> = proxy.config.log.common_log_enabled
+ type = proxy.config.log.common_log_is_ascii <ascii=1, binary=0>
+ file = proxy.config.log.common_log_name
+ header = proxy.config.log.common_log_header
+ netscape-ext
+ args: <on | off> = proxy.config.log.extended_log_enabled
+ type = proxy.config.log.extended_log_is_ascii <ascii=1, binary=0>
+ file = proxy.config.log.extended_log_name
+ header = proxy.config.log.extended_log_header
+ netscape-ext2
+ args: <on | off> = proxy.config.log.extended2_log_enabled
+ type = proxy.config.log.extended2_log_is_ascii <ascii=1, binary=0>
+ file = proxy.config.log.extended2_log_name
+ header = proxy.config.log.extended2_log_header
+
+ ts# config:log format squid on type ascii file squid.log
+ +OK
+ ts#
+
+ syntax: config:logging splitting <icp | http> <on | off>
+ records: proxy.config.log.separate_icp_logs <icp>
+ proxy.config.log.separate_host_logs <http>
+
+ ts# config:log split icp on
+ +OK
+ ts#
+
+ syntax: config:logging custom <on | off> format <traditional | xml>
+ records: proxy.config.log.custom_logs_enabled
+
+ ts# config:logging custom on format xml
+ +OK
+ ts#
+
+ syntax: config:logging rolling <on | off> offset <hour> interval <num-hours> auto-delete <on | off>
+ records: proxy.config.log.rolling_enabled
+ proxy.config.log.rolling_offset_hr (24hour format)
+ proxy.config.log.rolling_interval_sec (seconds)
+
+ ts# config:logging rolling on offset 0 interval 1 auto-delete off
+ +OK
+ ts#
+
+ssl SSL Ports
+
+security Security Configuration
+ (TS IP allow, MGMT allow, Admin Access)
+ syntax: config:security ip-allow <url>
+
+ ts# config:security ip-allow http://example.com/ip_allow.config
+ ts#
+
+ syntax: config:security admin <url>
+
+ ts# config:parent status on
+ ts#
+
+ ts# config:parent name parent.example.com
+ ts#
+
+ ts# config:parent rules http://example.com/parent.config
+ ts#
+
+remap Remap Rules
+ syntax: config:remap <url>
+ args: <url> = retrieve file and use as remap.config
+
+ ts# config:remap http://example.com/remap.config
+ ts#
+
+ports Ports used by Traffic Server
+*** config:ports command is not implemented or supported ***
+ (including mgmt port)
+ syntax: config:ports <http-server | http-other | webui | cluster
+ cluster-rs | cluster-mc |
+ ssl | socks-server | icp> <port | ports>
+ args: some variables are single-port while other can be a list of ports
+ <http-server> (proxy.config.http.server_port) single
+ <cluster> (proxy.config.cluster_port) single
+ <cluster-rs> (proxy.config.cluster.rsport) single
+ <cluster-mc> (proxy.config.cluster.mcport) single
+ <connect> (proxy.config.http.connect_ports) list
+ <socks-server> (proxy.config.socks.socks_server_port) single
+ <icp> (proxy.config.icp.icp_port) single
+
+socks SOCKS Configuration
+ syntax: config:socks status <on | off> version <int> default-servers <string>
+ accept <on | off> accept-port <port>
+ args: socks (proxy.config.socks_socks_needed)
+ version (proxy.config.socks.socks_version)
+ default-servers (proxy.config.socks.default_servers)
+ accept (proxy.config.socks.accept_enabled)
+ accept-port (proxy.config.socks.accept_port)
+
+ ts# config:socks status on
+ ts#
+ ts# config:socks version 4
+ ts#
+ ts# config:socks default-servers "s1.example.com:1080;socks2:4080"
+ ts#
+ ts# config:socks accept on
+ ts#
+ ts# config:socks accept-port 1080
+ ts#
+
+
+
+scheduled-update Scheduled Update Configuration
+ syntax: config:scheduled-update status <on | off>
+ retry-count <int>
+ retry-interval <sec>
+ max-concurrent <value>
+ force-immediate <on | off>
+ rules <url>
+
+ args: config update.config file
+ behavior: Scheduled Update Configuration.
+
+ ts> config:scheduled-update on
+ ts>
+
+ ts> config:scheduled-update retry-count 10
+ ts>
+
+ ts> config:scheduled-update retry-interval 2
+
+ ts> config:scheduled-update force-immediate off
+ ts>
+
+ ts> config:scheduled-update rules http://example.com
+
+ ts> config:scheduled-update rules
+ update.config rules
+ -------------------
+ (Display list of rules from update.config)
+ ts>
+
+
+Appliance-Specific commands (Linux only)
+========================================
+
+Normal Mode
+-----------
+ ping Send ICMP ECHO_REQUEST packets to host.
+ syntax: ping <host>
+ args: hostname
+
+ ts> ping foo
+ foo is alive
+ ts>
+
+ traceroute Display the route packets take to host.
+ syntax: traceroute <host>
+ args: hostname
+
+ ts> traceroute foo
+ Traceroute output appears here...
+ ts>
+
+Configure Mode
+--------------
+
+config:network Make System Network configuration changes
+
+ traffic_shell> config:network
+
+ Command Syntax:
+ config:network hostname <string>
+ config:network defaultrouter <x.x.x.x>
+ config:network search-domain <string>
+ config:network dns [a.a.a.a] [b.b.b.b] [c.c.c.c]
+ config:network int <interface>
+ config:network int <interface> down
+ config:network int <interface> up <onboot | not-onboot>
+ <static | dhcp> <ip> <netmask> <gateway>
+ config:network int <interface> <onboot | not-onboot>
+ config:network int <interface> <static | dhcp>
+ config:network int <interface> ip <x.x.x.x>
+ config:network int <interface> netmask <x.x.x.x>
+ config:network int <interface> gateway <x.x.x.x | default>
+
+ traffic_shell>
+
+ hostname Specify appliance hostname
+ syntax: config:network hostname <name>
+ ts# config:network hostname xxxx
+ ts# config:network hostname
+ xxxx
+ ts#
+
+ defaultrouter Specify default router
+ syntax: config:network defaultrouter <x.x.x.x>
+
+ ts# config:network defaultrouter x.x.x.x
+ ts# config:network defaultrouter
+ x.x.x.x
+ ts#
+
+ search-domain Specify DNS search domain
+ syntax: config:network search-domain <x.x.x.x>
+
+ ts# config:network search-domain example.com
+ ts# config:network search-domain
+ example.com
+ ts#
+
+ dns Specify one or more DNS servers
+ syntax: config:network dns <string of IP addresses>
+
+ ts# config:network dns "192.168.0.2 192.168.0.3"
+ ts# config:network dns
+ 192.168.0.2 192.168.0.3
+ ts#
+
+ int Configure Network Interface Card
+
+ config:network int
+ List network interface cards by name.
+
+ config:network int <interface>
+ Display NIC configuration.
+
+ config:network int <interface> down
+ Bring down the specified interface.
+
+ config:network int <interface> up <onboot | not-onboot>
+ <static | dhcp> <ip> <netmask> <gateway>
+ Bring up a NIC with the specified parameters.
+
+ config:network int <interface> <onboot | not-onboot>
+ Change the boot start status of a NIC that is already up.
+
+ config:network int <interface> <static | dhcp>
+ Change the static/dhcp status of a NIC that is already up.
+
+ config:network int <interface> ip <x.x.x.x>
+ Change the IP address of a NIC that is already up.
+
+ config:network int <interface> netmask <x.x.x.x>
+ Change the netmask of a NIC that is already up.
+
+ config:network int <interface> gateway <x.x.x.x | default>
+ Change the gateway of a NIC that is already up.
+
+ traffic_shell> config:network int
+ eth0
+ eth1
+ traffic_shell> config:network int eth0
+
+ NIC eth0
+ Status -------------- up
+ Start on Boot ------- onboot
+ Start Protocol ------ none
+ IP Address ---------- 192.168.0.10
+ Netmask ------------- 255.255.255.0
+ Gateway ------------- default
+
+ traffic_shell>
+
+
+ date Specify system date.
+ syntax: config:clock date <date>
+ args: <date> = mm/dd/yyyy
+
+ ts# config:clock date 01/01/2001
+ ts# config:clock date
+ 01/01/2001
+ ts#
+
+ time Specify system time.
+ syntax: config time <time>
+ args: <time> = hh:mm:ss
+
+ ts# config:clock time 14:00:00
+ ts# config:clock time
+ 14:00:03
+ ts#
+
+ timezone Specify time zone.
+ syntax: config:clock timezone [zone | list]
+ args: [zone] optional time zone from numbered list
+ if not present, display current time zones
+ [list] display list of time zone
+
+ ts# config:clock timezone
+ Display numbered current timezones.
+
+ ts# config:clock timezone 3
+ ts#
+
+ ts# config:clock timezone list
+ Display list of time zone. (85 in total currently)
+
+ halt Halt appliance.
+ syntax: halt
+
+ ts# halt
+
+ reboot Reboot appliance.
+ syntax: reboot
+
+ ts# reboot