You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2010/11/20 16:18:10 UTC

svn commit: r1037238 [1/2] - in /trafficserver/traffic/branches/wccp: librecords/ proxy/mgmt2/ proxy/mgmt2/api2/include/ proxy/tsconfig/ proxy/wccp/

Author: amc
Date: Sat Nov 20 15:18:09 2010
New Revision: 1037238

URL: http://svn.apache.org/viewvc?rev=1037238&view=rev
Log:
First pass at TsConfig integration.

Added:
    trafficserver/traffic/branches/wccp/proxy/wccp/WccpMeta.h
      - copied, changed from r1037236, trafficserver/traffic/branches/wccp/proxy/wccp/AtsMeta.h
Removed:
    trafficserver/traffic/branches/wccp/proxy/wccp/AtsMeta.h
Modified:
    trafficserver/traffic/branches/wccp/librecords/Makefile.am
    trafficserver/traffic/branches/wccp/proxy/mgmt2/Makefile.am
    trafficserver/traffic/branches/wccp/proxy/mgmt2/api2/include/AtsBase.h
    trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuffer.h
    trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.cc
    trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.h
    trafficserver/traffic/branches/wccp/proxy/tsconfig/TsConfigTypes.h
    trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.cc
    trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.h
    trafficserver/traffic/branches/wccp/proxy/wccp/AtsBaseStatic.cc
    trafficserver/traffic/branches/wccp/proxy/wccp/Makefile.am
    trafficserver/traffic/branches/wccp/proxy/wccp/Wccp.h
    trafficserver/traffic/branches/wccp/proxy/wccp/WccpConfig.cc
    trafficserver/traffic/branches/wccp/proxy/wccp/WccpEndPoint.cc
    trafficserver/traffic/branches/wccp/proxy/wccp/WccpLocal.h
    trafficserver/traffic/branches/wccp/proxy/wccp/WccpMsg.cc
    trafficserver/traffic/branches/wccp/proxy/wccp/WccpStatic.cc
    trafficserver/traffic/branches/wccp/proxy/wccp/WccpUtil.h

Modified: trafficserver/traffic/branches/wccp/librecords/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/librecords/Makefile.am?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/librecords/Makefile.am (original)
+++ trafficserver/traffic/branches/wccp/librecords/Makefile.am Sat Nov 20 15:18:09 2010
@@ -25,6 +25,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/proxy/mgmt2/cluster \
   -I$(top_srcdir)/proxy/mgmt2/web2 \
   -I$(top_srcdir)/proxy/mgmt2/api2/include \
+  -I$(top_srcdir)/proxy/tsconfig \
   -I$(top_srcdir)/proxy/mgmt2/utils
 
 noinst_LIBRARIES = libreclocal.a librecprocess.a

Modified: trafficserver/traffic/branches/wccp/proxy/mgmt2/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/mgmt2/Makefile.am?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/mgmt2/Makefile.am (original)
+++ trafficserver/traffic/branches/wccp/proxy/mgmt2/Makefile.am Sat Nov 20 15:18:09 2010
@@ -36,6 +36,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/proxy/mgmt2/preparse \
   -I$(top_srcdir)/proxy/mgmt2/stats \
   -I$(top_srcdir)/proxy/mgmt2/utils \
+  -I$(top_srcdir)/proxy/tsconfig \
   -I$(top_srcdir)/proxy/mgmt2/web2
 
 MGMT_DEFS = @MGMT_DEFS@
@@ -119,4 +120,4 @@ traffic_manager_LDADD = \
   @LIBEXPAT@ @LIBPCRE@ \
   @LIBSSL@ @LIBDB@ @LIBSQLITE3@ @LIBTCL@ @LIBICONV@ \
   @LIBM@ @LIBDL@ @LIBSOCKET@ @LIBNSL@ @LIBRESOLV@ \
-  @LIBTHREAD@ @LIBRT@ @LIBEXECINFO@ @LIBCAP@ ../wccp/libwccp.a -lconfig++
+  @LIBTHREAD@ @LIBRT@ @LIBEXECINFO@ @LIBCAP@ ../wccp/libwccp.a ../tsconfig/libtsconfig.a

Modified: trafficserver/traffic/branches/wccp/proxy/mgmt2/api2/include/AtsBase.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/mgmt2/api2/include/AtsBase.h?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/mgmt2/api2/include/AtsBase.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/mgmt2/api2/include/AtsBase.h Sat Nov 20 15:18:09 2010
@@ -27,65 +27,4 @@ namespace ats {
 
   /// Standardized null file descriptor.
   int const NO_FD = -1;
-
-  /** A chunk of memory.
-      A convenience class because we pass this kind of pair frequently.
-   */
-  struct Buffer {
-    typedef Buffer self; ///< Self reference type.
-
-    char* m_ptr; ///< Pointer to base of memory chunk.
-    size_t m_size; ///< Size of memory chunk.
-
-    /// Default constructor.
-    /// Elements are in unintialized state.
-    Buffer();
-
-    /// Construct from pointer and size.
-    Buffer(
-      char* ptr, ///< Pointer to buffer.
-      size_t n ///< Size of buffer.
-    );
-
-    /// Set the chunk.
-    /// Any previous values are discarded.
-    /// @return @c this object.
-    self& set(
-      char* ptr, ///< Buffer address.
-      size_t n ///< Buffer size.
-    );
-  };
-
-  /** Base class for ATS exception.
-      Clients should subclass as appropriate. This is intended to carry
-      pre-allocated text along so that it can be thrown without any
-      adddition memory allocation.
-  */
-  class Exception {
-  public:
-    /// Default constructor.
-    Exception();
-    /// Construct with alternate @a text.
-    Exception(
-      const char* text ///< Alternate text for exception.
-    );
-
-    static char const* const DEFAULT_TEXT;
-  protected:
-    char const* m_text;
-  };
-
-  // ----------------------------------------------------------
-  // Inline implementations.
-
-  inline Buffer::Buffer() { }
-  inline Buffer::Buffer(char* ptr, size_t n) : m_ptr(ptr), m_size(n) { }
-  inline Buffer& Buffer::set(char* ptr, size_t n) {
-    m_ptr = ptr;
-    m_size = n;
-    return *this;
-  }
-
-  inline Exception::Exception() : m_text(DEFAULT_TEXT) { }
-  inline Exception::Exception(char const* text) : m_text(text) { }
 }

Modified: trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuffer.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuffer.h?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuffer.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuffer.h Sat Nov 20 15:18:09 2010
@@ -1,3 +1,6 @@
+# if ! defined TS_BUFFER_HEADER
+# define TS_BUFFER_HEADER
+
 /** @file
     Apach Traffic Server commons.
     Definitions that are standardized across ATS.
@@ -8,6 +11,8 @@
 # else
 # include <unistd.h>
 # endif
+
+// For memcmp()
 # include <memory.h>
 
 /// Apache Traffic Server commons.
@@ -154,3 +159,5 @@ namespace ts {
       return _size == that._size && 0 == memcmp(_ptr, that._ptr, _size);
   }
 }
+
+# endif // TS_BUFFER_HEADER

Modified: trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.cc?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.cc Sat Nov 20 15:18:09 2010
@@ -116,13 +116,17 @@ void Builder::pathOpen(Token const&) {
 }
 void Builder::pathTag(Token const& token) {
     _path.append(Buffer(token._s, token._n));
-    if (_extent._ptr) _extent._size = token._s - _extent._ptr + token._n;
-    else _extent.set(token._s, token._n);
+    if (_extent._ptr) {
+      _extent._size = token._s - _extent._ptr + token._n;
+    } else {
+      _extent.set(token._s, token._n);
+      _loc = token._loc;
+    }
 }
 void Builder::pathIndex(Token const& token){
-    // We take advantage of the lexer - token will always be a valid digit string
-    // that is followed by a non-digit or the FLEX required double null at the end
-    // of the input buffer.
+    // We take advantage of the lexer - token will always be a valid
+    // digit string that is followed by a non-digit or the FLEX
+    // required double null at the end of the input buffer.
     _path.append(Buffer(0, static_cast<size_t>(atol(token._s))));
     if (_extent._ptr) _extent._size = token._s - _extent._ptr + token._n;
     else _extent.set(token._s, token._n);
@@ -130,8 +134,8 @@ void Builder::pathIndex(Token const& tok
 
 void Builder::pathClose(Token const&) {
     Rv<Value> cv = _v.makePath(_path, _name);
-    if (cv.isOK()) cv.result().setText(_extent);
-
+    if (cv.isOK())
+      cv.result().setText(_extent).setSource(_loc._line, _loc._col);
     _name.reset();
     _extent.reset();
 }
@@ -139,17 +143,28 @@ void Builder::pathClose(Token const&) {
 void Builder::literalValue(Token const& token) {
     Rv<Value> cv;
     ConstBuffer text(token._s, token._n);
+
+    // It's just too painful to use these strings with standard
+    // libraries without nul terminating these. For strings we convert
+    // the trailing quote. For integers we abuse the fact that the
+    // parser can't reduce using this token before the lexer has read
+    // at least one char ahead.
+
+    // Note the nul is *not* included in the reported length.
+
     if (INTEGER == token._type) {
         cv = _v.makeInteger(text, _name);
-        if (!cv.isOK()) _errata.join(cv.errata());
+        token._s[token._n] = 0;
     } else if (STRING == token._type) {
+        // Don't include the quotes.
         ++text._ptr, text._size -= 2;
         cv = _v.makeString(text, _name);
-        // Strip enclosing quotes.
-        if (!cv.isOK()) _errata.join(cv.errata());
+        token._s[token._n-1] = 0;
     } else {
         msg::logf(_errata, msg::WARN, PRE "Unexpected literal type %d.", token._type);
     }
+    if (!cv.isOK()) _errata.join(cv.errata());
+    if (cv.result()) cv.result().setSource(token._loc._line, token._loc._col);
     _name.set(0,0); // used, so clear it.
 }
 void Builder::invalidToken(Token const&) { }

Modified: trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.h?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/tsconfig/TsBuilder.h Sat Nov 20 15:18:09 2010
@@ -60,6 +60,7 @@ protected:
     Value _v; ///< Current value.
     Buffer _name; ///< Pending group name, if any.
     Buffer _extent; ///< Accumulator for multi-token text.
+    Location _loc; ///< Cache for multi-token text.
     Path _path; ///< Path accumulator
 
     /// Initialization, called from constructors.

Modified: trafficserver/traffic/branches/wccp/proxy/tsconfig/TsConfigTypes.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/tsconfig/TsConfigTypes.h?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/tsconfig/TsConfigTypes.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/tsconfig/TsConfigTypes.h Sat Nov 20 15:18:09 2010
@@ -10,11 +10,21 @@
 # if defined(__cplusplus)
 namespace ts { namespace config {
 # endif
+
+/** A location in the source stream.
+    @internal At some point we may need to add stream information,
+    e.g. file name, once includes are supported. Or should that
+    be the caller's responsibility?
+ */
 struct Location {
     int _col; ///< Column.
     int _line; ///< Line.
 };
 
+/** A token from the source stream.
+    @internal We should use ts::Buffer here, but because this
+    has to work in C as well, it's less painful to do it by hand.
+ */
 struct Token {
   char* _s; ///< Text of token.
   size_t _n; ///< Text length.
@@ -30,4 +40,4 @@ struct Token {
 #endif
 
 
-# endif // TS_CONFIG_TYPES_HEADER
\ No newline at end of file
+# endif // TS_CONFIG_TYPES_HEADER

Modified: trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.cc?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.cc Sat Nov 20 15:18:09 2010
@@ -64,6 +64,7 @@ detail::ValueTable::make(ValueIndex pidx
         item = &(_ptr->_values[n]);
         item->_parent = pidx;
         parent->_children.push_back(n);
+        item->_local_index = parent->_children.size() - 1;
         // Only use the name if the parent is a group.
         if (GroupValue == parent->_type) item->_name = name;
         zret = n; // mark for return to caller.
@@ -94,9 +95,9 @@ detail::ValueTable::alloc(size_t n) {
 
 // ---------------------------------------------------------------------------
 Value
-Value::operator [] (size_t idx) {
+Value::operator [] (size_t idx) const {
     Value zret;
-    detail::ValueItem* item = this->item();
+    detail::ValueItem const* item = this->item();
     if (item && idx < item->_children.size()) {
         zret = Value(_config, item->_children[idx]);
         if (PathValue == zret.getType()) zret = _config.getRoot().find(_config._table[zret._vidx]._path);
@@ -105,11 +106,11 @@ Value::operator [] (size_t idx) {
 }
 
 Value
-Value::operator [] (ConstBuffer const& name) {
+Value::operator [] (ConstBuffer const& name) const {
     Value zret;
-    detail::ValueItem* item = this->item();
+    detail::ValueItem const* item = this->item();
     if (item) {
-        for ( detail::ValueItem::ChildGroup::iterator spot = item->_children.begin(), limit = item->_children.end(); spot != limit; ++spot ) {
+        for ( detail::ValueItem::ChildGroup::const_iterator spot = item->_children.begin(), limit = item->_children.end(); spot != limit; ++spot ) {
             if (_config._table[*spot]._name == name) {
                 zret = Value(_config, *spot);
                 if (PathValue == zret.getType()) zret = _config.getRoot().find(_config._table[zret._vidx]._path);
@@ -298,9 +299,9 @@ Path::Parser::parse(ConstBuffer *cbuff) 
 }
 // ---------------------------------------------------------------------------
 Value
-Configuration::getRoot() {
-    this->_table.forceRootItem();
-    return Value(*this, 0);
+Configuration::getRoot() const {
+  const_cast<self*>(this)->_table.forceRootItem();
+  return Value(*this, 0);
 }
 
 Rv<Configuration>

Modified: trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.h?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/tsconfig/TsValue.h Sat Nov 20 15:18:09 2010
@@ -192,14 +192,14 @@ namespace detail {
     /// Get item type.
     ValueType getType() const;
   protected:
-    /// Type of value.
-    ValueType _type;
-    /// Index of parent value.
-    ValueIndex _parent;
-    /// Text of value (if scalar).
-    ConstBuffer _text;
-    /// Local name of value, if available.
-    ConstBuffer _name;
+    ValueType _type;      ///< Type of value.
+    ValueIndex _parent;   ///< Table index of parent value.
+    ConstBuffer _text;    ///< Text of value (if scalar).
+    ConstBuffer _name;    ///< Local name of value, if available.
+    size_t _local_index;  ///< Index among siblings.
+    int _srcLine;         ///< Source line.
+    int _srcColumn;       ///< Source column.
+
     /// Container for children of this item.
     typedef std::vector<ValueIndex> ChildGroup;
     /// Child items of this item.
@@ -337,7 +337,28 @@ public:
       The root is always a group and has no name.
       @return The root value.
   */
-  Value getRoot();
+  Value getRoot() const;
+
+  /// Get the number of child values on the root value.
+  size_t childCount() const;
+  /** Root value child access by @a index
+      @return The child or a @c Void value if there is no child with @a name.
+  */
+  Value operator [] (
+    size_t idx ///< Index of child value.
+  ) const;
+  /** Root value child access by @a name.
+      @return The child or a @c Void value if there is no child with @a name.
+  */
+  Value operator [] (
+    ConstBuffer const& name
+  ) const;
+  /** Root value child access by @a name.
+      @return The child or a @c Void value if there is no child with @a name.
+  */
+  Value operator [] (
+    char const* name ///< Null terminated string.
+  ) const;
 
   /** Find a value.
       @return The value if found, an void valid if not.
@@ -409,11 +430,31 @@ public:
     ConstBuffer const& text
   );
 
+  /** Get local name.
+      This gets the local name of the value. That is the name by which it
+      is known to its parent container.
+
+      @internal Only works for groups now. It should be made to work
+      for lists. This would require allocating strings for each index,
+      which should be shared across values. For instance, all values
+      at index 1 should return the same string "1", not separately
+      allocated for each value.
+   */
+  ConstBuffer const& getName() const;
+  /** Get local index.
+      This gets the local index for the value. This is the index which,
+      if used on the parent, would yield this value.
+      @return The local index.
+   */
+  size_t getIndex() const;
+
   /// Test for a literal value.
-  /// @return @c true if the value is a literal, @c false if it is a container or invalid.
+  /// @return @c true if the value is a literal,
+  /// @c false if it is a container or invalid.
   bool isLiteral() const;
   /// Test for value container.
-  /// @return @c true if the value is a container (can have child values), @c false otherwise.
+  /// @return @c true if the value is a container (can have child values),
+  /// @c false otherwise.
   bool isContainer() const;
   /// Get the parent value.
   Value getParent() const;
@@ -427,39 +468,41 @@ public:
   */
   Value operator [] (
     size_t idx ///< Index of child value.
-  );
+  ) const;
   /** Child access by @a name.
       @return The child or a @c Void value if there is no child with @a name.
   */
   Value operator [] (
     ConstBuffer const& name
-  );
+  ) const;
   /** Child access by @a name.
       @return The child or a @c Void value if there is no child with @a name.
   */
   Value operator [] (
     char const* name ///< Null terminated string.
-  );
+  ) const;
 
-  /** Creating child values.
-
-      These methods all take an optional @a name argument. This is required if @c this
-      is a @c Group and ignored if @c this is a @c List.
+  /** @name Creating child values.
 
+      These methods all take an optional @a name argument. This is
+      required if @c this is a @c Group and ignored if @c this is a @c
+      List.
 
       These methods will fail if
       - @c this is not a container.
       - @c this is a @c Group and no @a name is provided.
 
-      @note Currently for groups, duplicate names are not detected. The duplicates
-      will be inaccessible by name but can still be found by index. This is a problem
-      but I am still pondering the appropriate solution.
+      @note Currently for groups, duplicate names are not
+      detected. The duplicates will be inaccessible by name but can
+      still be found by index. This is a problem but I am still
+      pondering the appropriate solution.
 
       @see isContainer
       @return The new value, or an invalid value plus errata on failure.
 
-      @internal I original had this as a single method, but changed to separate per type.
-      Overall less ugly because we can get the arguments more useful.
+      @internal I original had this as a single method, but changed to
+      separate per type.  Overall less ugly because we can get the
+      arguments more useful.
   */
   //@{
   /// Create a @c String value.
@@ -518,6 +561,28 @@ public:
   */
   self& reset();
 
+  /// Set source line.
+  /// @return @c this object.
+  self& setSourceLine(
+    int line ///< Line in source stream.
+  );
+  /// Set source column.
+  /// @return @c this object.
+  self& setSourceColumn(
+    int col ///< Column in source stream.
+  );
+  /// Set the source location.
+  self& setSource(
+    int line, ///< Line in source stream.
+    int col ///< Column in source stream.
+  );
+  /// Get source line.
+  /// @return The line in the source stream for this value.
+  int getSourceLine() const;
+  /// Get source column.
+  /// @return The column in the source stream for this value.
+  int getSourceColumn() const;
+
 protected:
   // Note: We store an index and not a pointer because a pointer will go stale
   // if any items are added or removed from the underlying table.
@@ -570,7 +635,20 @@ inline ValueType Value::getType() const 
 inline ConstBuffer const& Value::getText() const {
   return this->hasValue() ? _config._table[_vidx]._name : detail::NULL_CONST_BUFFER;
 }
-inline Value& Value::setText(ConstBuffer const& text) { if (this->hasValue()) _config._table[_vidx]._text = text; return *this; }
+inline Value& Value::setText(ConstBuffer const& text) {
+  detail::ValueItem* item = this->item();
+  if (item) item->_text = text;
+  return *this;
+}
+inline ConstBuffer const& Value::getName() const {
+  detail::ValueItem const* item = this->item();
+  return item ? item->_name : detail::NULL_CONST_BUFFER;
+}
+inline size_t Value::getIndex() const {
+  detail::ValueItem const* item = this->item();
+  return item ? item->_local_index : 0;
+}
+  
 inline bool Value::isLiteral() const { return 0 != (detail::IS_LITERAL & detail::Type_Property[this->getType()]); }
 inline bool Value::isContainer() const { return 0 != (detail::IS_CONTAINER & detail::Type_Property[this->getType()]); }
 inline Value Value::getParent() const { return this->hasValue() ? Value(_config, _config._table[_vidx]._parent) : Value(); }
@@ -578,8 +656,34 @@ inline bool Value::isRoot() const { retu
 inline Value& Value::reset() { _config = Configuration(); _vidx = detail::NULL_VALUE_INDEX; return *this; }
 inline detail::ValueItem* Value::item() { return this->hasValue() ? &(_config._table[_vidx]) : 0; }
 inline detail::ValueItem const* Value::item() const { return const_cast<self*>(this)->item(); }
-inline Value Value::operator [] (char const* name) { return (*this)[ConstBuffer(name, strlen(name))]; }
+inline Value Value::operator [] (char const* name) const { return (*this)[ConstBuffer(name, strlen(name))]; }
 inline Value Value::find(char const* path) { return this->find(ConstBuffer(path, strlen(path))); }
+inline int Value::getSourceLine() const {
+  detail::ValueItem const* item = this->item();
+  return item ? item->_srcLine : 0;
+}
+inline int Value::getSourceColumn() const {
+  detail::ValueItem const* item = this->item();
+  return item ? item->_srcColumn : 0;
+}
+inline Value& Value::setSourceLine(int line) {
+  detail::ValueItem* item = this->item();
+  if (item) item->_srcLine = line;
+  return *this;
+}
+inline Value& Value::setSourceColumn(int col) {
+  detail::ValueItem* item = this->item();
+  if (item) item->_srcColumn = col;
+  return *this;
+}
+inline Value& Value::setSource(int line, int col) {
+  detail::ValueItem* item = this->item();
+  if (item) {
+    item->_srcLine = line;
+    item->_srcColumn = col;
+  }
+  return *this;
+}
 
 inline Path::ImplType::ImplType() { }
 
@@ -598,6 +702,10 @@ inline bool Configuration::operator ! ()
 inline Configuration::operator detail::PseudoBool::Type() const { return _table.operator detail::PseudoBool::Type(); }
 inline Value Configuration::find( char const* path ) { return this->getRoot().find(path); }
 inline Buffer Configuration::alloc(size_t n) { return _table.alloc(n);  }
+inline size_t Configuration::childCount() const { return this->getRoot().childCount(); }
+inline Value Configuration::operator [] (size_t idx) const { return (this->getRoot())[idx]; }
+inline Value Configuration::operator [] ( ConstBuffer const& name ) const { return (this->getRoot())[name]; }
+inline Value Configuration::operator [] ( char const* name ) const { return (this->getRoot())[name]; }
 
 }} // namespace ts::config
 

Modified: trafficserver/traffic/branches/wccp/proxy/wccp/AtsBaseStatic.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/wccp/AtsBaseStatic.cc?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/wccp/AtsBaseStatic.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/wccp/AtsBaseStatic.cc Sat Nov 20 15:18:09 2010
@@ -1,5 +1,5 @@
-# include "AtsBase.h"
+# include <TsException.h>
 
-namespace ats {
+namespace ts {
   char const* const Exception::DEFAULT_TEXT = "An unexpected error occurred.";
 }

Modified: trafficserver/traffic/branches/wccp/proxy/wccp/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/wccp/Makefile.am?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/wccp/Makefile.am (original)
+++ trafficserver/traffic/branches/wccp/proxy/wccp/Makefile.am Sat Nov 20 15:18:09 2010
@@ -18,14 +18,15 @@
 #  limitations under the License.
 
 AM_CPPFLAGS = \
-  -I$(top_srcdir)/proxy/mgmt2/api2/include \
-  -DPKGSYSUSER=\"$(pkgsysuser)\"
+  -I$(top_srcdir)/proxy/tsconfig \
+  -I$(top_srcdir)/proxy/api/ts
+
 
 #WCCP_DEFS = @WCCP_DEFS@
 #DEFS += $(WCCP_DEFS)
 
 noinst_LIBRARIES = libwccp.a
-noinst_PROGRAMS = test-cache
+#noinst_PROGRAMS = test-cache
 
 libwccp_a_SOURCES = \
   Wccp.h \
@@ -34,15 +35,11 @@ libwccp_a_SOURCES = \
   WccpMsg.cc \
   WccpEndPoint.cc \
   WccpConfig.cc \
-  Errata.h \
-  Errata.cc \
   AtsBase.h \
   AtsBaseStatic.cc \
-  AtsMeta.h \
-  NumericType.h \
-  IntrusivePtr.h
+  AtsMeta.h
 
-test_cache_SOURCES = \
-  wccp-test-cache.cc
+#test_cache_SOURCES = \
+#  wccp-test-cache.cc
 
-test_cache_LDADD = ./libwccp.a -lconfig++ -lcrypto
\ No newline at end of file
+#test_cache_LDADD = ./libwccp.a -lconfig++ -lcrypto
\ No newline at end of file

Modified: trafficserver/traffic/branches/wccp/proxy/wccp/Wccp.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/wccp/Wccp.h?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/wccp/Wccp.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/wccp/Wccp.h Sat Nov 20 15:18:09 2010
@@ -1,5 +1,5 @@
-# if ! defined(ATS_WCCP_API_H)
-# define ATS_WCCP_API_H
+# if ! defined(ATS_WCCP_API_HEADER)
+# define ATS_WCCP_API_HEADER
 
 /** @file
     WCCP (v2) support API.
@@ -7,18 +7,19 @@
     Sponsored by: Pavlov Media
  */
 
-# include "AtsBase.h"
-# include "IntrusivePtr.h"
-# include "Errata.h"
-
+# include <TsBuffer.h>
+# include <Errata.h>
 # include <memory.h>
+# include <ink_port.h>
+// Nasty, using this with no prefix. The value is still available
+// in TS_VERSION_STRING.
+# undef VERSION
 
 // INADDR_ANY
 # include <netinet/in.h>
 
 /// WCCP Support.
-namespace Wccp {
-using namespace ats::fixed_integers;
+namespace wccp {
 
 /// Forward declare implementation classes.
 class Impl;
@@ -97,7 +98,7 @@ public:
   static uint8 const RESERVED = 50;
   
   /// Number of ports in component (defined by protocol).
-  static int const N_PORTS = 8;
+  static size_t const N_PORTS = 8;
 
   /// @name Flag mask values.
   //@{
@@ -224,17 +225,21 @@ public:
   /// in @c select.
   int getSocket() const;
 
-  /// Use MD5 based security, specifying the @a key.
+  /// Use MD5 based security with @a key.
   void useMD5Security(
     char const* key ///< Shared hash key.
   );
+  /// Use MD5 based security with @a key.
+  void useMD5Security(
+    ts::ConstBuffer const& key ///< Shared hash key.
+  );
 
   /// Perform house keeping, including sending outbound messages.
   int housekeeping();
 
   /// Recieve and process a message on the socket.
   /// @return 0 for success, -ERRNO on system error.
-  ats::Rv<int> handleMessage();
+  ts::Rv<int> handleMessage();
 
 protected:
   /// Default constructor.
@@ -244,7 +249,7 @@ protected:
   /// Force virtual destructor
   virtual ~EndPoint();
 
-  ats::IntrusivePtr<ImplType> m_ptr; ///< Implementation instance.
+  ts::IntrusivePtr<ImplType> m_ptr; ///< Implementation instance.
 
   /** Get a pointer to the implementation instance, creating it if needed.
       @internal This is paired with @c make so that the implementation check
@@ -271,7 +276,7 @@ public:
   ~Cache();
 
   /// Define services from a configuration file.
-  ats::Errata loadServicesFromFile(
+  ts::Errata loadServicesFromFile(
     char const* path ///< Path to file.
   );
 
@@ -476,7 +481,11 @@ inline Cache::Service::Service(
   detail::cache::GroupData& group
 ) : m_cache(cache), m_group(&group) {
 }
+
+inline void EndPoint::useMD5Security(char const* key) {
+  this->useMD5Security(ts::ConstBuffer(key, strlen(key)));
+}
 // ------------------------------------------------------
 
 } // namespace Wccp
-# endif // Include guard
+# endif // include guard.

Modified: trafficserver/traffic/branches/wccp/proxy/wccp/WccpConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/wccp/WccpConfig.cc?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/wccp/WccpConfig.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/wccp/WccpConfig.cc Sat Nov 20 15:18:09 2010
@@ -1,35 +1,47 @@
 # include "WccpLocal.h"
 # include <sstream>
-# include <libconfig.h++>
+# include <TsValue.h>
 # include <arpa/inet.h>
 # include <iostream>
 # include <errno.h>
+# include <stdlib.h>
+
+using ts::config::Configuration;
+using ts::config::Value;
 
 // Support that must go in the standard namespace.
 namespace std {
-ostream& operator << ( ostream& s, libconfig::Setting::Type const& t ) {
+# if 0
+ostream& operator << ( ostream& s, ts::config::ValueType const& t ) {
   switch (t) {
-  case libconfig::Setting::TypeString: s << "string"; break;
-  case libconfig::Setting::TypeInt: s << "integer"; break;
-  case libconfig::Setting::TypeInt64: s << "integer (64 bit)"; break;
-  case libconfig::Setting::TypeFloat: s << "floating point"; break;
-  case libconfig::Setting::TypeBoolean: s << "boolean"; break;
-  case libconfig::Setting::TypeArray: s << "array"; break;
-  case libconfig::Setting::TypeList: s << "list"; break;
-  case libconfig::Setting::TypeGroup: s << "group"; break;
+  case ts::config::ValueTypeString: s << "string"; break;
+  case ts::config::ValueTypeInt: s << "integer"; break;
+  case ts::config::ValueTypeInt64: s << "integer (64 bit)"; break;
+  case ts::config::ValueTypeFloat: s << "floating point"; break;
+  case ts::config::ValueTypeBoolean: s << "boolean"; break;
+  case ts::config::ValueTypeArray: s << "array"; break;
+  case ts::config::ValueTypeList: s << "list"; break;
+  case ts::config::GroupValue: s << "group"; break;
   default: s << "*unknown*"; break;
   };
   return s;
 }
+# endif
+inline ostream& operator << ( ostream& s, ts::ConstBuffer const& b ) {
+  if (b._ptr) s.write(b._ptr, b._size);
+  else s << b._size;
+  return s;
+}
+
 } // namespace std
 
 // WCCP related things that are file local.
 namespace {
-using namespace Wccp;
+using namespace wccp;
 
 // Scratch global list of seed router addresses.
 // Yeah, not thread safe, but it's just during configuration load.
-std::vector<ats::uint32> Seed_Router;
+std::vector<uint32> Seed_Router;
 
 // Names used for various elements and properties.
 static char const * const SVC_NAME = "service";
@@ -71,113 +83,123 @@ CfgString ASSIGN_OPTS[] = { { "hash" } ,
 
 CfgString HASH_OPTS[] = { { "src_ip" } , { "dst_ip" } , { "src_port" } , { "dst_port" } };
 
-ats::Errata::Code code_max(ats::Errata const& err) {
-  ats::Errata::Code zret = std::numeric_limits<ats::Errata::Code::raw_type>::min();
-  ats::Errata::const_iterator spot = err.begin();
-  ats::Errata::const_iterator limit = err.end();
+ts::Errata::Code code_max(ts::Errata const& err) {
+  ts::Errata::Code zret = std::numeric_limits<ts::Errata::Code::raw_type>::min();
+  ts::Errata::const_iterator spot = err.begin();
+  ts::Errata::const_iterator limit = err.end();
   for ( ; spot != limit ; ++spot )
     zret = std::max(zret, spot->getCode());
   return zret;
 }
 
-ats::Errata::Message File_Syntax_Error(int line, char const* text) {
+struct ValueNamePrinter {
+  Value const& _v;
+  ValueNamePrinter(Value const& v) : _v(v) {}
+};
+
+std::ostream& operator << ( std::ostream& out, ValueNamePrinter const& v ) {
+  ts::ConstBuffer const& name = v._v.getName();
+  if (name._ptr) out << "'" << name << "'";
+  else out << v._v.getIndex();
+  return out;
+}
+
+ts::Errata::Message File_Syntax_Error(int line, char const* text) {
   std::ostringstream out;
   out << "Service configuration error. Line "
       << line
       << ": " << text
     ;
-  return ats::Errata::Message(1, LVL_FATAL, out.str());
+  return ts::Errata::Message(1, LVL_FATAL, out.str());
 }
 
-ats::Errata::Message File_Read_Error(char const* text) {
+ts::Errata::Message File_Read_Error(char const* text) {
   std::ostringstream out;
   out << "Failed to parse configuration file."
       << ": " << text
     ;
-  return ats::Errata::Message(2, LVL_FATAL, out.str());
+  return ts::Errata::Message(2, LVL_FATAL, out.str());
 }
 
-ats::Errata::Message Unable_To_Create_Service_Group(int line) {
+ts::Errata::Message Unable_To_Create_Service_Group(int line) {
   std::ostringstream out;
   out << "Unable to create service group at line " << line
       << " because of configuration errors."
     ;
-  return ats::Errata::Message(23, LVL_FATAL, out.str());
+  return ts::Errata::Message(23, LVL_FATAL, out.str());
 }
 
-ats::Errata::Message Services_Not_Found() {
-  return ats::Errata::Message(3, LVL_INFO, "No services found in configuration.");
+ts::Errata::Message Services_Not_Found() {
+  return ts::Errata::Message(3, LVL_INFO, "No services found in configuration.");
 }
 
-ats::Errata::Message Services_Not_A_Sequence() {
-  return ats::Errata::Message(4, LVL_INFO, "The 'services' setting was not a list nor array.");
+ts::Errata::Message Services_Not_A_Sequence() {
+  return ts::Errata::Message(4, LVL_INFO, "The 'services' setting was not a list nor array.");
 }
 
-ats::Errata::Message Service_Not_A_Group(int line) {
+ts::Errata::Message Service_Not_A_Group(int line) {
   std::ostringstream out;
   out << "'" << SVC_NAME << "' must be a group at line "
       << line << "."
     ;
-  return ats::Errata::Message(5, LVL_WARN, out.str());
+  return ts::Errata::Message(5, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Service_Type_Defaulted(Wccp::ServiceGroup::Type type, int line) {
+ts::Errata::Message Service_Type_Defaulted(wccp::ServiceGroup::Type type, int line) {
   std::ostringstream out;
   out << "'type' not found in " << SVC_NAME << " at line "
       << line << "' -- defaulting to "
-      << ( type == Wccp::ServiceGroup::STANDARD ? "STANDARD" : "DYNAMIC" )
+      << ( type == wccp::ServiceGroup::STANDARD ? "STANDARD" : "DYNAMIC" )
     ;
-  return ats::Errata::Message(6, LVL_INFO, out.str());
+  return ts::Errata::Message(6, LVL_INFO, out.str());
 }
 
-ats::Errata::Message Service_Type_Invalid(char const* text, int line) {
+ts::Errata::Message Service_Type_Invalid(ts::ConstBuffer const& text, int line) {
   std::ostringstream out;
   out << "Service type '" << text 
       << "' at line " << line
       << " invalid. Must be \"STANDARD\" or \"DYNAMIC\""
     ;
-  return ats::Errata::Message(7, LVL_WARN, out.str());
+  return ts::Errata::Message(7, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Prop_Not_Found(char const* prop_name, char const* group_name, int line) {
+ts::Errata::Message Prop_Not_Found(char const* prop_name, char const* group_name, int line) {
   std::ostringstream out;
   out << "Required '" << prop_name << "' property not found in '"
       << group_name << "' at line " << line << "."
     ;
-  return ats::Errata::Message(8, LVL_WARN, out.str());
+  return ts::Errata::Message(8, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Prop_Invalid_Type(
-  libconfig::Setting& prop_cfg,
-  libconfig::Setting::Type expected
+ts::Errata::Message Prop_Invalid_Type(
+  Value const& prop_cfg,
+  ts::config::ValueType expected
 ) {
   std::ostringstream out;
   out << "'" << prop_cfg.getName() << "' at line " << prop_cfg.getSourceLine()
       << " is of type '" << prop_cfg.getType()
       << "' instead of required type '" << expected << "'."
     ;
-  return ats::Errata::Message(9, LVL_WARN, out.str());
+  return ts::Errata::Message(9, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Prop_List_Invalid_Type(
-  libconfig::Setting& elt_cfg, ///< List element.
-  libconfig::Setting::Type expected
+ts::Errata::Message Prop_List_Invalid_Type(
+  Value const& elt_cfg, ///< List element.
+  ts::config::ValueType expected
 ) {
   std::ostringstream out;
-  out << "Element ";
-  if (elt_cfg.getName()) out << "'" << elt_cfg.getName() << "'";
-  else out << elt_cfg.getIndex();
-  out << " at line " << elt_cfg.getSourceLine()
+  out << "Element " << ValueNamePrinter(elt_cfg)
+      << " at line " << elt_cfg.getSourceLine()
       << " in the aggregate property '" << elt_cfg.getParent().getName()
       << "' is of type '" << elt_cfg.getType()
       << "' instead of required type '" << expected << "'."
     ;
-  return ats::Errata::Message(9, LVL_WARN, out.str());
+  return ts::Errata::Message(9, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Svc_Prop_Out_Of_Range(
+ts::Errata::Message Svc_Prop_Out_Of_Range(
   char const* name,
-  libconfig::Setting& elt_cfg,
+  Value const& elt_cfg,
   int v, int min, int max
 ) {
   std::ostringstream out;
@@ -187,100 +209,100 @@ ats::Errata::Message Svc_Prop_Out_Of_Ran
       << " that is not in the allowed range of "
       << min << ".." << max << "."
     ;
-  return ats::Errata::Message(10, LVL_WARN, out.str());
+  return ts::Errata::Message(10, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Svc_Prop_Ignored(char const* name, int line) {
+ts::Errata::Message Svc_Prop_Ignored(char const* name, int line) {
   std::ostringstream out;
   out << "Service property '" << name << "' at line " << line
       << " ignored because the service is of type standard."
     ;
-  return ats::Errata::Message(11, LVL_INFO, out.str());
+  return ts::Errata::Message(11, LVL_INFO, out.str());
 }
 
-ats::Errata::Message Svc_Flags_No_Hash_Set(int line) {
+ts::Errata::Message Svc_Flags_No_Hash_Set(int line) {
   std::ostringstream out;
   out << "Service flags have no hash set at line " << line
     ;
-  return ats::Errata::Message(12, LVL_WARN, out.str());
+  return ts::Errata::Message(12, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Svc_Flags_Ignored(int line) {
+ts::Errata::Message Svc_Flags_Ignored(int line) {
   std::ostringstream out;
   out << "Invalid service flags at line  " << line
       << " ignored."
     ;
-  return ats::Errata::Message(13, LVL_INFO, out.str());
+  return ts::Errata::Message(13, LVL_INFO, out.str());
 }
 
-ats::Errata::Message Svc_Ports_Too_Many(int line, int n) {
+ts::Errata::Message Svc_Ports_Too_Many(int line, int n) {
   std::ostringstream out;
   out << "Excess ports ignored at line " << line
       << ". " << n << " ports specified, only" 
-      << Wccp::ServiceGroup::N_PORTS << " supported."
+      << wccp::ServiceGroup::N_PORTS << " supported."
     ;
-  return ats::Errata::Message(14, LVL_INFO, out.str());
+  return ts::Errata::Message(14, LVL_INFO, out.str());
 }
 
-ats::Errata::Message Svc_Ports_Malformed(int line) {
+ts::Errata::Message Svc_Ports_Malformed(int line) {
   std::ostringstream out;
   out << "Port value ignored (not a number) at line " << line
       << "."
     ;
-  return ats::Errata::Message(15, LVL_INFO, out.str());
+  return ts::Errata::Message(15, LVL_INFO, out.str());
 }
 
-ats::Errata::Message Svc_Ports_None_Valid(int line) {
+ts::Errata::Message Svc_Ports_None_Valid(int line) {
   std::ostringstream out;
   out << "A '" << SVC_PROP_PORTS << "' property was found at line "
       << line << " but none of the ports were valid."
     ;
-  return  ats::Errata::Message(17, LVL_WARN, out.str());
+  return  ts::Errata::Message(17, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Svc_Ports_Not_Found(int line) {
+ts::Errata::Message Svc_Ports_Not_Found(int line) {
   std::ostringstream out;
   out << "Ports not found in service at line " << line
       << ". Ports must be defined for a dynamic service.";
-  return  ats::Errata::Message(18, LVL_WARN, out.str());
+  return  ts::Errata::Message(18, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Svc_Prop_Ignored_In_Standard(const char* name, int line) {
+ts::Errata::Message Svc_Prop_Ignored_In_Standard(const char* name, int line) {
   std::ostringstream out;
   out << "Service property '" << name << "' at line " << line
       << " ignored because the service is of type STANDARD."
     ;
-  return ats::Errata::Message(19, LVL_INFO, out.str());
+  return ts::Errata::Message(19, LVL_INFO, out.str());
 }
 
-ats::Errata::Message Security_Opt_Invalid(char const* text, int line) {
+ts::Errata::Message Security_Opt_Invalid(ts::ConstBuffer const& text, int line) {
   std::ostringstream out;
   out << "Security option '" << text
       << "' at line " << line
       << " is invalid. It must be 'none' or 'md5'."
     ;
-  return ats::Errata::Message(20, LVL_WARN, out.str());
+  return ts::Errata::Message(20, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Value_Malformed(char const* name, char const* text, int line) {
+ts::Errata::Message Value_Malformed(char const* name, char const* text, int line) {
   std::ostringstream out;
   out << "'" << name << "' value '" << text
       << "' malformed at line " << line << "."
     ;
-  return ats::Errata::Message(21, LVL_WARN, out.str());
+  return ts::Errata::Message(21, LVL_WARN, out.str());
 }
 
-ats::Errata::Message No_Valid_Routers(int line) {
+ts::Errata::Message No_Valid_Routers(int line) {
   std::ostringstream out;
   out << "No valid IP address for routers found for Service Group at line "
       << line << "."
     ;
-  return ats::Errata::Message(22, LVL_WARN, out.str());
+  return ts::Errata::Message(22, LVL_WARN, out.str());
 }
 
-ats::Errata::Message Ignored_Option_Value(
-  char const* text,
-  char const* name,
+ts::Errata::Message Ignored_Option_Value(
+  ts::ConstBuffer const& text,
+  ts::ConstBuffer const& name,
   int line
 ) {
   std::ostringstream out;
@@ -288,10 +310,10 @@ ats::Errata::Message Ignored_Option_Valu
       << " was ignored because it is not a valid option for '"
       << name << "'."
     ;
-  return ats::Errata::Message(24, LVL_INFO, out.str());
+  return ts::Errata::Message(24, LVL_INFO, out.str());
 }
 
-ats::Errata::Message Ignored_Opt_Errors(
+ts::Errata::Message Ignored_Opt_Errors(
   char const* name,
   int line
 ) {
@@ -299,11 +321,11 @@ ats::Errata::Message Ignored_Opt_Errors(
   out << "Errors in  '" << name << "' at line " << line
       << " were ignored."
     ;
-  return ats::Errata::Message(28, LVL_INFO, out.str());
+  return ts::Errata::Message(28, LVL_INFO, out.str());
 }
 
-ats::Errata::Message List_Valid_Opts(
-  char const* name,
+ts::Errata::Message List_Valid_Opts(
+  ts::ConstBuffer const& name,
   int line,
   CfgString* values,
   size_t n
@@ -316,44 +338,52 @@ ats::Errata::Message List_Valid_Opts(
   for ( size_t i = 1 ; i < n ; ++i )
     out << ", \"" << values[i].m_text << '"';
   out << '.';
-  return ats::Errata::Message(29, LVL_INFO, out.str());
+  return ts::Errata::Message(29, LVL_INFO, out.str());
 }
 
-ats::Errata::Message Port_Type_Invalid(char const* text, int line) {
+ts::Errata::Message Port_Type_Invalid(ts::ConstBuffer const& text, int line) {
   std::ostringstream out;
   out << "Value '" << text
       << "' at line " << line
       << "for property '" << SVC_PROP_PORT_TYPE
       << "' is invalid. It must be 'src' or 'dst'."
     ;
-  return ats::Errata::Message(30, LVL_WARN, out.str());
+  return ts::Errata::Message(30, LVL_WARN, out.str());
 }
 
 } // anon namespace
 
-namespace Wccp {
+namespace wccp {
+
+inline bool operator == ( ts::ConstBuffer const& b, char const* text ) {
+  return 0 == strncasecmp(text, b._ptr, b._size);
+}
+
+inline bool operator == ( char const* text, ts::ConstBuffer const& b ) {
+  return 0 == strncasecmp(text, b._ptr, b._size);
+}
 
-ats::Errata
-load_option_set(libconfig::Setting& setting, CfgString* opts, size_t count) {
-  ats::Errata zret;
+ts::Errata
+load_option_set(Value const& setting, CfgString* opts, size_t count) {
+  ts::Errata zret;
   CfgString* spot;
   CfgString* limit = opts + count;
-  char const* name = setting.getName();
+  ts::ConstBuffer const& name  = setting.getName();
   int src_line = setting.getSourceLine();
 
   // Clear all found flags.
   for ( spot = opts ; spot < limit ; ++spot ) spot->m_found = false;
 
   // Walk through the strings in the setting.
-  if (setting.isAggregate()) {
-    int nr = setting.getLength();
+  if (setting.isContainer()) {
+    int nr = setting.childCount();
     bool list_opts = false;
     for ( int i = 0 ; i < nr ; ++i ) {
-      libconfig::Setting& item = setting[i];
-      if (libconfig::Setting::TypeString == item.getType()) {
-        char const* text = static_cast<char const*>(item);
+      Value item = setting[i];
+      if (ts::config::StringValue == item.getType()) {
+        ts::ConstBuffer text = item.getText();
         for ( spot = opts ; spot < limit ; ++spot ) {
-          if (0 == strcasecmp(text, spot->m_text)) {
+          if (spot->m_text == text) {
             spot->m_found = true;
             break;
           }
@@ -363,13 +393,13 @@ load_option_set(libconfig::Setting& sett
           list_opts = true;
         }
       } else {
-        zret.push(Prop_Invalid_Type(setting, libconfig::Setting::TypeString));
+        zret.push(Prop_Invalid_Type(setting, ts::config::StringValue));
       }
     }
     if (list_opts)
       zret.push(List_Valid_Opts(name, src_line, opts, count));
   } else {
-    zret.push(Prop_Invalid_Type(setting, libconfig::Setting::TypeArray));
+    zret.push(Prop_Invalid_Type(setting, ts::config::ListValue));
   }
   return zret;
 }
@@ -378,30 +408,30 @@ load_option_set(libconfig::Setting& sett
     set.  In that case the pointer points at the MD5 key.  Otherwise
     the option was none and the pointer is @c NULL
  */
-ats::Rv<char const*>
+ts::Rv<ts::ConstBuffer>
 load_security (
-  libconfig::Setting& setting ///< Security setting.
+  Value const& setting ///< Security setting.
 ) {
-  ats::Rv<char const*> zret;
+  ts::Rv<ts::ConstBuffer> zret;
   int src_line;
-  char const* text;
+  ts::ConstBuffer text;
 
-  zret = 0;
+  zret.result().set(0,0);
 
   src_line = setting.getSourceLine();
-  if (libconfig::Setting::TypeGroup == setting.getType()) {
-    if (setting.exists(SECURITY_PROP_OPTION)) {
-      libconfig::Setting& opt = setting[SECURITY_PROP_OPTION];
-      if (libconfig::Setting::TypeString == opt.getType()) {
-        text = static_cast<char const*>(opt);
-        if (0 == strcasecmp("none", text)) {
-        } else if (0 == strcasecmp("md5", text)) {
-          if (setting.exists(SECURITY_PROP_KEY)) {
-            libconfig::Setting& key = setting[SECURITY_PROP_KEY];
-            if (libconfig::Setting::TypeString == key.getType()) {
-              zret = static_cast<char const*>(key);
+  if (ts::config::GroupValue == setting.getType()) {
+    Value opt = setting[SECURITY_PROP_OPTION];
+    if (opt) {
+      if (ts::config::StringValue == opt.getType()) {
+        text = opt.getText();
+        if ("none" == text) {
+        } else if ("md5" == text) {
+          Value key = setting[SECURITY_PROP_KEY];
+          if (key) {
+            if (ts::config::StringValue == key.getType()) {
+              zret = key.getText();
             } else {
-              zret.push(Prop_Invalid_Type(key, libconfig::Setting::TypeString));
+              zret.push(Prop_Invalid_Type(key, ts::config::StringValue));
             }
           } else {
             zret.push(Prop_Not_Found(SECURITY_PROP_KEY, SVC_PROP_SECURITY, src_line));
@@ -410,129 +440,120 @@ load_security (
           zret.push(Security_Opt_Invalid(text, opt.getSourceLine()));
         }
       } else {
-        zret.push(Prop_Invalid_Type(opt, libconfig::Setting::TypeString));
+        zret.push(Prop_Invalid_Type(opt, ts::config::StringValue));
       }
     } else {
       zret.push(Prop_Not_Found(SECURITY_PROP_OPTION, SVC_PROP_SECURITY, src_line));
     }
   } else {
-    zret.push(Prop_Invalid_Type(setting, libconfig::Setting::TypeGroup));
+    zret.push(Prop_Invalid_Type(setting, ts::config::GroupValue));
   }
   return zret;
 }
 
 /// Process a router address list.
-ats::Errata
+ts::Errata
 load_routers (
-  libconfig::Setting& setting, ///< Source of addresses.
+  Value const& setting, ///< Source of addresses.
   std::vector<uint32>& addrs ///< Output list
 ) {
-  ats::Errata zret;
+  ts::Errata zret;
   int src_line;
   char const* text;
   static char const * const NAME = "IPv4 Address";
 
   src_line = setting.getSourceLine();
-  if (setting.isAggregate()) {
-    int nr = setting.getLength();
+  if (setting.isContainer()) {
+    int nr = setting.childCount();
     for ( int i = 0 ; i < nr ; ++i ) {
-      libconfig::Setting& addr_cfg = setting[i];
+      Value const& addr_cfg = setting[i];
       int addr_line = addr_cfg.getSourceLine();
       in_addr addr;
-      if (libconfig::Setting::TypeString == addr_cfg.getType()) {
-        text = static_cast<char const*>(addr_cfg);
+      if (ts::config::StringValue == addr_cfg.getType()) {
+        text = addr_cfg.getText()._ptr;
         if (inet_aton(text, &addr)) addrs.push_back(addr.s_addr);
         else zret.push(Value_Malformed(NAME, text, addr_line));
       } else {
-        zret.push(Prop_List_Invalid_Type(addr_cfg, libconfig::Setting::TypeString));
+        zret.push(Prop_List_Invalid_Type(addr_cfg, ts::config::StringValue));
       }
     }
   } else {
-    zret.push(Prop_Invalid_Type(setting, libconfig::Setting::TypeArray));
+    zret.push(Prop_Invalid_Type(setting, ts::config::ListValue));
   }
   return zret;
 }
 
-ats::Errata
+ts::Errata
 CacheImpl::loadServicesFromFile(char const* path) {
-  ats::Errata zret;
-  libconfig::Config cfg;
+  ts::Errata zret;
   int src_line = 0; // scratch for local source line caching.
   std::vector<uint32> routers; // scratch per service loop.
+  Value prop; // scratch var.
 
-  // Can we read and parse the file?
-  try {
-    cfg.readFile(path);
-  } catch (libconfig::ParseException & x) {
-    return File_Syntax_Error(x.getLine(), x.getError());
-  } catch (std::exception const& x) {
-    return File_Read_Error(x.what());
-  }
+  ts::Rv<Configuration> cv = Configuration::loadFromPath(path);
+  if (!cv.isOK()) return cv.errata();
 
+  ts::config::Configuration cfg = cv.result();
+  Value svc_list = cfg.find("services");
   // No point in going on from here.
-  if (!cfg.exists("services")) return Services_Not_Found();
+  if (!svc_list) return Services_Not_Found();
 
-  libconfig::Setting& svc_list = cfg.lookup("services");
-  if (!svc_list.isAggregate()) return Services_Not_A_Sequence();
+  if (!svc_list.isContainer()) return Services_Not_A_Sequence();
 
   // Check for global (default) security setting.
-  if (cfg.exists(SVC_PROP_SECURITY)) {
-    libconfig::Setting& security = cfg.lookup(SVC_PROP_SECURITY);
-    ats::Rv<char const*> rv = load_security(security);
+  if ((prop = cfg[SVC_PROP_SECURITY]).hasValue()) {
+    ts::Rv<ts::ConstBuffer> rv = load_security(prop);
     if (rv.isOK()) this->useMD5Security(rv);
     else zret.join(rv.errata());
   }
 
-  if (cfg.exists(SVC_PROP_ROUTERS)) {
-    libconfig::Setting& routers = cfg.lookup(SVC_PROP_ROUTERS);
-    zret.join(load_routers(routers, Seed_Router));
+  if ((prop = cfg[SVC_PROP_ROUTERS]).hasValue()) {
+    zret.join(load_routers(prop, Seed_Router));
   }
 
   int idx, nsvc;
-  for ( idx = 0, nsvc = svc_list.getLength() ; idx < nsvc ; ++idx ) {
+  for ( idx = 0, nsvc = svc_list.childCount() ; idx < nsvc ; ++idx ) {
     int x; // scratch int.
-    char const* text; // scratch text.
     char const* md5_key = 0;
+    ts::ConstBuffer text;
     SecurityOption security_style = SECURITY_NONE;
     bool use_group_local_security = false;
-    libconfig::Setting& svc_cfg = svc_list[idx];
+    Value const& svc_cfg = svc_list[idx];
     int svc_line = svc_cfg.getSourceLine();
     ServiceGroup svc_info;
 
-    if (!svc_cfg.isGroup()) {
+    if (ts::config::GroupValue != svc_cfg.getType()) {
       zret.push(Service_Not_A_Group(svc_line));
       continue;
     }
 
     // Get the service ID.
-    if (svc_cfg.exists(SVC_PROP_ID)) {
-      libconfig::Setting& id_prop = svc_cfg[SVC_PROP_ID];
-      if (id_prop.isNumber()) {
-        x = static_cast<int>(id_prop);
+    if ((prop = svc_cfg[SVC_PROP_ID]).hasValue()) {
+      if (ts::config::IntegerValue == prop.getType()) {
+        x = atoi(prop.getText()._ptr);
         if (0 <= x && x <= 255)
           svc_info.setSvcId(x);
         else
-          zret.push(Svc_Prop_Out_Of_Range(SVC_PROP_ID, id_prop, x, 0, 255));
+          zret.push(Svc_Prop_Out_Of_Range(SVC_PROP_ID, prop, x, 0, 255));
       } else {
-        zret.push(Prop_Invalid_Type(id_prop, libconfig::Setting::TypeInt));
+        zret.push(Prop_Invalid_Type(prop, ts::config::IntegerValue));
       }
     } else {
       zret.push(Prop_Not_Found(SVC_PROP_ID, SVC_NAME, svc_line));
     }
 
     // Service type.
-    if (svc_cfg.exists(SVC_PROP_TYPE)) {
-      libconfig::Setting& prop = svc_cfg[SVC_PROP_TYPE];
-      if (libconfig::Setting::TypeString == prop.getType()) {
-        text = static_cast<char const*>(prop);
-        if (0 == strcasecmp("DYNAMIC", text))
+    if ((prop = svc_cfg[SVC_PROP_TYPE]).hasValue()) {
+      if (ts::config::StringValue == prop.getType()) {
+        text = prop.getText();
+        if ("DYNAMIC" == text)
           svc_info.setSvcType(ServiceGroup::DYNAMIC);
-        else if (0 == strcasecmp("STANDARD", text))
+        else if ("STANDARD" == text)
           svc_info.setSvcType(ServiceGroup::STANDARD);
         else
           zret.push(Service_Type_Invalid(text, prop.getSourceLine()));
       } else {
-        zret.push(Prop_Invalid_Type(prop, libconfig::Setting::TypeString));
+        zret.push(Prop_Invalid_Type(prop, ts::config::StringValue));
       }
     } else { // default type based on ID.
       ServiceGroup::Type svc_type =
@@ -545,18 +566,17 @@ CacheImpl::loadServicesFromFile(char con
     }
 
     // Get the protocol.
-    if (svc_cfg.exists(SVC_PROP_PROTOCOL)) {
-      libconfig::Setting& proto_prop = svc_cfg[SVC_PROP_PROTOCOL];
+    if ((prop = svc_cfg[SVC_PROP_PROTOCOL]).hasValue()) {
       if (svc_info.getSvcType() == ServiceGroup::STANDARD) {
-        zret.push(Svc_Prop_Ignored(SVC_PROP_PROTOCOL, proto_prop.getSourceLine()));
-      } else if (proto_prop.isNumber()) {
-        x = static_cast<int>(proto_prop);
+        zret.push(Svc_Prop_Ignored(SVC_PROP_PROTOCOL, prop.getSourceLine()));
+      } else if (ts::config::IntegerValue == prop.getType()) {
+        x = atoi(prop.getText()._ptr);
         if (0 <= x && x <= 255)
           svc_info.setProtocol(x);
         else
-          zret.push(Svc_Prop_Out_Of_Range(SVC_PROP_ID, proto_prop, x, 0, 255));
+          zret.push(Svc_Prop_Out_Of_Range(SVC_PROP_ID, prop, x, 0, 255));
       } else {
-        zret.push(Prop_Invalid_Type(proto_prop, libconfig::Setting::TypeInt));
+        zret.push(Prop_Invalid_Type(prop, ts::config::IntegerValue));
       }
     } else if (svc_info.getSvcType() != ServiceGroup::STANDARD) {
       // Required if it's not standard / predefined.
@@ -565,27 +585,24 @@ CacheImpl::loadServicesFromFile(char con
 
     // Get the priority.
     svc_info.setPriority(0); // OK to default to this value.
-    if (svc_cfg.exists(SVC_PROP_PRIORITY)) {
-      libconfig::Setting& pri_prop = svc_cfg[SVC_PROP_PRIORITY];
+    if ((prop = svc_cfg[SVC_PROP_PRIORITY]).hasValue()) {
       if (svc_info.getSvcType() == ServiceGroup::STANDARD) {
-        zret.push(Svc_Prop_Ignored(SVC_PROP_PRIORITY, pri_prop.getSourceLine()));
-      } else if (pri_prop.isNumber()) {
-        x = static_cast<int>(pri_prop);
+        zret.push(Svc_Prop_Ignored(SVC_PROP_PRIORITY, prop.getSourceLine()));
+      } else if (ts::config::IntegerValue == prop.getType()) {
+        x = atoi(prop.getText()._ptr);
         if (0 <= x && x <= 255)
           svc_info.setPriority(x);
         else
-          zret.push(Svc_Prop_Out_Of_Range(SVC_PROP_ID, pri_prop, x, 0, 255));
+          zret.push(Svc_Prop_Out_Of_Range(SVC_PROP_ID, prop, x, 0, 255));
       } else {
-        zret.push(Prop_Invalid_Type(pri_prop, libconfig::Setting::TypeInt));
+        zret.push(Prop_Invalid_Type(prop, ts::config::IntegerValue));
       }
     }
 
     // Service flags.
     svc_info.setFlags(0);
-
-    if (svc_cfg.exists(SVC_PROP_PRIMARY_HASH)) {
-      libconfig::Setting& prop = svc_cfg[SVC_PROP_PRIMARY_HASH];
-      ats::Errata status = load_option_set(prop, HASH_OPTS, N_OPTS(HASH_OPTS));
+    if ((prop = svc_cfg[SVC_PROP_PRIMARY_HASH]).hasValue()) {
+      ts::Errata status = load_option_set(prop, HASH_OPTS, N_OPTS(HASH_OPTS));
       uint32 f = 0;
       src_line = prop.getSourceLine();
       for ( size_t i = 0 ; i < N_OPTS(HASH_OPTS) ; ++i )
@@ -594,15 +611,14 @@ CacheImpl::loadServicesFromFile(char con
         svc_info.enableFlags(f);
         if (!status) zret.push(Ignored_Opt_Errors(SVC_PROP_PRIMARY_HASH, src_line).set(status));
       } else {
-        zret.push(List_Valid_Opts(SVC_PROP_PRIMARY_HASH, src_line, HASH_OPTS, N_OPTS(HASH_OPTS)).set(status));
+        zret.push(List_Valid_Opts(prop.getName(), src_line, HASH_OPTS, N_OPTS(HASH_OPTS)).set(status));
       }
     } else {
       zret.push(Prop_Not_Found(SVC_PROP_PRIMARY_HASH, SVC_NAME, svc_line));
     }
 
-    if (svc_cfg.exists(SVC_PROP_ALT_HASH)) {
-      libconfig::Setting& prop = svc_cfg[SVC_PROP_ALT_HASH];
-      ats::Errata status = load_option_set(prop, HASH_OPTS, N_OPTS(HASH_OPTS));
+    if ((prop = svc_cfg[SVC_PROP_ALT_HASH]).hasValue()) {
+      ts::Errata status = load_option_set(prop, HASH_OPTS, N_OPTS(HASH_OPTS));
       uint32 f = 0;
       src_line = prop.getSourceLine();
       for ( size_t i = 0 ; i < N_OPTS(HASH_OPTS) ; ++i )
@@ -611,33 +627,31 @@ CacheImpl::loadServicesFromFile(char con
       if (!status) zret.push(Ignored_Opt_Errors(SVC_PROP_ALT_HASH, src_line).set(status));
     }
 
-    if (svc_cfg.exists(SVC_PROP_PORT_TYPE)) {
-      libconfig::Setting& prop = svc_cfg[SVC_PROP_PORT_TYPE];
+    if ((prop = svc_cfg[SVC_PROP_PORT_TYPE]).hasValue()) {
       src_line = prop.getSourceLine();
-      if (libconfig::Setting::TypeString == prop.getType()) {
-        text = static_cast<char const*>(prop);
-        if (0 == strcasecmp("src", text))
+      if (ts::config::StringValue == prop.getType()) {
+        text = prop.getText();
+        if ("src" ==  text)
           svc_info.enableFlags(ServiceGroup::PORTS_SOURCE);
-        else if (0 == strcasecmp("dst", text))
+        else if ("dst" == text)
           svc_info.disableFlags(ServiceGroup::PORTS_SOURCE);
         else
           zret.push(Port_Type_Invalid(text, src_line));
       } else {
-        zret.push(Prop_Invalid_Type(prop, libconfig::Setting::TypeString));
+        zret.push(Prop_Invalid_Type(prop, ts::config::StringValue));
       }
     }
 
     // Ports for service.
     svc_info.clearPorts();
-    if (svc_cfg.exists(SVC_PROP_PORTS)) {
-      libconfig::Setting& prop = svc_cfg[SVC_PROP_PORTS];
+    if ((prop = svc_cfg[SVC_PROP_PORTS]).hasValue()) {
       src_line = prop.getSourceLine();
       if (ServiceGroup::STANDARD == svc_info.getSvcType()) {
         zret.push(Svc_Prop_Ignored_In_Standard(SVC_PROP_PORTS, src_line));
       } else {
-        if ( prop.isAggregate() ) {
-          int nport = prop.getLength();
-          int pidx, sidx;
+        if ( prop.isContainer() ) {
+          size_t nport = prop.childCount();
+          size_t pidx, sidx;
           bool malformed_error = false;
           // Clip to maximum protocol allowed ports.
           if (nport > ServiceGroup::N_PORTS) {
@@ -646,9 +660,9 @@ CacheImpl::loadServicesFromFile(char con
           }
           // Step through the ports.
           for ( pidx = sidx = 0 ; pidx < nport ; ++pidx ) {
-            libconfig::Setting& port_cfg = prop[pidx];
-            if (port_cfg.isNumber()) {
-              x = static_cast<int>(port_cfg);
+            Value const& port_cfg = prop[pidx];
+            if (ts::config::IntegerValue == port_cfg.getType()) {
+              x = atoi(port_cfg.getText()._ptr);
               if (0 <= x && x <= 65535)
                 svc_info.setPort(sidx++, x);
               else
@@ -661,7 +675,7 @@ CacheImpl::loadServicesFromFile(char con
           if (sidx) svc_info.enableFlags(ServiceGroup::PORTS_DEFINED);
           else zret.push(Svc_Ports_None_Valid(src_line));
         } else {
-          zret.push(Prop_Invalid_Type(prop, libconfig::Setting::TypeArray));
+          zret.push(Prop_Invalid_Type(prop, ts::config::ListValue));
         }
       }
     } else if (ServiceGroup::STANDARD != svc_info.getSvcType()) {
@@ -669,12 +683,12 @@ CacheImpl::loadServicesFromFile(char con
     }
 
     // Security option for this service group.
-    if (svc_cfg.exists(SVC_PROP_SECURITY)) {
-      ats::Rv<char const*> security = load_security(svc_cfg[SVC_PROP_SECURITY]);
+    if ((prop = svc_cfg[SVC_PROP_SECURITY]).hasValue()) {
+      ts::Rv<ts::ConstBuffer> security = load_security(prop);
       if (security.isOK()) {
         use_group_local_security = true;
-        if (security.result()) {
-          md5_key = security;
+        if (security.result()._ptr) {
+          md5_key = security.result()._ptr;
           security_style = SECURITY_MD5;
         } else {
           security_style = SECURITY_NONE;
@@ -685,17 +699,16 @@ CacheImpl::loadServicesFromFile(char con
 
     // Get any group specific routers.
     routers.clear(); // reset list.
-    if (svc_cfg.exists(SVC_PROP_ROUTERS)) {
-      libconfig::Setting& rtr_cfg = svc_cfg[SVC_PROP_ROUTERS];
-      ats::Errata status = load_routers(rtr_cfg, routers);
+    if ((prop = svc_cfg[SVC_PROP_ROUTERS]).hasValue()) {
+      ts::Errata status = load_routers(prop, routers);
       if (!status)
-        zret.push(ats::Errata::Message(23, LVL_INFO, "Router specification invalid.").set(status));
+        zret.push(ts::Errata::Message(23, LVL_INFO, "Router specification invalid.").set(status));
     }
     if (!routers.size() && !Seed_Router.size())
       zret.push(No_Valid_Routers(svc_line));
 
     // See if can proceed with service group creation.
-    ats::Errata::Code code = code_max(zret);
+    ts::Errata::Code code = code_max(zret);
     if (code >= LVL_WARN) {
       zret = Unable_To_Create_Service_Group(svc_line).set(zret);
       return zret;
@@ -716,9 +729,8 @@ CacheImpl::loadServicesFromFile(char con
     // Look for optional properties.
 
     svc.m_packet_forward = ServiceGroup::GRE; // default
-    if (svc_cfg.exists(SVC_PROP_FORWARD)) {
-      libconfig::Setting& prop = svc_cfg[SVC_PROP_FORWARD];
-      ats::Errata status = load_option_set(prop, FORWARD_OPTS, N_FORWARD_OPTS);
+    if ((prop = svc_cfg[SVC_PROP_FORWARD]).hasValue()) {
+      ts::Errata status = load_option_set(prop, FORWARD_OPTS, N_FORWARD_OPTS);
       bool gre = FORWARD_OPTS[0].m_found;
       bool l2 = FORWARD_OPTS[1].m_found;
       if (gre || l2) {
@@ -730,14 +742,13 @@ CacheImpl::loadServicesFromFile(char con
         if (!status.isOK())
           zret.push(Ignored_Opt_Errors(SVC_PROP_FORWARD, prop.getSourceLine()).set(status));
       } else {
-        zret.push(ats::Errata::Message(26, LVL_INFO, "Defaulting to GRE forwarding.").set(status));
+        zret.push(ts::Errata::Message(26, LVL_INFO, "Defaulting to GRE forwarding.").set(status));
       }
     }
 
     svc.m_packet_return = ServiceGroup::GRE; // default.
-    if (svc_cfg.exists(SVC_PROP_RETURN)) {
-      libconfig::Setting& prop = svc_cfg[SVC_PROP_RETURN];
-      ats::Errata status = load_option_set(prop, RETURN_OPTS, N_RETURN_OPTS);
+    if ((prop = svc_cfg[SVC_PROP_RETURN]).hasValue()) {
+      ts::Errata status = load_option_set(prop, RETURN_OPTS, N_RETURN_OPTS);
       bool gre = RETURN_OPTS[0].m_found;
       bool l2 = RETURN_OPTS[1].m_found;
       if (gre || l2) {
@@ -748,14 +759,13 @@ CacheImpl::loadServicesFromFile(char con
           ;
         if (!status.isOK()) zret.push(Ignored_Opt_Errors(SVC_PROP_RETURN, prop.getSourceLine()).set(status));
       } else {
-        zret.push(ats::Errata::Message(26, LVL_INFO, "Defaulting to GRE return.").set(status));
+        zret.push(ts::Errata::Message(26, LVL_INFO, "Defaulting to GRE return.").set(status));
       }
     }
 
     svc.m_cache_assign = ServiceGroup::HASH_ONLY; // default
-    if (svc_cfg.exists(SVC_PROP_ASSIGN)) {
-      libconfig::Setting& prop = svc_cfg[SVC_PROP_ASSIGN];
-      ats::Errata status = load_option_set(prop, ASSIGN_OPTS, N_OPTS(ASSIGN_OPTS));
+    if ((prop = svc_cfg[SVC_PROP_ASSIGN]).hasValue()) {
+      ts::Errata status = load_option_set(prop, ASSIGN_OPTS, N_OPTS(ASSIGN_OPTS));
       bool hash = ASSIGN_OPTS[0].m_found;
       bool mask = ASSIGN_OPTS[1].m_found;
       if (hash || mask) {
@@ -766,8 +776,8 @@ CacheImpl::loadServicesFromFile(char con
           ;
         if (!status.isOK()) zret.push(Ignored_Opt_Errors(SVC_PROP_ASSIGN, prop.getSourceLine()).set(status));
       } else {
-        status.push(ats::Errata::Message(26, LVL_INFO, "Defaulting to hash assignment only."));
-        zret.push(List_Valid_Opts(SVC_PROP_ASSIGN, src_line, ASSIGN_OPTS, N_OPTS(ASSIGN_OPTS)).set(status));
+        status.push(ts::Errata::Message(26, LVL_INFO, "Defaulting to hash assignment only."));
+        zret.push(List_Valid_Opts(prop.getName(), src_line, ASSIGN_OPTS, N_OPTS(ASSIGN_OPTS)).set(status));
       }
     }
   }

Modified: trafficserver/traffic/branches/wccp/proxy/wccp/WccpEndPoint.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/wccp/WccpEndPoint.cc?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/wccp/WccpEndPoint.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/wccp/WccpEndPoint.cc Sat Nov 20 15:18:09 2010
@@ -1,9 +1,9 @@
 # include "WccpLocal.h"
 # include "WccpUtil.h"
-# include "AtsMeta.h"
+# include "WccpMeta.h"
 # include <errno.h>
 // ------------------------------------------------------
-namespace Wccp {
+namespace wccp {
 // ------------------------------------------------------
 Impl::GroupData::GroupData()
   : m_generation(0)
@@ -28,7 +28,7 @@ Impl::GroupData::setSecurity(SecurityOpt
 
 Impl::Impl()
   : m_addr(INADDR_ANY)
-  , m_fd(ats::NO_FD) {
+  , m_fd(ts::NO_FD) {
 }
 
 Impl::~Impl() {
@@ -41,12 +41,12 @@ Impl::open(uint addr) {
   sockaddr_in& in_addr = reinterpret_cast<sockaddr_in&>(saddr);
   int fd;
 
-  if (ats::NO_FD != m_fd) {
+  if (ts::NO_FD != m_fd) {
     log(LVL_INFO, "Attempted to open already open WCCP Endpoint");
     return -EALREADY;
   }
 
-  if (ats::NO_FD == (fd = socket(PF_INET, SOCK_DGRAM, 0))) {
+  if (ts::NO_FD == (fd = socket(PF_INET, SOCK_DGRAM, 0))) {
     log_errno(LVL_FATAL, "Failed to create socket");
     return -errno;
   }
@@ -96,19 +96,19 @@ Impl::open(uint addr) {
 
 void
 Impl::close() {
-  if (ats::NO_FD != m_fd) {
+  if (ts::NO_FD != m_fd) {
     ::close(m_fd);
-    m_fd = ats::NO_FD;
+    m_fd = ts::NO_FD;
   }
 }
 
 void
-Impl::useMD5Security(char const* key) {
+Impl::useMD5Security(ts::ConstBuffer const& key) {
   m_use_security_opt = true;
   m_security_opt = SECURITY_MD5;
   m_use_security_key = true;
   memset(m_security_key, 0, SecurityComp::KEY_SIZE);
-  strncpy(m_security_key, key, SecurityComp::KEY_SIZE);
+  strncpy(m_security_key, key._ptr, std::min(key._size, SecurityComp::KEY_SIZE));
 }
 
 SecurityOption
@@ -137,9 +137,9 @@ Impl::validateSecurity(BaseMsg& msg, Gro
   return true;
 }
 
-ats::Rv<int>
+ts::Rv<int>
 Impl::handleMessage() {
-  ats::Rv<int> zret;
+  ts::Rv<int> zret;
   ssize_t n; // recv byte count.
   struct sockaddr src_addr; // sender's address.
   msghdr recv_hdr;
@@ -150,7 +150,7 @@ Impl::handleMessage() {
   static size_t const ANC_BUFFER_SIZE = CMSG_ALIGN(CMSG_SPACE(sizeof(in_pktinfo)));
   char anc_buffer[ANC_BUFFER_SIZE];
 
-  if (ats::NO_FD == m_fd) return -ENOTCONN;
+  if (ts::NO_FD == m_fd) return -ENOTCONN;
 
   recv_buffer.iov_base = buffer;
   recv_buffer.iov_len = BUFFER_SIZE;
@@ -183,7 +183,7 @@ Impl::handleMessage() {
   MsgBuffer msg_buffer(buffer,n);
   if (PARSE_SUCCESS == header.parse(msg_buffer)) {
     message_type_t msg_type = header.getType();
-    ats::Buffer chunk(buffer,n);
+    ts::Buffer chunk(buffer,n);
 
     switch (msg_type) {
     case HERE_I_AM: this->handleHereIAm(ip_header, chunk); break;
@@ -199,20 +199,20 @@ Impl::handleMessage() {
   return zret;
 }
 
-ats::Errata
-Impl::handleHereIAm(IpHeader const&, ats::Buffer const&) {
+ts::Errata
+Impl::handleHereIAm(IpHeader const&, ts::Buffer const&) {
   return log(LVL_INFO, "Unanticipated WCCP2_HERE_I_AM message ignored");
 }
-ats::Errata
-Impl::handleISeeYou(IpHeader const&, ats::Buffer const& data) {
+ts::Errata
+Impl::handleISeeYou(IpHeader const&, ts::Buffer const& data) {
   return log(LVL_INFO, "Unanticipated WCCP2_I_SEE_YOU message ignored.");
 }
-ats::Errata
-Impl::handleRedirectAssign(IpHeader const&, ats::Buffer const& data) {
+ts::Errata
+Impl::handleRedirectAssign(IpHeader const&, ts::Buffer const& data) {
   return log(LVL_INFO, "Unanticipated WCCP2_REDIRECT_ASSIGN message ignored.");
 }
-ats::Errata
-Impl::handleRemovalQuery(IpHeader const&, ats::Buffer const& data) {
+ts::Errata
+Impl::handleRemovalQuery(IpHeader const&, ts::Buffer const& data) {
   return log(LVL_INFO, "Unanticipated WCCP2_REMOVAL_QUERY message ignored.");
 }
 // ------------------------------------------------------
@@ -234,7 +234,7 @@ CacheImpl::GroupData::removeSeedRouter(u
   std::vector<SeedRouter>::iterator begin = m_seed_routers.begin(); 
   std::vector<SeedRouter>::iterator end = m_seed_routers.end();
   std::vector<SeedRouter>::iterator spot = 
-    std::find_if(begin, end, ats::predicate(&SeedRouter::m_addr, addr));
+    std::find_if(begin, end, ts::predicate(&SeedRouter::m_addr, addr));
 
   if (end != spot) {
     zret = spot->m_xmit;
@@ -253,7 +253,7 @@ CacheImpl::GroupData::findCache(uint32 a
   return std::find_if(
     m_caches.begin(),
     m_caches.end(),
-    ats::predicate(&CacheData::idAddr, addr)
+    ts::predicate(&CacheData::idAddr, addr)
   );
 }
 
@@ -399,7 +399,7 @@ CacheImpl::GroupData::viewChanged(time_t
   m_assign_info.setActive(false); // invalidate current assignment.
   m_assignment_pending = m_routers.size() && m_caches.size();
   // Cancel any pending assignment transmissions.
-  ats::for_each(m_routers, ats::assign_member(&RouterData::m_assign, false));
+  ts::for_each(m_routers, ts::assign_member(&RouterData::m_assign, false));
   logf(LVL_DEBUG, "Service group %d view change (%d)", m_svc.getSvcId(), m_generation);
 
   return *this;
@@ -448,7 +448,7 @@ CacheImpl::open(uint32 addr) {
 time_t
 CacheImpl::waitTime() const {
   time_t now = time(0);
-  return ats::minima(m_groups, &GroupData::waitTime, now);
+  return ts::minima(m_groups, &GroupData::waitTime, now);
 }
 
 void
@@ -569,7 +569,7 @@ CacheImpl::housekeeping() {
     ) {
       // Is a valid assignment possible?
       if (group.m_assign_info.fill(group, m_addr))
-        ats::for_each(group.m_routers, ats::assign_member(&RouterData::m_assign, true));
+        ts::for_each(group.m_routers, ts::assign_member(&RouterData::m_assign, true));
 
       // Always clear because no point in sending a assign we can't generate.
       group.m_assignment_pending = false;
@@ -642,9 +642,9 @@ CacheImpl::housekeeping() {
   return zret;
 }
 
-ats::Errata
-CacheImpl::handleISeeYou(IpHeader const& ip_hdr, ats::Buffer const& chunk) {
-  ats::Errata zret;
+ts::Errata
+CacheImpl::handleISeeYou(IpHeader const& ip_hdr, ts::Buffer const& chunk) {
+  ts::Errata zret;
   ISeeYouMsg msg;
   // Set if our view of the group changes enough to bump the
   // generation number.
@@ -782,7 +782,7 @@ RouterImpl::GroupData::findCache(uint32 
   return std::find_if(
     m_caches.begin(),
     m_caches.end(),
-    ats::predicate(&CacheData::idAddr, addr)
+    ts::predicate(&CacheData::idAddr, addr)
   );
 }
 
@@ -809,12 +809,12 @@ RouterImpl::defineServiceGroup(
 
 void
 RouterImpl::GroupData::resizeRouterSources() {
-  ats::for_each(m_routers, &RouterData::resize, m_caches.size());
+  ts::for_each(m_routers, &RouterData::resize, m_caches.size());
 }
 
-ats::Errata
-RouterImpl::handleHereIAm(IpHeader const& ip_hdr, ats::Buffer const& chunk) {
-  ats::Errata zret;
+ts::Errata
+RouterImpl::handleHereIAm(IpHeader const& ip_hdr, ts::Buffer const& chunk) {
+  ts::Errata zret;
   HereIAmMsg msg;
   static GroupData nil_group; // scratch until I clean up the security.
   // Set if our view of the group changes enough to bump the
@@ -1022,26 +1022,26 @@ EndPoint::open(uint32 addr) {
 }
 
 void
-EndPoint::useMD5Security(char const* key) {
+EndPoint::useMD5Security(ts::ConstBuffer const& key) {
   this->instance()->useMD5Security(key);
 }
 
 int EndPoint::getSocket() const {
-  return m_ptr ? m_ptr->m_fd : ats::NO_FD;
+  return m_ptr ? m_ptr->m_fd : ts::NO_FD;
 }
 
 int
 EndPoint::housekeeping() {
   // Don't force an instance because if there isn't one,
   // there's no socket either.
-  return m_ptr && ats::NO_FD != m_ptr->m_fd ? m_ptr->housekeeping() : -ENOTCONN;
+  return m_ptr && ts::NO_FD != m_ptr->m_fd ? m_ptr->housekeeping() : -ENOTCONN;
 }
 
-ats::Rv<int>
+ts::Rv<int>
 EndPoint::handleMessage() {
   return m_ptr
     ? m_ptr->handleMessage()
-    : ats::Rv<int>(-ENOTCONN, log(LVL_INFO, "EndPoint::handleMessage called on unconnected instance"));
+    : ts::Rv<int>(-ENOTCONN, log(LVL_INFO, "EndPoint::handleMessage called on unconnected instance"));
 }
 // ------------------------------------------------------
 Cache::Cache() {
@@ -1087,7 +1087,7 @@ Cache::addSeedRouter(uint8 id, uint32 ad
   return *this;
 }
 
-ats::Errata
+ts::Errata
 Cache::loadServicesFromFile(char const* path) {
   return this->instance()->loadServicesFromFile(path);
 }
@@ -1114,4 +1114,4 @@ Router::impl() {
   return static_cast<ImplType*>(m_ptr.get());
 }
 // ------------------------------------------------------
-} // namespace Wccp
+} // namespace wccp

Modified: trafficserver/traffic/branches/wccp/proxy/wccp/WccpLocal.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/wccp/WccpLocal.h?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/wccp/WccpLocal.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/wccp/WccpLocal.h Sat Nov 20 15:18:09 2010
@@ -1,23 +1,27 @@
+# if !defined(ATS_WCCP_LOCAL_HEADER)
+# define ATS_WCCP_LOCAL_HEADER
+
 /** @file
     WCCP (v2) support for Apache Traffic Server.
     Original implementation: Alan M. Carroll
     Sponsored by: Pavlov Media
  */
 
-# if !defined(ATS_WCCP_LOCAL_HEADER)
-# define ATS_WCCP_LOCAL_HEADER
-
 # include "Wccp.h"
 # include "WccpUtil.h"
+# include <TsBuffer.h>
 // Needed for template use of byte ordering functions.
 # include <netinet/in.h>
 # include <memory.h>
 # include <malloc.h>
 # include <map>
 
-namespace Wccp {
+namespace ts {
+/// Null / invalid file descriptor.
+static const int NO_FD = -1;
+}
 
-using namespace ats::fixed_integers;
+namespace wccp {
 
 namespace detail { namespace cache { class RouterData; } }
 
@@ -65,10 +69,10 @@ static int const PARSE_DATA_OVERRUN = 10
     Takes the basic ATS buffer and adds a count field to track
     the amount of buffer in use.
 */
-class MsgBuffer : protected ats::Buffer {
+class MsgBuffer : protected ts::Buffer {
 public:
   typedef MsgBuffer self; ///< Self reference type.
-  typedef ats::Buffer super; ///< Parent type.
+  typedef ts::Buffer super; ///< Parent type.
 
   MsgBuffer(); ///< Default construct empty buffer.
   /// Construct from ATS buffer.
@@ -110,7 +114,7 @@ public:
   /// Reset and zero the buffer.
   self& zero();
 
-  size_t m_count; ///< Number of bytes in use.
+  size_t _count; ///< Number of bytes in use.
 };
 
 /// Sect 4.4: Cache assignment method.
@@ -1579,7 +1583,7 @@ public:
   );
   /// Parse message data, presumed to be of this type.
   int parse(
-    ats::Buffer const& buffer ///< Raw message data.
+    ts::Buffer const& buffer ///< Raw message data.
   );
 
   CacheIdComp m_cache_id; ///< Web cache identity info.
@@ -1608,7 +1612,7 @@ public:
 
   /// Parse message data, presumed to be of this type.
   int parse(
-    ats::Buffer const& buffer ///< Raw message data.
+    ts::Buffer const& buffer ///< Raw message data.
   );
 
   RouterIdComp m_router_id; ///< Router ID.
@@ -1642,7 +1646,7 @@ public:
 
   /// Parse message data, presumed to be of this type.
   int parse(
-    ats::Buffer const& buffer ///< Raw message data.
+    ts::Buffer const& buffer ///< Raw message data.
   );
 
   // Only one of these should be present in an instance.
@@ -1677,7 +1681,7 @@ struct PacketStamp {
     put all the message structures on the side. This also means having
     to use accessor methods.
  */
-class Impl : public ats::IntrusivePtrCounter {
+class Impl : public ts::IntrusivePtrCounter {
   friend class EndPoint;
 public:
   typedef Impl self; ///< Self reference type.
@@ -1703,7 +1707,7 @@ public:
 
   /// Use MD5 security.
   void useMD5Security(
-    char const* key ///< Shared key.
+    ts::ConstBuffer const& key ///< Shared key.
   );
 
   /// Perform all scheduled housekeeping functions.
@@ -1712,7 +1716,7 @@ public:
 
   /// Recieve and process a message.
   /// @return 0 for success, -ERRNO on system error.
-  virtual ats::Rv<int> handleMessage();
+  virtual ts::Rv<int> handleMessage();
 
   /// Check if endpoint is configured.
   /// @return @c true if ready to operate, @c false otherwise.
@@ -1725,24 +1729,24 @@ public:
      to process relevant messages.
   */
   /// Process HERE_I_AM message.
-  virtual ats::Errata handleHereIAm(
+  virtual ts::Errata handleHereIAm(
     IpHeader const& header, ///< IP packet data.
-    ats::Buffer const& data ///< Buffer with message data.
+    ts::Buffer const& data ///< Buffer with message data.
   );
   /// Process I_SEE_YOU message.
-  virtual ats::Errata handleISeeYou(
+  virtual ts::Errata handleISeeYou(
     IpHeader const& header, ///< IP packet data.
-    ats::Buffer const& data ///< Buffer with message data.
+    ts::Buffer const& data ///< Buffer with message data.
   );
   /// Process REDIRECT_ASSIGN message.
-  virtual ats::Errata handleRedirectAssign(
+  virtual ts::Errata handleRedirectAssign(
     IpHeader const& header, ///< IP packet data.
-    ats::Buffer const& data ///< Buffer with message data.
+    ts::Buffer const& data ///< Buffer with message data.
   );
   /// Process REMOVAL_QUERY message.
-  virtual ats::Errata handleRemovalQuery(
+  virtual ts::Errata handleRemovalQuery(
     IpHeader const& header, ///< IP packet data.
-    ats::Buffer const& data ///< Buffer with message data.
+    ts::Buffer const& data ///< Buffer with message data.
   );
 
 protected:
@@ -1972,7 +1976,7 @@ public:
   );
 
   /// Define services from a configuration file.
-  ats::Errata loadServicesFromFile(
+  ts::Errata loadServicesFromFile(
     char const* path ///< Path to file.
   );
 
@@ -2007,9 +2011,9 @@ protected:
   );
 
   /// Process HERE_I_AM message.
-  virtual ats::Errata handleISeeYou(
+  virtual ts::Errata handleISeeYou(
     IpHeader const& header, ///< IP packet data.
-    ats::Buffer const& data ///< Buffer with message data.
+    ts::Buffer const& data ///< Buffer with message data.
   );
 
   /// Map Service Group ID to Service Group Data.
@@ -2110,9 +2114,9 @@ public:
   typedef detail::router::RouterBag RouterBag;
 
   /// Process HERE_I_AM message.
-  virtual ats::Errata handleHereIAm(
+  virtual ts::Errata handleHereIAm(
     IpHeader const& header, ///< IP packet data.
-    ats::Buffer const& data ///< Buffer with message data.
+    ts::Buffer const& data ///< Buffer with message data.
   );
   /// Perform all scheduled housekeeping functions.
   int housekeeping();
@@ -2439,25 +2443,25 @@ detail::Assignment::setActive(bool state
   return *this;
 }
 
-inline MsgBuffer::MsgBuffer() : super(0,0), m_count(0) { }
-inline MsgBuffer::MsgBuffer(super const& that) : super(that), m_count(0) { }
+inline MsgBuffer::MsgBuffer() : super(0,0), _count(0) { }
+inline MsgBuffer::MsgBuffer(super const& that) : super(that), _count(0) { }
 inline MsgBuffer::MsgBuffer(void* p, size_t n)
   : super(static_cast<char*>(p),n)
-  , m_count(0) {
+  , _count(0) {
 }
 
-inline size_t MsgBuffer::getSize() const { return m_size; }
-inline size_t MsgBuffer::getCount() const { return m_count; }
-inline char* MsgBuffer::getBase() { return m_ptr; }
-inline char const* MsgBuffer::getBase() const { return m_ptr; }
-inline char* MsgBuffer::getTail() { return m_ptr + m_count; }
-inline size_t MsgBuffer::getSpace() const { return m_size - m_count; }
-inline MsgBuffer& MsgBuffer::reset() { m_count = 0; return *this; }
+inline size_t MsgBuffer::getSize() const { return _size; }
+inline size_t MsgBuffer::getCount() const { return _count; }
+inline char* MsgBuffer::getBase() { return _ptr; }
+inline char const* MsgBuffer::getBase() const { return _ptr; }
+inline char* MsgBuffer::getTail() { return _ptr + _count; }
+inline size_t MsgBuffer::getSpace() const { return _size - _count; }
+inline MsgBuffer& MsgBuffer::reset() { _count = 0; return *this; }
 
 inline MsgBuffer& MsgBuffer::set(void *ptr, size_t n) {
-  m_ptr = static_cast<char*>(ptr);
-  m_size = n;
-  m_count = 0;
+  _ptr = static_cast<char*>(ptr);
+  _size = n;
+  _count = 0;
   return *this;
 }
 
@@ -2467,13 +2471,13 @@ inline MsgBuffer::operator MsgBuffer::su
 
 inline MsgBuffer&
 MsgBuffer::use(size_t n) {
-  m_count += std::min(n, this->getSpace());
+  _count += std::min(n, this->getSpace());
   return *this;
 }
 
 inline MsgBuffer& MsgBuffer::zero() {
-  memset(m_ptr, 0, m_size);
-  m_count = 0;
+  memset(_ptr, 0, _size);
+  _count = 0;
   return *this;
 }
 

Copied: trafficserver/traffic/branches/wccp/proxy/wccp/WccpMeta.h (from r1037236, trafficserver/traffic/branches/wccp/proxy/wccp/AtsMeta.h)
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/wccp/WccpMeta.h?p2=trafficserver/traffic/branches/wccp/proxy/wccp/WccpMeta.h&p1=trafficserver/traffic/branches/wccp/proxy/wccp/AtsMeta.h&r1=1037236&r2=1037238&rev=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/wccp/AtsMeta.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/wccp/WccpMeta.h Sat Nov 20 15:18:09 2010
@@ -2,7 +2,7 @@
 
 // Various meta programming efforts. Experimental at present.
 
-namespace ats {
+namespace ts {
 
 // Some support templates so we can fail to compile if the
 // compile time check fails.

Modified: trafficserver/traffic/branches/wccp/proxy/wccp/WccpMsg.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/wccp/WccpMsg.cc?rev=1037238&r1=1037237&r2=1037238&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/wccp/WccpMsg.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/wccp/WccpMsg.cc Sat Nov 20 15:18:09 2010
@@ -1,8 +1,9 @@
 # include "WccpLocal.h"
 # include <errno.h>
 # include <openssl/md5.h>
+# include <TsException.h>
 
-namespace Wccp {
+namespace wccp {
 // ------------------------------------------------------
 // ------------------------------------------------------
 ServiceGroup&
@@ -294,7 +295,7 @@ MsgHeaderComp&
 MsgHeaderComp::fill(MsgBuffer& buffer, message_type_t t) {
   size_t comp_size = this->calcSize();
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
   m_base = buffer.getTail();
   buffer.use(comp_size);
   this->setType(t).setVersion(VERSION).setLength(0);
@@ -355,7 +356,7 @@ SecurityComp::fill(MsgBuffer& buffer, Op
   size_t comp_size = this->calcSize(opt);
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
  
@@ -445,7 +446,7 @@ ServiceComp::setPort(int idx, uint16_t p
 
 ServiceComp&
 ServiceComp::addPort(uint16_t port) {
-  if (m_port_count < ServiceGroup::N_PORTS)
+  if (m_port_count < static_cast<int>(ServiceGroup::N_PORTS))
     this->access()->setPort(m_port_count++, port);
   return *this;
 }
@@ -462,7 +463,7 @@ ServiceComp::fill(MsgBuffer& buffer, Ser
   size_t comp_size = this->calcSize();
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
 
@@ -574,7 +575,7 @@ RouterIdComp&
 RouterIdComp::fill(MsgBuffer& buffer, size_t n_caches) {
   size_t comp_size = this->calcSize(n_caches);
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
 
@@ -597,7 +598,7 @@ RouterIdComp::fillSingleton(
   size_t comp_size = this->calcSize(1);
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
 
@@ -706,7 +707,7 @@ RouterViewComp::fill(
   size_t comp_size = this->calcSize(n_routers, n_caches);
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
 
@@ -759,7 +760,7 @@ CacheIdComp::fill(MsgBuffer& base, Cache
   size_t comp_size = this->calcSize();
 
   if (base.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = base.getTail();
   this->setType(COMP_TYPE).setLength(comp_size - sizeof(super::raw_t));
@@ -859,7 +860,7 @@ CacheViewComp::fill(
   size_t comp_size = this->calcSize(n_routers, n_caches);
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
 
@@ -989,7 +990,7 @@ AssignInfoComp::fill(
   size_t comp_size = this->calcSize(n_routers, n_caches);
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
 
@@ -1017,7 +1018,7 @@ AssignInfoComp::fill(MsgBuffer& buffer, 
   size_t comp_size = that.getLength() + sizeof(super::raw_t);
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
   memcpy(m_base, that.m_base, comp_size);
@@ -1086,7 +1087,7 @@ CmdComp::fill(MsgBuffer& buffer, cmd_t c
   size_t comp_size = this->calcSize();
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
 
@@ -1168,7 +1169,7 @@ CapComp::fill(MsgBuffer& buffer, int n) 
   m_cached = false;
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
   this->setType(COMP_TYPE).setLength(comp_size - sizeof(super::raw_t));
@@ -1216,7 +1217,7 @@ AssignMapComp::fill(MsgBuffer& buffer, i
   size_t comp_size = this->calcSize(n);
 
   if (buffer.getSpace() < comp_size)
-    throw ats::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
+    throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
 
   m_base = buffer.getTail();
 
@@ -1426,7 +1427,7 @@ HereIAmMsg::fill_caps(
 }
 
 int
-HereIAmMsg::parse(ats::Buffer const& buffer) {
+HereIAmMsg::parse(ts::Buffer const& buffer) {
   int zret;
   this->setBuffer(buffer);
   if (!m_buffer.getBase()) return -EINVAL;
@@ -1487,7 +1488,7 @@ ISeeYouMsg::fill(
 }
 
 int
-ISeeYouMsg::parse(ats::Buffer const& buffer) {
+ISeeYouMsg::parse(ts::Buffer const& buffer) {
   int zret;
   this->setBuffer(buffer);
   if (!m_buffer.getBase()) return -EINVAL;
@@ -1523,4 +1524,4 @@ ISeeYouMsg::parse(ats::Buffer const& buf
   return m_buffer.getSpace() ? PARSE_DATA_OVERRUN : PARSE_SUCCESS;
 }
 // ------------------------------------------------------
-} // namespace Wccp
+} // namespace wccp