trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] 01/03: Removes the Configuration Context Manager
Date Wed, 01 Nov 2017 17:55:17 GMT
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 76834d0741e9c5430539f78bfbb4f2b61ed41ce1
Author: Leif Hedstrom <zwoop@apache.org>
AuthorDate: Thu Oct 12 17:22:14 2017 -0600

    Removes the Configuration Context Manager
    
    This is a set of management APIs that was used by the Web UI, for creating,
    modifying and deleting configuration files and entries. This is another step
    towards removing the requirements for writing to configuration files.
---
 mgmt/api/APITestCliRemote.cc  | 126 ----------
 mgmt/api/CfgContextManager.cc | 560 ------------------------------------------
 mgmt/api/CfgContextManager.h  |  74 ------
 mgmt/api/INKMgmtAPI.cc        |  91 -------
 mgmt/api/Makefile.am          |   2 -
 mgmt/api/include/mgmtapi.h    | 107 --------
 6 files changed, 960 deletions(-)

diff --git a/mgmt/api/APITestCliRemote.cc b/mgmt/api/APITestCliRemote.cc
index f2e38b9..73a25dd 100644
--- a/mgmt/api/APITestCliRemote.cc
+++ b/mgmt/api/APITestCliRemote.cc
@@ -726,68 +726,6 @@ print_storage_ele(TSStorageEle *ele)
   }
 }
 
-//
-// print_ele_list
-//
-// prints a list of Ele's
-//
-
-void
-print_ele_list(TSFileNameT file, TSCfgContext ctx)
-{
-  TSFileNameT filename = file;
-  TSCfgEle *ele;
-
-  if (!ctx) {
-    printf("[print_ele_list] invalid TSCFgContext\n");
-    return;
-  }
-
-  int count = TSCfgContextGetCount(ctx);
-  printf("\n[print_ele_list] %d rules\n", count);
-  for (int i = 0; i < count; i++) {
-    ele = TSCfgContextGetEleAt(ctx, i);
-
-    switch (filename) {
-    case TS_FNAME_CACHE_OBJ:
-      print_cache_ele((TSCacheEle *)ele);
-      break;
-    case TS_FNAME_HOSTING:
-      print_hosting_ele((TSHostingEle *)ele);
-      break;
-    case TS_FNAME_IP_ALLOW:
-      print_ip_allow_ele((TSIpAllowEle *)ele);
-      break;
-    case TS_FNAME_PARENT_PROXY:
-      print_parent_ele((TSParentProxyEle *)ele);
-      break;
-    case TS_FNAME_VOLUME:
-      print_volume_ele((TSVolumeEle *)ele);
-      break;
-    case TS_FNAME_PLUGIN:
-      print_plugin_ele((TSPluginEle *)ele);
-      break;
-    case TS_FNAME_REMAP:
-      print_remap_ele((TSRemapEle *)ele);
-      break;
-    case TS_FNAME_SOCKS:
-      print_socks_ele((TSSocksEle *)ele);
-      break;
-    case TS_FNAME_SPLIT_DNS:
-      print_split_dns_ele((TSSplitDnsEle *)ele);
-      break;
-    case TS_FNAME_STORAGE:
-      print_storage_ele((TSStorageEle *)ele);
-      break;
-    default:
-      printf("[print_ele_list] invalid file type \n");
-      return;
-    }
-  }
-
-  return;
-}
-
 /***************************************************************************
  * Control Testing
  ***************************************************************************/
@@ -1355,68 +1293,6 @@ test_read_file()
 }
 
 /***************************************************************************
- * TSCfgContext Testing
- ***************************************************************************/
-// tests the TSCfgContextMoveEleUp/Down functions (which end up calling
-// the new "copy" utility functions in CfgContextUtils.cc
-
-// uses TSCfgContextGet to read in a file and print out all the rules
-void
-test_cfg_context_get(char *args)
-{
-  TSCfgContext ctx;
-  TSFileNameT file;
-  char *filename;
-
-  strtok(args, ":");
-  filename = strtok(nullptr, ":");
-  fprintf(stderr, "modify file: %s\n", filename);
-  char *name = TSstrdup(filename);
-
-  // convert file name to TSFileNameT
-  if (strcmp(name, "cache.config") == 0) {
-    file = TS_FNAME_CACHE_OBJ;
-  } else if (strcmp(name, "congestion.config") == 0) {
-    file = TS_FNAME_CONGESTION;
-  } else if (strcmp(name, "hosting.config") == 0) {
-    file = TS_FNAME_HOSTING;
-  } else if (strcmp(name, "ip_allow.config") == 0) {
-    file = TS_FNAME_IP_ALLOW;
-  } else if (strcmp(name, "parent.config") == 0) {
-    file = TS_FNAME_PARENT_PROXY;
-  } else if (strcmp(name, "volume.config") == 0) {
-    file = TS_FNAME_VOLUME;
-  } else if (strcmp(name, "plugin.config") == 0) {
-    file = TS_FNAME_PLUGIN;
-  } else if (strcmp(name, "remap.config") == 0) {
-    file = TS_FNAME_REMAP;
-  } else if (strcmp(name, "socks.config") == 0) {
-    file = TS_FNAME_SOCKS;
-  } else if (strcmp(name, "storage.config") == 0) {
-    file = TS_FNAME_STORAGE;
-  } else if (strcmp(name, "splitdns.config") == 0) {
-    file = TS_FNAME_SPLIT_DNS;
-  } else {
-    TSfree(name);
-    return;
-  }
-
-  ctx = TSCfgContextCreate(file);
-  if (TSCfgContextGet(ctx) != TS_ERR_OKAY) {
-    printf("ERROR READING FILE\n");
-  }
-
-  int count = TSCfgContextGetCount(ctx);
-  printf("%d rules in file: %s\n", count, name);
-
-  print_ele_list(file, ctx);
-
-  TSCfgContextDestroy(ctx);
-  TSfree(name);
-  return;
-}
-
-/***************************************************************************
  * Events Testing
  ***************************************************************************/
 /* ------------------------------------------------------------------------
@@ -1736,8 +1612,6 @@ runInteractive()
       test_read_url(true);
     } else if (strstr(buf, "test_url")) {
       test_read_url(false);
-    } else if (strstr(buf, "cfg_get:")) {
-      test_cfg_context_get(buf);
     } else if (strstr(buf, "reset_stats")) {
       reset_stats();
     } else if (strstr(buf, "set_stats")) {
diff --git a/mgmt/api/CfgContextManager.cc b/mgmt/api/CfgContextManager.cc
deleted file mode 100644
index acc1dbb..0000000
--- a/mgmt/api/CfgContextManager.cc
+++ /dev/null
@@ -1,560 +0,0 @@
-/** @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: ContextManager.cc
- * ------------------------------------------------------------------------
- * Purpose:
- * 1) CfgContext class manipulations
- * 2) conversions from parser value tags into Ele value format
- *
- * Created by: Lan Tran
- *
- ***************************************************************************/
-#include "ts/ink_platform.h"
-#include "ts/ink_string.h"
-#include "CfgContextManager.h"
-#include "CfgContextUtils.h"
-#include "CoreAPI.h"
-#include "GenericParser.h"
-
-//--------------------------------------------------------------------------
-// Defines
-//--------------------------------------------------------------------------
-
-#define FORMAT_TO_RULE_ERROR "# ERROR: Can't convert Ele to rule format."
-
-/* ---------------------------------------------------------------
- * CfgContextCreate
- * ---------------------------------------------------------------
- * Allocates memory for a CfgContext struct and initializes its members.
- * Must pass in a valid file name type; TS_FNAME_UNDEFINED is
- * considered valid.
- */
-CfgContext *
-CfgContextCreate(TSFileNameT file)
-{
-  CfgContext *ctx = nullptr;
-  ctx             = new CfgContext(file);
-  return ctx;
-}
-
-/* ---------------------------------------------------------------
- * CfgContextDestroy
- * ---------------------------------------------------------------
- * frees all memory allocated for the CfgContext
- */
-TSMgmtError
-CfgContextDestroy(CfgContext *ctx)
-{
-  if (!ctx) {
-    return TS_ERR_PARAMS;
-  }
-  delete ctx;
-  return TS_ERR_OKAY;
-}
-
-/* ---------------------------------------------------------------
- * CfgContextGet
- * ---------------------------------------------------------------
- * Read the file, get a copy of it, parse the file, convert the
- * parse structure into ones which will be stored by ctx. The
- * ctx should also store the version number of the file being read.
- * If invalid rule, it is skipped and not added to the CfgContext.
- */
-TSMgmtError
-CfgContextGet(CfgContext *ctx)
-{
-  TSMgmtError ret;
-  int size, ver;
-  char *old_text      = nullptr;
-  RuleList *rule_list = nullptr;
-  CfgEleObj *ele      = nullptr;
-
-  ink_release_assert(ctx);
-
-  // get copy of the file
-  ret = ReadFile(ctx->getFilename(), &old_text, &size, &ver);
-  if (ret != TS_ERR_OKAY) {
-    // TODO: Hmmm, this looks almost like a memory leak, why the strcmp ??
-    if (old_text && strcmp(old_text, "") != 0) {
-      ats_free(old_text); // need to free memory
-    }
-    return ret; // Pass the error code along
-  }
-  // store version number
-  ctx->setVersion(ver);
-
-  rule_list = new RuleList();
-  rule_list->parse(old_text, (ctx->getFilename()));
-
-  // iterate through each TokenList in rule_list
-  for (Rule *rule_node = rule_list->first(); rule_node; rule_node = rule_list->next(rule_node))
{
-    // rule_node->Print();
-    ele = create_ele_obj_from_rule_node(rule_node);
-    if (ele == nullptr) { // invalid rule; skip it
-      continue;
-    }
-
-    ret = ctx->addEle(ele);
-    if (ret != TS_ERR_OKAY) {
-      ats_free(old_text); // need to free memory
-      return ret;
-    }
-  }
-  delete (rule_list); // free RuleList memory
-  // TODO: Hmmm, this looks almost like a memory leak, why the strcmp ??
-  if (old_text && strcmp(old_text, "") != 0) {
-    ats_free(old_text); // need to free memory
-  }
-  return TS_ERR_OKAY;
-}
-
-/***************************************************************
- * CfgContext Operations
- ***************************************************************/
-/*--------------------------------------------------------------
- * CfgContextGetCount
- *--------------------------------------------------------------
- * returns number of (non-comment) ele's in the CfgContext*;
- * returns -1 if an error
- */
-int
-CfgContextGetCount(CfgContext *ctx)
-{
-  CfgEleObj *curr_ele;
-  int count = 0;
-
-  ink_assert(ctx);
-  if (!ctx) {
-    return -1;
-  }
-
-  // iterate CfgContext; return the first EleObj that's not a comment
-  curr_ele = ctx->first(); // get head of ele
-  while (curr_ele) {
-    if (curr_ele->getRuleType() != TS_TYPE_COMMENT) {
-      count++; // only count non-comments
-    }
-    curr_ele = ctx->next(curr_ele);
-  }
-
-  return count;
-}
-
-/*--------------------------------------------------------------
- * CfgContextGetObjAt
- *--------------------------------------------------------------
- * user must typecast the TSCfgObj to appropriate TSObj before using;
- * iterate through the CfgContext, until the count of NON-Comment ObjObj's
- * equals index specified (remember to start counting from 0)
- */
-CfgEleObj *
-CfgContextGetObjAt(CfgContext *ctx, int index)
-{
-  CfgEleObj *curr_ele;
-  int count = 0; // start counting from 0
-
-  ink_assert(ctx);
-  if (!ctx) {
-    return nullptr;
-  }
-
-  // iterate through the ctx, keep count of all NON-Comment Obj Objects
-  curr_ele = ctx->first(); // get head of ele
-  while (curr_ele) {
-    if (curr_ele->getRuleType() == TS_TYPE_COMMENT) { /* a comment ele */
-      curr_ele = ctx->next(curr_ele);
-      continue;
-    } else {
-      if (count == index) { // got right ele
-        return curr_ele;
-      }
-      curr_ele = ctx->next(curr_ele);
-      count++;
-    }
-  }
-
-  return nullptr; // invalid index
-}
-
-/*--------------------------------------------------------------
- * CfgContextGetEleAt
- *--------------------------------------------------------------
- * user must typecast the TSCfgEle to appropriate TSEle before using;
- * iterate through the CfgContext, until the count of NON-Comment EleObj's
- * equals index specified (remember to start counting from 0)
- */
-TSCfgEle *
-CfgContextGetEleAt(CfgContext *ctx, int index)
-{
-  TSCfgEle *cfg_ele;
-  CfgEleObj *curr_ele;
-  int count = 0; // start counting from 0
-
-  ink_assert(ctx);
-  if (!ctx) {
-    return nullptr;
-  }
-
-  // iterate through the ctx, keep count of all NON-Comment Ele Objects
-  curr_ele = ctx->first(); // get head of ele
-  while (curr_ele) {
-    if (curr_ele->getRuleType() == TS_TYPE_COMMENT) { /* a comment ele */
-      curr_ele = ctx->next(curr_ele);
-      continue;
-    } else {
-      if (count == index) { // got right ele
-        // Debug("config", "Get ele at index = %d", index);
-        cfg_ele = curr_ele->getCfgEle();
-        return cfg_ele;
-      }
-      curr_ele = ctx->next(curr_ele);
-      count++;
-    }
-  }
-
-  return nullptr; // invalid index
-}
-
-/*--------------------------------------------------------------
- * CfgContextGetFirst
- *--------------------------------------------------------------
- * Returns pointer to first Non-comment Ele in the CfgContext.
- * Used as part of iterator
- */
-TSCfgEle *
-CfgContextGetFirst(CfgContext *ctx, TSCfgIterState *state)
-{
-  CfgEleObj *curr_ele;
-
-  ink_assert(ctx && state);
-  if (!ctx || !state) {
-    return nullptr;
-  }
-
-  // iterate; return the first CfgEleObj that's not a comment
-  curr_ele = ctx->first(); // get head of ele
-  while (curr_ele) {
-    if (curr_ele->getRuleType() == TS_TYPE_COMMENT) { // a comment ele
-      curr_ele = ctx->next(curr_ele);
-      continue;
-    } else {
-      *state = curr_ele;
-      return (curr_ele->getCfgEle());
-    }
-  }
-
-  return nullptr;
-}
-
-/*--------------------------------------------------------------
- * CfgContextGetNext
- *--------------------------------------------------------------
- * Returns pointer to next Non-comment Ele in the CfgContext.
- * Used as part of iterator.
- */
-TSCfgEle *
-CfgContextGetNext(CfgContext *ctx, TSCfgIterState *state)
-{
-  CfgEleObj *curr_ele;
-
-  ink_assert(ctx && state);
-  if (!ctx || !state) {
-    return nullptr;
-  }
-
-  // iterate through the ctx, keep count of all NON-Comment Ele Objects
-  // when count == state->index, then return next ele
-  curr_ele = (CfgEleObj *)*state;
-  curr_ele = ctx->next(curr_ele); // get next ele
-  while (curr_ele) {
-    if (curr_ele->getRuleType() != TS_TYPE_COMMENT) { // a non-comment ele
-      *state = curr_ele;
-      return curr_ele->getCfgEle();
-    }
-    curr_ele = ctx->next(curr_ele); // get next ele
-
-    /*
-       if (curr_ele->getRuleType() == TS_TYPE_COMMENT) { // a comment ele
-       continue;
-       } else {
-       *state = curr_ele;
-       return curr_ele->getCfgEle();
-       }
-       curr_ele = ctx->next(curr_ele); // get next ele
-     */
-  }
-
-  return nullptr; // ERROR
-}
-
-/*--------------------------------------------------------------
- * CfgContextMoveEleUp
- *--------------------------------------------------------------
- * Remove the EleObj at the specified index (but make a copy of it's m_ele
- * first), and insert the copy at the position of index-1.
- * THIS IS REALLY INEFFICIENT!!!
- */
-TSMgmtError
-CfgContextMoveEleUp(CfgContext *ctx, int index)
-{
-  CfgEleObj *curr_ele_obj;
-  TSCfgEle *ele_copy = nullptr; /* lv: just to make gcc happy */
-  int count          = 0;       // start counting from 0
-  TSMgmtError ret;
-
-  ink_assert(ctx && index >= 0);
-  if (!ctx || index < 0) {
-    return TS_ERR_PARAMS;
-  }
-
-  // moving the first Ele up does nothing
-  if (index == 0) {
-    return TS_ERR_OKAY;
-  }
-
-  // retrieve the ELe and make a copy of it
-  curr_ele_obj = ctx->first(); // get head of ele
-  while (curr_ele_obj) {
-    if (curr_ele_obj->getRuleType() == TS_TYPE_COMMENT) { // a comment ele
-      curr_ele_obj = ctx->next(curr_ele_obj);
-      continue;
-    } else {
-      if (count == index) {
-        // make a copy of ele
-        ele_copy = curr_ele_obj->getCfgEleCopy();
-
-        // remove the ele
-        ctx->removeEle(curr_ele_obj);
-        break;
-      }
-      curr_ele_obj = ctx->next(curr_ele_obj);
-      count++;
-    }
-  }
-  // reached end of CfgContext before hit index
-  if (count != index) {
-    return TS_ERR_FAIL;
-  }
-
-  // reinsert  the ele at index-1
-  ret = CfgContextInsertEleAt(ctx, ele_copy, index - 1);
-
-  return ret;
-}
-
-/*--------------------------------------------------------------
- * CfgContextMoveEleDown
- *--------------------------------------------------------------
- * Locate the EleObj at position index. Remove and delete the EleObj.
- * Make a copy of the ele stored in the EleObj before deleting it and
- * reinserts the new EleObj in the index+1 position.
- */
-TSMgmtError
-CfgContextMoveEleDown(CfgContext *ctx, int index)
-{
-  CfgEleObj *curr_ele_obj;
-  TSCfgEle *ele_copy = nullptr; /* lv: just to make gcc happy */
-  int count          = 0;       // start counting from 0
-  TSMgmtError ret;
-  int tot_ele;
-
-  ink_assert(ctx);
-  if (!ctx) {
-    return TS_ERR_PARAMS;
-  }
-
-  tot_ele = CfgContextGetCount(ctx); // inefficient!
-  if (index < 0 || index >= tot_ele) {
-    return TS_ERR_PARAMS;
-  }
-
-  // moving the last ele down does nothing
-  if (index == (tot_ele - 1)) {
-    return TS_ERR_OKAY;
-  }
-
-  // retrieve the ELe and make a copy of it
-  curr_ele_obj = ctx->first(); // get head of ele
-  while (curr_ele_obj) {
-    if (curr_ele_obj->getRuleType() == TS_TYPE_COMMENT) { /* a comment ele */
-      curr_ele_obj = ctx->next(curr_ele_obj);
-      continue;
-    } else {
-      if (count == index) {
-        // make a copy of ele
-        ele_copy = curr_ele_obj->getCfgEleCopy();
-
-        // remove the ele
-        ctx->removeEle(curr_ele_obj);
-        break;
-      }
-      curr_ele_obj = ctx->next(curr_ele_obj);
-      count++;
-    }
-  }
-  // reached end of CfgContext before hit index
-  if (count != index) {
-    return TS_ERR_FAIL;
-  }
-
-  // reinsert  the ele at index+1
-  ret = CfgContextInsertEleAt(ctx, ele_copy, index + 1);
-
-  return ret;
-}
-
-/*--------------------------------------------------------------
- * CfgContextAppendEle
- *--------------------------------------------------------------
- * Appends the ele to the end of the CfgContext. First must
- * wrap the ele in an CfgEleObj class before can append to CfgContext
- */
-TSMgmtError
-CfgContextAppendEle(CfgContext *ctx, TSCfgEle *ele)
-{
-  CfgEleObj *ele_obj;
-
-  ele_obj = create_ele_obj_from_ele(ele);
-  ctx->addEle(ele_obj);
-
-  return TS_ERR_OKAY;
-}
-
-/*--------------------------------------------------------------
- * CfgContextInsertEleAt
- *--------------------------------------------------------------
- * Inserts the ele into specified position of the CfgContext.  First must
- * wrap the ele in an CfgEleObj class before can insert.
- * If there are comments, before the index specified, the
- * ele will be inserted after the comments.
- * Note: In the special case of inserting in the first position of the list;
- * if there are comments before the current non-comment CfgEleObj,
- * then can just push the new Ele onto the CfgContext. If there are
- * comments before the first non-comment CfgEleObj, then insert the
- * new EleObj right after the last comment
- */
-TSMgmtError
-CfgContextInsertEleAt(CfgContext *ctx, TSCfgEle *ele, int index)
-{
-  CfgEleObj *ele_obj, *curr_ele_obj, *last_comment = nullptr;
-  int count        = 0;
-  TSMgmtError err  = TS_ERR_OKAY;
-  bool has_comment = false;
-
-  // need to convert the ele into appropriate Ele object type
-  ele_obj = create_ele_obj_from_ele(ele);
-
-  // iterate through the ctx, keep count of all NON-Comment Ele Objects
-  // when count == index, then insert the new ele object there
-  curr_ele_obj = ctx->first(); // get head of ele
-  while (curr_ele_obj) {
-    if (curr_ele_obj->getRuleType() == TS_TYPE_COMMENT) { /* a comment ele */
-      last_comment = curr_ele_obj;
-      curr_ele_obj = ctx->next(curr_ele_obj);
-      has_comment  = true;
-      continue;
-    } else {
-      // special case if inserting the ele at head of CfgContext
-      if (index == 0) {
-        if (has_comment) {
-          // insert the ele after the last comment
-          err = ctx->insertEle(ele_obj, last_comment);
-          return err;
-        } else { // has no comments preceding first ele object
-          err = ctx->pushEle(ele_obj);
-          return err;
-        }
-      }
-
-      if (count == index - 1) { // insert the ele after this one
-        err = ctx->insertEle(ele_obj, curr_ele_obj);
-        return err; // DONE!
-      }
-      curr_ele_obj = ctx->next(curr_ele_obj);
-      count++;
-    }
-  }
-
-  return TS_ERR_FAIL; // invalid index
-}
-
-/*--------------------------------------------------------------
- * CfgContextRemoveEleAt
- *--------------------------------------------------------------
- * Removes the non-comment Ele at the specified index. start couting
- * non-comment ele's from 0, eg. if index = 3, that means remove the
- * fourth non-comment ELe in the CfgContext
- */
-TSMgmtError
-CfgContextRemoveEleAt(CfgContext *ctx, int index)
-{
-  CfgEleObj *curr_ele_obj;
-  int count = 0;
-
-  // iterate through the ctx, keep count of all NON-Comment Ele Objects
-  // when count == index, then insert the new ele object there
-  curr_ele_obj = ctx->first(); // get head of ele
-  while (curr_ele_obj) {
-    if (curr_ele_obj->getRuleType() == TS_TYPE_COMMENT) { /* a comment ele */
-      curr_ele_obj = ctx->next(curr_ele_obj);
-      continue;
-    } else {
-      if (count == index) { // reached the Ele
-        ctx->removeEle(curr_ele_obj);
-        return TS_ERR_OKAY; // DONE!
-      }
-      curr_ele_obj = ctx->next(curr_ele_obj);
-      count++;
-    }
-  }
-
-  return TS_ERR_FAIL; // invalid index
-}
-
-/*--------------------------------------------------------------
- * CfgContextRemoveAll
- *--------------------------------------------------------------
- * Removes all the Ele rules from Cfg Context leaving all the
- * comments behind
- */
-TSMgmtError
-CfgContextRemoveAll(CfgContext *ctx)
-{
-  CfgEleObj *curr_ele_obj, *ele_obj_ptr;
-
-  curr_ele_obj = ctx->first();
-  while (curr_ele_obj) {
-    if (curr_ele_obj->getRuleType() == TS_TYPE_COMMENT) { // skip comments
-      curr_ele_obj = ctx->next(curr_ele_obj);
-      continue;
-    } else {
-      ele_obj_ptr = ctx->next(curr_ele_obj);
-      ctx->removeEle(curr_ele_obj);
-    }
-    curr_ele_obj = ele_obj_ptr;
-  }
-
-  return TS_ERR_OKAY;
-}
diff --git a/mgmt/api/CfgContextManager.h b/mgmt/api/CfgContextManager.h
deleted file mode 100644
index b665dc6..0000000
--- a/mgmt/api/CfgContextManager.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/** @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: CfgContextManager.h (based on FileOp.h)
- * ------------------------------------------------------------------------
- * Purpose:
- *    Implements some of TSCfgContext functionality in the API; deals only
- *    with the CfgContext class though, not the TSCfgContext; typically
- *    the TSCfgContext function is a wrapper for the function whose purpose
- *    is to make the appropriate typecast to a CfgContext*
- *
- ***************************************************************************/
-
-#ifndef _CFG_CONTEXT_MANAGER_H
-#define _CFG_CONTEXT_MANAGER_H
-
-#include "mgmtapi.h"
-#include "CfgContextImpl.h"
-#include "CfgContextDefs.h"
-
-/***************************************************************************
- * CfgContext Operations
- ***************************************************************************/
-/* based on file to change, dequeues the add/rm rule, and translates it
- * into CoreAPI terms; because the file name stored , knows the format
- * of the rules in the queue
- */
-CfgContext *CfgContextCreate(TSFileNameT filetype);
-TSMgmtError CfgContextDestroy(CfgContext *ctx);
-TSMgmtError CfgContextGet(CfgContext *ctx);
-
-/***************************************************************************
- * CfgContext Operations
- ***************************************************************************/
-/* returns number of ele's in the CfgContext * */
-int CfgContextGetCount(CfgContext *ctx);
-
-/* user must typecast the TSCfgEle to appropriate TSEle before using */
-TSCfgEle *CfgContextGetEleAt(CfgContext *ctx, int index);
-CfgEleObj *CfgContextGetObjAt(CfgContext *ctx, int index);
-
-TSCfgEle *CfgContextGetFirst(CfgContext *ctx, TSCfgIterState *state);
-TSCfgEle *CfgContextGetNext(CfgContext *ctx, TSCfgIterState *state);
-
-TSMgmtError CfgContextMoveEleUp(CfgContext *ctx, int index);
-TSMgmtError CfgContextMoveEleDown(CfgContext *ctx, int index);
-
-TSMgmtError CfgContextAppendEle(CfgContext *ctx, TSCfgEle *ele);
-TSMgmtError CfgContextInsertEleAt(CfgContext *ctx, TSCfgEle *ele, int index);
-TSMgmtError CfgContextRemoveEleAt(CfgContext *ctx, int index);
-TSMgmtError CfgContextRemoveAll(CfgContext *ctx);
-
-#endif
diff --git a/mgmt/api/INKMgmtAPI.cc b/mgmt/api/INKMgmtAPI.cc
index 4703c2a..d044dac 100644
--- a/mgmt/api/INKMgmtAPI.cc
+++ b/mgmt/api/INKMgmtAPI.cc
@@ -36,7 +36,6 @@
 #include "ts/I_Layout.h"
 
 #include "mgmtapi.h"
-#include "CfgContextManager.h"
 #include "CfgContextImpl.h"
 #include "CfgContextUtils.h"
 #include "CoreAPI.h"
@@ -2116,96 +2115,6 @@ TSEventSignalCbUnregister(char *event_name, TSEventSignalFunc func)
   return EventSignalCbUnregister(event_name, func);
 }
 
-/***************************************************************************
- * API Helper Functions for Data Carrier Structures
- ***************************************************************************/
-
-/*--- abstracted file operations ------------------------------------------*/
-
-/* calls teh CfgContext class constructor */
-tsapi TSCfgContext
-TSCfgContextCreate(TSFileNameT file)
-{
-  return ((void *)CfgContextCreate(file));
-}
-
-/* calls the CfgContext class destructor */
-tsapi TSMgmtError
-TSCfgContextDestroy(TSCfgContext ctx)
-{
-  return (CfgContextDestroy((CfgContext *)ctx));
-}
-
-tsapi TSMgmtError
-TSCfgContextGet(TSCfgContext ctx)
-{
-  return (CfgContextGet((CfgContext *)ctx));
-}
-
-/*--- helper operations ---------------------------------------------------*/
-/* returns number of ele's in the TSCfgContext */
-int
-TSCfgContextGetCount(TSCfgContext ctx)
-{
-  return CfgContextGetCount((CfgContext *)ctx);
-}
-
-/* user must typecast the TSCfgEle to appropriate TSEle before using */
-TSCfgEle *
-TSCfgContextGetEleAt(TSCfgContext ctx, int index)
-{
-  return CfgContextGetEleAt((CfgContext *)ctx, index);
-}
-
-/* iterator */
-TSCfgEle *
-TSCfgContextGetFirst(TSCfgContext ctx, TSCfgIterState *state)
-{
-  return CfgContextGetFirst((CfgContext *)ctx, state);
-}
-
-TSCfgEle *
-TSCfgContextGetNext(TSCfgContext ctx, TSCfgIterState *state)
-{
-  return CfgContextGetNext((CfgContext *)ctx, state);
-}
-
-TSMgmtError
-TSCfgContextMoveEleUp(TSCfgContext ctx, int index)
-{
-  return CfgContextMoveEleUp((CfgContext *)ctx, index);
-}
-
-TSMgmtError
-TSCfgContextMoveEleDown(TSCfgContext ctx, int index)
-{
-  return CfgContextMoveEleDown((CfgContext *)ctx, index);
-}
-
-TSMgmtError
-TSCfgContextAppendEle(TSCfgContext ctx, TSCfgEle *ele)
-{
-  return CfgContextAppendEle((CfgContext *)ctx, ele);
-}
-
-TSMgmtError
-TSCfgContextInsertEleAt(TSCfgContext ctx, TSCfgEle *ele, int index)
-{
-  return CfgContextInsertEleAt((CfgContext *)ctx, ele, index);
-}
-
-TSMgmtError
-TSCfgContextRemoveEleAt(TSCfgContext ctx, int index)
-{
-  return CfgContextRemoveEleAt((CfgContext *)ctx, index);
-}
-
-TSMgmtError
-TSCfgContextRemoveAll(TSCfgContext ctx)
-{
-  return CfgContextRemoveAll((CfgContext *)ctx);
-}
-
 /* checks if the fields in the ele are all valid */
 bool
 TSIsValid(TSCfgEle *ele)
diff --git a/mgmt/api/Makefile.am b/mgmt/api/Makefile.am
index 2e32dff..d5385e5 100644
--- a/mgmt/api/Makefile.am
+++ b/mgmt/api/Makefile.am
@@ -36,8 +36,6 @@ lib_LTLIBRARIES = libtsmgmt.la
 libmgmtapi_la_SOURCES = \
   CfgContextImpl.cc \
   CfgContextImpl.h \
-  CfgContextManager.cc \
-  CfgContextManager.h \
   CfgContextUtils.cc \
   CfgContextUtils.h \
   CoreAPI.h \
diff --git a/mgmt/api/include/mgmtapi.h b/mgmt/api/include/mgmtapi.h
index 9d60d83..f3b7f1c 100644
--- a/mgmt/api/include/mgmtapi.h
+++ b/mgmt/api/include/mgmtapi.h
@@ -1022,119 +1022,12 @@ tsapi TSMgmtError TSEventSignalCbRegister(char *event_name, TSEventSignalFunc
fu
  */
 tsapi TSMgmtError TSEventSignalCbUnregister(char *event_name, TSEventSignalFunc func);
 
-/*--- abstracted file operations ------------------------------------------*/
-/* TSCfgContextCreate: allocates memory for an empty TSCfgContext for the specified file
- * Input:  file - the file
- * Output: TSCfgContext
- * Note: This function does not read the current rules in the file into
- * the TSCfgContext (must call TSCfgContextGet to do this). If you
- * do not call TSCfgContextGet before calling TSCfgContextCommit, then
- * you will overwite all the old rules in the config file!
- */
-tsapi TSCfgContext TSCfgContextCreate(TSFileNameT file);
-
-/* TSCfgContextDestroy: deallocates all memory for the TSCfgContext
- * Input:  ctx - the TSCfgContext to destroy
- * Output: TSMgmtError
- */
-tsapi TSMgmtError TSCfgContextDestroy(TSCfgContext ctx);
-
-/* TSCfgContextGet: retrieves all the Ele's for the file specified in the ctx and
- *                puts them into ctx; note that the ele's in the TSCfgContext don't
- *                all have to be of the same ele type
- * Input: ctx - where all the most currfile's eles are stored
- * Output: TSMgmtError
- *
- */
-tsapi TSMgmtError TSCfgContextGet(TSCfgContext ctx);
-
 /*--- TSCfgContext Operations --------------------------------------------*/
 /*
  * These operations are used to manipulate the opaque TSCfgContext type,
  * eg. when want to modify a file
  */
 
-/* TSCfgContextGetCount: returns number of Ele's in the TSCfgContext
- * Input:  ctx - the TSCfgContext to count the number of ele's in
- * Output: the number of Ele's
- */
-int TSCfgContextGetCount(TSCfgContext ctx);
-
-/* TSCfgContextGetEleAt: retrieves the Ele at the specified index; user must
- *                        typecast the TSCfgEle to appropriate TSEle before using
- * Input:  ctx   - the TSCfgContext to retrieve the ele from
- *         index - the Ele position desired; first Ele located at index 0
- * Output: the Ele (typecasted as an TSCfgEle)
- */
-TSCfgEle *TSCfgContextGetEleAt(TSCfgContext ctx, int index);
-
-/* TSCfgContextGetFirst: retrieves the first Ele in the TSCfgContext
- * Input:  ctx   - the TSCfgContext
- *         state - the current position in the Ele that the iterator is at
- * Output: returns first Ele in the ctx (typecasted as an TSCfgEle)
- */
-TSCfgEle *TSCfgContextGetFirst(TSCfgContext ctx, TSCfgIterState *state);
-
-/* TSCfgContextGetNext: retrieves the next ele in the ctx that's located after
- *                       the one pointed to by the TSCfgIterState
- * Input:  ctx   - the TSCfgContext
- *         state - the current position in the Ele that the iterator is at
- * Output: returns the next Ele in the ctx (typecasted as an TSCfgEle)
- */
-TSCfgEle *TSCfgContextGetNext(TSCfgContext ctx, TSCfgIterState *state);
-
-/* TSCfgContextMoveEleUp: shifts the Ele at the specified index one position up;
- *                         does nothing if Ele is at first position in the TSCfgContext
- * Input:  ctx   - the TSCfgContext
- *         index - the position of the Ele that needs to be shifted up
- * Output: TSMgmtError
- */
-TSMgmtError TSCfgContextMoveEleUp(TSCfgContext ctx, int index);
-
-/* TSCfgContextMoveEleDown: shifts the Ele at the specified index one position down;
- *                           does nothing if Ele is last in the TSCfgContext
- * Input:  ctx   - the TSCfgContext
- *         index - the position of the Ele that needs to be shifted down
- * Output: TSMgmtError
- */
-TSMgmtError TSCfgContextMoveEleDown(TSCfgContext ctx, int index);
-
-/* TSCfgContextAppendEle: appends the ele to the end of the TSCfgContext
- * Input:  ctx   - the TSCfgContext
- *         ele - the Ele (typecasted as an TSCfgEle) to append to ctx
- * Output: TSMgmtError
- * Note: When appending the ele to the TSCfgContext, this function does NOT
- *       make a copy of the ele passed in; it uses the same memory! So you probably
- *       do not want to append the ele and then free the memory for the ele
- *       without first removing the ele from the TSCfgContext
- */
-TSMgmtError TSCfgContextAppendEle(TSCfgContext ctx, TSCfgEle *ele);
-
-/* TSCfgContextInsertEleAt: inserts the ele at the specified index
- * Input:  ctx   - the TSCfgContext
- *         ele   - the Ele (typecasted as an TSCfgEle) to insert into ctx
- *         index - the position in ctx to insert the Ele
- * Output: TSMgmtError
- * Note: When inserting the ele into the TSCfgContext, this function does NOT
- *       make a copy of the ele passed in; it uses the same memory! So you probably
- *       do not want to insert the ele and then free the memory for the ele
- *       without first removing the ele from the TSCfgContext
- */
-TSMgmtError TSCfgContextInsertEleAt(TSCfgContext ctx, TSCfgEle *ele, int index);
-
-/* TSCfgContextRemoveEleAt: removes the Ele at the specified index from the TSCfgContext
- * Input:  ctx   - the TSCfgContext
- *         index - the position of the Ele in the ctx to remove
- * Output: TSMgmtError
- */
-TSMgmtError TSCfgContextRemoveEleAt(TSCfgContext ctx, int index);
-
-/* TSCfgContextRemoveAll: removes all Eles from the TSCfgContext
- * Input:  ctx   - the TSCfgContext
- * Output: TSMgmtError
- */
-TSMgmtError TSCfgContextRemoveAll(TSCfgContext ctx);
-
 /*--- TS Cache Inspector Operations --------------------------------------------*/
 
 /* TSLookupFromCacheUrl

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message