trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [02/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source
Date Mon, 23 Mar 2015 20:32:35 GMT
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpMeta.h
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpMeta.h b/lib/wccp/WccpMeta.h
index a30f1c9..a2cacc2 100644
--- a/lib/wccp/WccpMeta.h
+++ b/lib/wccp/WccpMeta.h
@@ -1,5 +1,5 @@
-# if !defined(TS_WCCP_META_HEADER)
-# define TS_WCCP_META_HEADER
+#if !defined(TS_WCCP_META_HEADER)
+#define TS_WCCP_META_HEADER
 
 /** @file
     Meta programming support for WCCP.
@@ -27,54 +27,66 @@
 
 // Various meta programming efforts. Experimental at present.
 
-namespace ts {
-
+namespace ts
+{
 // Some support templates so we can fail to compile if the
 // compile time check fails.
 
 // This creates the actual error, depending on whether X has a valid
 // nest type Result.
-template < typename X > struct TEST_RESULT { typedef typename X::Result type; };
+template <typename X> struct TEST_RESULT {
+  typedef typename X::Result type;
+};
 
 // Bool checking - a base template then specializations to succeed or
 // fail.
-template < bool VALUE > struct TEST_BOOL { };
+template <bool VALUE> struct TEST_BOOL {
+};
 // Successful test defines Result.
-template <> struct TEST_BOOL<true> { typedef int Result; };
+template <> struct TEST_BOOL<true> {
+  typedef int Result;
+};
 // Failing test does not define Result.
-template <> struct TEST_BOOL<false> { };
+template <> struct TEST_BOOL<false> {
+};
 
 // Fail to compile if VALUE is not true.
-template < bool VALUE > struct TEST_IF_TRUE
-  : public TEST_RESULT< TEST_BOOL< VALUE > > {
+template <bool VALUE> struct TEST_IF_TRUE : public TEST_RESULT<TEST_BOOL<VALUE> > {
 };
 
 // Helper for assigning a value to all instances in a container.
-template < typename T , typename R, typename A1 >
-struct TsAssignMember : public std::binary_function<T, A1, R> {
+template <typename T, typename R, typename A1> struct TsAssignMember : public std::binary_function<T, A1, R> {
   R T::*_m;
   A1 _arg1;
-  TsAssignMember(R T::*m, A1 const& arg1) : _m(m), _arg1(arg1) { }
-  R operator () (T& t) const { return t.*_m = _arg1; }
+  TsAssignMember(R T::*m, A1 const &arg1) : _m(m), _arg1(arg1) {}
+  R operator()(T &t) const { return t.*_m = _arg1; }
 };
 
 // Helper function to compute types for TsAssignMember.
-template < typename T, typename R, typename A1 > struct TsAssignMember<T,R,A1> assign_member(R T::*m, A1 const& arg1) { return TsAssignMember<T,R,A1>(m,arg1); }
+template <typename T, typename R, typename A1>
+struct TsAssignMember<T, R, A1>
+assign_member(R T::*m, A1 const &arg1) {
+  return TsAssignMember<T, R, A1>(m, arg1);
+}
 
 // Overload for_each to operate on a container.
-template < typename C, typename F > void for_each(C& c, F const& f) { std::for_each(c.begin(), c.end(), f); }
+template <typename C, typename F>
+void
+for_each(C &c, F const &f)
+{
+  std::for_each(c.begin(), c.end(), f);
+}
 
 /** Calc minimal value over a direct type container.
     This handles an accessor that takes a argument.
 */
-template < typename C, typename V, typename ARG1 > V
-minima(C const& c,  V (C::value_type::*ex)(ARG1) const, ARG1 const& arg1) {
+template <typename C, typename V, typename ARG1>
+V
+minima(C const &c, V (C::value_type::*ex)(ARG1) const, ARG1 const &arg1)
+{
   V v = std::numeric_limits<V>::max();
-  for ( typename C::const_iterator spot = c.begin(), limit = c.end();
-        spot != limit;
-        ++spot
-  ) {
-    v = std::min(v, ((*spot).*ex)(arg1) );
+  for (typename C::const_iterator spot = c.begin(), limit = c.end(); spot != limit; ++spot) {
+    v = std::min(v, ((*spot).*ex)(arg1));
   }
   return v;
 }
@@ -82,80 +94,73 @@ minima(C const& c,  V (C::value_type::*ex)(ARG1) const, ARG1 const& arg1) {
 /** Calc minimal value over a paired type container.
     This handles an accessor that takes a argument.
 */
-template < typename C, typename V, typename ARG1 > V
-minima(C const& c,  V (C::value_type::second_type::*ex)(ARG1) const, ARG1 const& arg1) {
+template <typename C, typename V, typename ARG1>
+V
+minima(C const &c, V (C::value_type::second_type::*ex)(ARG1) const, ARG1 const &arg1)
+{
   V v = std::numeric_limits<V>::max();
-  for ( typename C::const_iterator spot = c.begin(), limit = c.end();
-        spot != limit;
-        ++spot
-  ) {
-    v = std::min(v, ((spot->second).*ex)(arg1) );
+  for (typename C::const_iterator spot = c.begin(), limit = c.end(); spot != limit; ++spot) {
+    v = std::min(v, ((spot->second).*ex)(arg1));
   }
   return v;
 }
 
 /** Apply a unary method to every object in a direct container.
 */
-template < typename C, typename V, typename ARG1 > void
-for_each(C& c,  V (C::value_type::*ex)(ARG1), ARG1 const& arg1) {
-  for ( typename C::iterator spot = c.begin(), limit = c.end();
-        spot != limit;
-        ++spot
-  ) ((*spot).*ex)(arg1);
+template <typename C, typename V, typename ARG1>
+void
+for_each(C &c, V (C::value_type::*ex)(ARG1), ARG1 const &arg1)
+{
+  for (typename C::iterator spot = c.begin(), limit = c.end(); spot != limit; ++spot)
+    ((*spot).*ex)(arg1);
 }
 
 /** Apply a unary method to every object in a paired container.
 */
-template < typename C, typename V, typename ARG1 > void
-for_each(C& c,  V (C::value_type::second_type::*ex)(ARG1) const, ARG1 const& arg1) {
-  for ( typename C::iterator spot = c.begin(), limit = c.end();
-        spot != limit;
-        ++spot
-  ) ((spot->second).*ex)(arg1);
+template <typename C, typename V, typename ARG1>
+void
+for_each(C &c, V (C::value_type::second_type::*ex)(ARG1) const, ARG1 const &arg1)
+{
+  for (typename C::iterator spot = c.begin(), limit = c.end(); spot != limit; ++spot)
+    ((spot->second).*ex)(arg1);
 }
 
-template <
-  typename Elt, ///< Element type.
-  typename Value ///< Member value type.
-> struct MemberPredicate {
-  Value const& m_value; ///< Value to test against.
-  Value Elt::*m_mptr; ///< Pointer to member to test.
-  MemberPredicate(Value Elt::*mptr, Value const& v)
-    : m_value(v)
-    , m_mptr(mptr) {
-  }
-  bool operator () (Elt const& elt) const {
-    return elt.*m_mptr == m_value;
-  }
+template <typename Elt,  ///< Element type.
+          typename Value ///< Member value type.
+          >
+struct MemberPredicate {
+  Value const &m_value; ///< Value to test against.
+  Value Elt::*m_mptr;   ///< Pointer to member to test.
+  MemberPredicate(Value Elt::*mptr, Value const &v) : m_value(v), m_mptr(mptr) {}
+  bool operator()(Elt const &elt) const { return elt.*m_mptr == m_value; }
 };
 
-template < typename T, typename V > MemberPredicate<T,V>
-predicate(V T::*m, V const& v) {
-  return MemberPredicate<T,V>(m, v);
+template <typename T, typename V>
+MemberPredicate<T, V>
+predicate(V T::*m, V const &v)
+{
+  return MemberPredicate<T, V>(m, v);
 }
 
-template <
-  typename Elt, ///< Element type.
-  typename Value ///< Member value type.
-> struct MethodPredicate {
+template <typename Elt,  ///< Element type.
+          typename Value ///< Member value type.
+          >
+struct MethodPredicate {
   typedef Value (Elt::*MethodPtr)() const;
-  Value const& m_value; ///< Value to test against.
-  MethodPtr m_mptr; ///< Pointer to method returning value.
-  MethodPredicate(MethodPtr mptr , Value const& v)
-    : m_value(v)
-    , m_mptr(mptr) {
-  }
-  bool operator () (Elt const& elt) const {
-    return (elt.*m_mptr)() == m_value;
-  }
+  Value const &m_value; ///< Value to test against.
+  MethodPtr m_mptr;     ///< Pointer to method returning value.
+  MethodPredicate(MethodPtr mptr, Value const &v) : m_value(v), m_mptr(mptr) {}
+  bool operator()(Elt const &elt) const { return (elt.*m_mptr)() == m_value; }
 };
 
-template < typename T, typename V > MethodPredicate<T,V>
-predicate(V (T::*m)() const, V const& v) {
-  return MethodPredicate<T,V>(m, v);
+template <typename T, typename V>
+MethodPredicate<T, V>
+predicate(V (T::*m)() const, V const &v)
+{
+  return MethodPredicate<T, V>(m, v);
 }
 
-# if 0
+#if 0
 
 /// Accumulate a minimum value when called repeated on different objects.
 template <
@@ -196,8 +201,8 @@ template <
   }
 };
 
-# endif
+#endif
 
 } // namespace ts
 
-# endif // TS_WCCP_META_HEADER
+#endif // TS_WCCP_META_HEADER

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpMsg.cc
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpMsg.cc b/lib/wccp/WccpMsg.cc
index 03d4191..c4ed4f9 100644
--- a/lib/wccp/WccpMsg.cc
+++ b/lib/wccp/WccpMsg.cc
@@ -20,29 +20,30 @@
     limitations under the License.
  */
 
-# include "WccpLocal.h"
-# include <errno.h>
-# include <openssl/md5.h>
-# include <TsException.h>
-# include "ink_memory.h"
-# include "ink_string.h"
-
-namespace wccp {
+#include "WccpLocal.h"
+#include <errno.h>
+#include <openssl/md5.h>
+#include <TsException.h>
+#include "ink_memory.h"
+#include "ink_string.h"
+
+namespace wccp
+{
 // ------------------------------------------------------
 // ------------------------------------------------------
-ServiceGroup&
-ServiceGroup::setSvcType(ServiceGroup::Type t) {
+ServiceGroup &
+ServiceGroup::setSvcType(ServiceGroup::Type t)
+{
   if (STANDARD == t) {
     // For standard service, everything past ID must be zero.
-    memset(&m_priority, 0,
-           sizeof(*this) - (reinterpret_cast<char*>(&m_priority) - reinterpret_cast<char*>(this)));
+    memset(&m_priority, 0, sizeof(*this) - (reinterpret_cast<char *>(&m_priority) - reinterpret_cast<char *>(this)));
   }
   m_svc_type = t; // store actual type.
   return *this;
 }
 
-bool
-ServiceGroup::operator == (self const& that) const {
+bool ServiceGroup::operator==(self const &that) const
+{
   if (m_svc_type == STANDARD) {
     // If type are different, fail, else if both are STANDARD
     // then we need only match on the ID.
@@ -53,46 +54,48 @@ ServiceGroup::operator == (self const& that) const {
     // Both services are DYNAMIC, check the properties.
     // Port check is technically too strict -- should ignore
     // ports beyond the terminating null port. Oh well.
-    return m_svc_id == that.m_svc_id
-      && m_protocol == that.m_protocol
-      && m_flags == that.m_flags
-      && m_priority == that.m_priority
-      && 0 == memcmp(m_ports, that.m_ports, sizeof(m_ports))
-      ;
+    return m_svc_id == that.m_svc_id && m_protocol == that.m_protocol && m_flags == that.m_flags && m_priority == that.m_priority &&
+           0 == memcmp(m_ports, that.m_ports, sizeof(m_ports));
   }
 }
 // ------------------------------------------------------
 // ------------------------------------------------------
-CacheHashIdElt&
-CacheHashIdElt::setBucket(int idx, bool state) {
-  uint8_t& bucket = m_buckets[idx>>3];
+CacheHashIdElt &
+CacheHashIdElt::setBucket(int idx, bool state)
+{
+  uint8_t &bucket = m_buckets[idx >> 3];
   uint8_t mask = 1 << (idx & 7);
-  if (state) bucket |= mask;
-  else bucket &= !mask;
+  if (state)
+    bucket |= mask;
+  else
+    bucket &= !mask;
   return *this;
 }
 
-CacheHashIdElt&
-CacheHashIdElt::setBuckets(bool state) {
+CacheHashIdElt &
+CacheHashIdElt::setBuckets(bool state)
+{
   memset(m_buckets, state ? 0xFF : 0, sizeof(m_buckets));
   return *this;
 }
 
-CacheIdBox::CacheIdBox()
-  : m_base(0)
-  , m_tail(0)
-  , m_size(0)
-  , m_cap(0) {
+CacheIdBox::CacheIdBox() : m_base(0), m_tail(0), m_size(0), m_cap(0)
+{
 }
 
-size_t CacheIdBox::getSize() const { return m_size; }
+size_t
+CacheIdBox::getSize() const
+{
+  return m_size;
+}
 
-CacheIdBox&
-CacheIdBox::require(size_t n) {
+CacheIdBox &
+CacheIdBox::require(size_t n)
+{
   if (m_cap < n) {
     if (m_base && m_cap)
       ats_free(m_base);
-    m_base = static_cast<CacheIdElt*>(ats_malloc(n));
+    m_base = static_cast<CacheIdElt *>(ats_malloc(n));
     m_cap = n;
   }
   memset(m_base, 0, m_cap);
@@ -100,24 +103,26 @@ CacheIdBox::require(size_t n) {
   return *this;
 }
 
-CacheIdBox&
-CacheIdBox::initDefaultHash(uint32_t addr) {
+CacheIdBox &
+CacheIdBox::initDefaultHash(uint32_t addr)
+{
   this->require(sizeof(CacheHashIdElt));
   m_size = sizeof(CacheHashIdElt);
   m_base->initHashRev().setUnassigned(true).setMask(false).setAddr(addr);
-  m_tail = static_cast<CacheHashIdElt*>(m_base)->getTailPtr();
+  m_tail = static_cast<CacheHashIdElt *>(m_base)->getTailPtr();
   m_tail->m_weight = htons(0);
   m_tail->m_status = htons(0);
   return *this;
 }
 
-CacheIdBox&
-CacheIdBox::initDefaultMask(uint32_t addr) {
+CacheIdBox &
+CacheIdBox::initDefaultMask(uint32_t addr)
+{
   // Base element plus set with 1 value plus tail.
   this->require(sizeof(CacheMaskIdElt) + MaskValueSetElt::calcSize(1) + sizeof(CacheIdElt::Tail));
-  CacheMaskIdElt* mid = static_cast<CacheMaskIdElt*>(m_base);
+  CacheMaskIdElt *mid = static_cast<CacheMaskIdElt *>(m_base);
   mid->initHashRev().setUnassigned(true).setMask(true).setAddr(addr);
-  mid->m_assign.init(0,0,0,0)->addValue(addr, 0, 0, 0, 0);
+  mid->m_assign.init(0, 0, 0, 0)->addValue(addr, 0, 0, 0, 0);
   m_size = mid->getSize();
   m_tail = mid->getTailPtr();
   m_tail->m_weight = htons(0);
@@ -125,44 +130,44 @@ CacheIdBox::initDefaultMask(uint32_t addr) {
   return *this;
 }
 
-CacheIdBox&
-CacheIdBox::fill(self const& src) {
+CacheIdBox &
+CacheIdBox::fill(self const &src)
+{
   size_t n = src.getSize();
   this->require(src.getSize());
   memcpy(m_base, src.m_base, n);
   m_size = src.m_size;
   // If tail is set in src, use the same offset here.
   if (src.m_tail)
-    m_tail = reinterpret_cast<CacheIdElt::Tail*>(
-      reinterpret_cast<char*>(m_base) + (
-        reinterpret_cast<char*>(src.m_tail)
-        - reinterpret_cast<char*>(src.m_base)
-    ));
-  else m_tail = 0;
+    m_tail = reinterpret_cast<CacheIdElt::Tail *>(reinterpret_cast<char *>(m_base) +
+                                                  (reinterpret_cast<char *>(src.m_tail) - reinterpret_cast<char *>(src.m_base)));
+  else
+    m_tail = 0;
   return *this;
 }
 
-CacheIdBox&
-CacheIdBox::fill(void* base, self const& src) {
+CacheIdBox &
+CacheIdBox::fill(void *base, self const &src)
+{
   m_size = src.getSize();
   m_cap = 0;
-  m_base = static_cast<CacheIdElt*>(base);
+  m_base = static_cast<CacheIdElt *>(base);
   memcpy(m_base, src.m_base, m_size);
   return *this;
 }
 
 int
-CacheIdBox::parse(MsgBuffer base) {
+CacheIdBox::parse(MsgBuffer base)
+{
   int zret = PARSE_SUCCESS;
-  CacheIdElt* ptr = reinterpret_cast<CacheIdElt*>(base.getTail());
+  CacheIdElt *ptr = reinterpret_cast<CacheIdElt *>(base.getTail());
   size_t n = base.getSpace();
   m_cap = 0;
   if (ptr->isMask()) {
-    CacheMaskIdElt* mptr = static_cast<CacheMaskIdElt*>(ptr);
+    CacheMaskIdElt *mptr = static_cast<CacheMaskIdElt *>(ptr);
     size_t size = sizeof(CacheMaskIdElt);
     // Sanity check - verify enough room for empty elements.
-    if (n < size
-      || n < size + MaskValueSetElt::calcSize(0) * mptr->getCount()) {
+    if (n < size || n < size + MaskValueSetElt::calcSize(0) * mptr->getCount()) {
       zret = PARSE_BUFFER_TOO_SMALL;
     } else {
       m_size = mptr->getSize();
@@ -179,107 +184,119 @@ CacheIdBox::parse(MsgBuffer base) {
       logf(LVL_DEBUG, "I_SEE_YOU Cache Hash ID too small: %lu < %lu", n, sizeof(CacheHashIdElt));
     } else {
       m_size = sizeof(CacheHashIdElt);
-      m_tail = static_cast<CacheHashIdElt*>(m_base)->getTailPtr();
+      m_tail = static_cast<CacheHashIdElt *>(m_base)->getTailPtr();
     }
   }
-  if (PARSE_SUCCESS == zret) m_base = ptr;
+  if (PARSE_SUCCESS == zret)
+    m_base = ptr;
   return zret;
 }
 // ------------------------------------------------------
 inline CapabilityElt::Type
-CapabilityElt::getCapType() const {
+CapabilityElt::getCapType() const
+{
   return static_cast<Type>(ntohs(m_cap_type));
 }
 
-inline CapabilityElt&
-CapabilityElt::setCapType(Type cap) {
+inline CapabilityElt &
+CapabilityElt::setCapType(Type cap)
+{
   m_cap_type = htons(cap);
   return *this;
 }
 
 inline uint32_t
-CapabilityElt::getCapData() const {
+CapabilityElt::getCapData() const
+{
   return ntohl(m_cap_data);
 }
 
-inline CapabilityElt&
-CapabilityElt::setCapData(uint32_t data) {
+inline CapabilityElt &
+CapabilityElt::setCapData(uint32_t data)
+{
   m_cap_data = htonl(data);
   return *this;
 }
 
-CapabilityElt::CapabilityElt() {
+CapabilityElt::CapabilityElt()
+{
 }
 
-CapabilityElt::CapabilityElt(Type cap, uint32_t data) {
+CapabilityElt::CapabilityElt(Type cap, uint32_t data)
+{
   this->setCapType(cap);
   this->setCapData(data);
   m_cap_length = htons(sizeof(uint32_t));
 }
 // ------------------------------------------------------
 inline uint32_t
-ValueElt::getf_src_addr() const {
+ValueElt::getf_src_addr() const
+{
   return ntohl(m_src_addr);
 }
 
-inline ValueElt&
-ValueElt::setf_src_addr(uint32_t addr) {
+inline ValueElt &
+ValueElt::setf_src_addr(uint32_t addr)
+{
   m_src_addr = htonl(addr);
   return *this;
 }
 
 inline uint32_t
-ValueElt::getDstAddr() const {
+ValueElt::getDstAddr() const
+{
   return ntohl(m_dst_addr);
 }
 
-inline ValueElt&
-ValueElt::setf_dst_addr(uint32_t addr) {
+inline ValueElt &
+ValueElt::setf_dst_addr(uint32_t addr)
+{
   m_dst_addr = htonl(addr);
   return *this;
 }
 
 inline uint16_t
-ValueElt::getf_src_port() const {
+ValueElt::getf_src_port() const
+{
   return ntohs(m_src_port);
 }
 
-inline ValueElt&
-ValueElt::setf_src_port(uint16_t port) {
+inline ValueElt &
+ValueElt::setf_src_port(uint16_t port)
+{
   m_src_port = htons(port);
   return *this;
 }
 
 inline uint16_t
-ValueElt::getDstPort() const {
+ValueElt::getDstPort() const
+{
   return ntohs(m_dst_port);
 }
 
-inline ValueElt&
-ValueElt::setf_dst_port(uint16_t port) {
+inline ValueElt &
+ValueElt::setf_dst_port(uint16_t port)
+{
   m_dst_port = htons(port);
   return *this;
 }
 
 inline uint32_t
-ValueElt::getCacheAddr() const {
+ValueElt::getCacheAddr() const
+{
   return ntohl(m_cache_addr);
 }
 
-inline ValueElt&
-ValueElt::setCacheAddr(uint32_t addr) {
+inline ValueElt &
+ValueElt::setCacheAddr(uint32_t addr)
+{
   m_cache_addr = htonl(addr);
   return *this;
 }
 // ------------------------------------------------------
-MaskValueSetElt&
-MaskValueSetElt::addValue(
-  uint32_t cacheAddr,
-  uint32_t srcAddr,
-  uint32_t dstAddr,
-  uint16_t srcPort,
-  uint16_t dstPort
-) {
+MaskValueSetElt &
+MaskValueSetElt::addValue(uint32_t cacheAddr, uint32_t srcAddr, uint32_t dstAddr, uint16_t srcPort, uint16_t dstPort)
+{
   uint32_t idx = ntohl(m_count);
   new (this->values() + idx) ValueElt(cacheAddr, srcAddr, dstAddr, srcPort, dstPort);
   m_count = htonl(idx + 1);
@@ -287,45 +304,44 @@ MaskValueSetElt::addValue(
 }
 
 size_t
-MaskAssignElt::getVarSize() const {
+MaskAssignElt::getVarSize() const
+{
   size_t zret = 0;
   int n = this->getCount();
 
-  MaskValueSetElt const* set = reinterpret_cast<MaskValueSetElt const*>(this+1);
+  MaskValueSetElt const *set = reinterpret_cast<MaskValueSetElt const *>(this + 1);
   while (n--) {
     size_t k = set->getSize();
     zret += k;
-    set = reinterpret_cast<MaskValueSetElt const*>(
-      reinterpret_cast<char const*>(set) + k
-    );
+    set = reinterpret_cast<MaskValueSetElt const *>(reinterpret_cast<char const *>(set) + k);
   }
   return zret;
 }
 
-HashAssignElt&
-HashAssignElt::round_robin_assign() {
+HashAssignElt &
+HashAssignElt::round_robin_assign()
+{
   uint32_t v_caches = this->getCount();
-  Bucket* buckets = this->getBucketBase();
-  if (1 == v_caches) memset(buckets, 0, sizeof(Bucket) * N_BUCKETS);
+  Bucket *buckets = this->getBucketBase();
+  if (1 == v_caches)
+    memset(buckets, 0, sizeof(Bucket) * N_BUCKETS);
   else { // Assign round robin.
     size_t x = 0;
-    for ( Bucket *spot = buckets, *limit = spot + N_BUCKETS;
-          spot < limit;
-          ++spot
-    ) {
+    for (Bucket *spot = buckets, *limit = spot + N_BUCKETS; spot < limit; ++spot) {
       spot->m_idx = x;
       spot->m_alt = 0;
-      x = ( x + 1 ) % v_caches;
+      x = (x + 1) % v_caches;
     }
   }
   return *this;
 }
 
-RouterAssignListElt&
-RouterAssignListElt::updateRouterId(uint32_t addr, uint32_t rcvid, uint32_t cno) {
+RouterAssignListElt &
+RouterAssignListElt::updateRouterId(uint32_t addr, uint32_t rcvid, uint32_t cno)
+{
   uint32_t n = this->getCount();
-  RouterAssignElt* elt = access_array<RouterAssignElt>(this+1);
-  for ( uint32_t i = 0 ; i < n ; ++i, ++elt ) {
+  RouterAssignElt *elt = access_array<RouterAssignElt>(this + 1);
+  for (uint32_t i = 0; i < n; ++i, ++elt) {
     if (addr == elt->getAddr()) {
       elt->setChangeNumber(cno).setRecvId(rcvid);
       break;
@@ -335,45 +351,53 @@ RouterAssignListElt::updateRouterId(uint32_t addr, uint32_t rcvid, uint32_t cno)
 }
 // ------------------------------------------------------
 message_type_t
-MsgHeaderComp::getType() {
+MsgHeaderComp::getType()
+{
   return static_cast<message_type_t>(get_field(&raw_t::m_type, m_base));
 }
 
 uint16_t
-MsgHeaderComp::getVersion() {
+MsgHeaderComp::getVersion()
+{
   return get_field(&raw_t::m_version, m_base);
 }
 
 uint16_t
-MsgHeaderComp::getLength() {
+MsgHeaderComp::getLength()
+{
   return get_field(&raw_t::m_length, m_base);
 }
 
-MsgHeaderComp&
-MsgHeaderComp::setType(message_type_t type) {
+MsgHeaderComp &
+MsgHeaderComp::setType(message_type_t type)
+{
   set_field(&raw_t::m_type, m_base, type);
   return *this;
 }
 
-MsgHeaderComp&
-MsgHeaderComp::setVersion(uint16_t version) {
+MsgHeaderComp &
+MsgHeaderComp::setVersion(uint16_t version)
+{
   set_field(&raw_t::m_version, m_base, version);
   return *this;
 }
 
-MsgHeaderComp&
-MsgHeaderComp::setLength(uint16_t length) {
+MsgHeaderComp &
+MsgHeaderComp::setLength(uint16_t length)
+{
   set_field(&raw_t::m_length, m_base, length);
   return *this;
 }
 
 size_t
-MsgHeaderComp::calcSize() {
+MsgHeaderComp::calcSize()
+{
   return sizeof(raw_t);
 }
 
-MsgHeaderComp&
-MsgHeaderComp::fill(MsgBuffer& buffer, message_type_t t) {
+MsgHeaderComp &
+MsgHeaderComp::fill(MsgBuffer &buffer, message_type_t t)
+{
   size_t comp_size = this->calcSize();
   if (buffer.getSpace() < comp_size)
     throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
@@ -384,7 +408,8 @@ MsgHeaderComp::fill(MsgBuffer& buffer, message_type_t t) {
 }
 
 int
-MsgHeaderComp::parse(MsgBuffer& base) {
+MsgHeaderComp::parse(MsgBuffer &base)
+{
   int zret = PARSE_SUCCESS;
   size_t comp_size = this->calcSize();
   if (base.getSpace() < comp_size) {
@@ -394,8 +419,7 @@ MsgHeaderComp::parse(MsgBuffer& base) {
     // Length field puts end of message past end of buffer.
     if (this->getLength() + comp_size > base.getSpace()) {
       zret = PARSE_MSG_TOO_BIG;
-    } else if (INVALID_MSG_TYPE == this->toMsgType(get_field(&raw_t::m_type, m_base))
-    ) {
+    } else if (INVALID_MSG_TYPE == this->toMsgType(get_field(&raw_t::m_type, m_base))) {
       zret = PARSE_COMP_TYPE_INVALID;
     } else {
       base.use(comp_size);
@@ -408,30 +432,35 @@ SecurityComp::Key SecurityComp::m_default_key;
 SecurityComp::Option SecurityComp::m_default_opt = SECURITY_NONE;
 
 SecurityComp::Option
-SecurityComp::getOption() const {
+SecurityComp::getOption() const
+{
   return static_cast<Option>(get_field(&RawNone::m_option, m_base));
 }
 
-SecurityComp&
-SecurityComp::setOption(Option opt) {
+SecurityComp &
+SecurityComp::setOption(Option opt)
+{
   set_field(&RawNone::m_option, m_base, static_cast<uint32_t>(opt));
   return *this;
 }
 
-SecurityComp&
-SecurityComp::setKey(char const* key) {
+SecurityComp &
+SecurityComp::setKey(char const *key)
+{
   m_local_key = true;
   strncpy(m_key, key, KEY_SIZE);
   return *this;
 }
 
 void
-SecurityComp::setDefaultKey(char const* key) {
+SecurityComp::setDefaultKey(char const *key)
+{
   strncpy(m_default_key, key, KEY_SIZE);
 }
 
-SecurityComp&
-SecurityComp::fill(MsgBuffer& buffer, Option opt) {
+SecurityComp &
+SecurityComp::fill(MsgBuffer &buffer, Option opt)
+{
   size_t comp_size = this->calcSize(opt);
 
   if (buffer.getSpace() < comp_size)
@@ -439,13 +468,10 @@ SecurityComp::fill(MsgBuffer& buffer, Option opt) {
 
   m_base = buffer.getTail();
 
-  this->setType(COMP_TYPE)
-    .setLength(comp_size - sizeof(super::raw_t))
-    .setOption(opt)
-    ;
+  this->setType(COMP_TYPE).setLength(comp_size - sizeof(super::raw_t)).setOption(opt);
 
   if (SECURITY_NONE != opt) {
-    RawMD5::HashData& data = access_field(&RawMD5::m_data, m_base);
+    RawMD5::HashData &data = access_field(&RawMD5::m_data, m_base);
     memset(data, 0, sizeof(data));
   }
 
@@ -453,11 +479,12 @@ SecurityComp::fill(MsgBuffer& buffer, Option opt) {
   return *this;
 }
 
-SecurityComp&
-SecurityComp::secure(MsgBuffer const& msg) {
+SecurityComp &
+SecurityComp::secure(MsgBuffer const &msg)
+{
   if (SECURITY_MD5 == this->getOption()) {
     MD5_CTX ctx;
-    char const* key = m_local_key ? m_key : m_default_key;
+    char const *key = m_local_key ? m_key : m_default_key;
     MD5_Init(&ctx);
     MD5_Update(&ctx, key, KEY_SIZE);
     MD5_Update(&ctx, msg.getBase(), msg.getCount());
@@ -467,13 +494,14 @@ SecurityComp::secure(MsgBuffer const& msg) {
 }
 
 bool
-SecurityComp::validate(MsgBuffer const& msg) const {
+SecurityComp::validate(MsgBuffer const &msg) const
+{
   bool zret = true;
   if (SECURITY_MD5 == this->getOption()) {
     RawMD5::HashData save;
-    RawMD5::HashData& org = const_cast<RawMD5::HashData&>(access_field(&RawMD5::m_data, m_base));
+    RawMD5::HashData &org = const_cast<RawMD5::HashData &>(access_field(&RawMD5::m_data, m_base));
     MD5_CTX ctx;
-    char const* key = m_local_key ? m_key : m_default_key;
+    char const *key = m_local_key ? m_key : m_default_key;
     // save the original hash aside.
     memcpy(save, org, sizeof(save));
     // zero out the component hash area to compute the hash.
@@ -492,14 +520,15 @@ SecurityComp::validate(MsgBuffer const& msg) const {
 }
 
 int
-SecurityComp::parse(MsgBuffer& buffer) {
+SecurityComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       Option opt = this->getOption();
       if (SECURITY_NONE != opt && SECURITY_MD5 != opt)
         zret = PARSE_COMP_INVALID;
@@ -516,29 +545,33 @@ SecurityComp::parse(MsgBuffer& buffer) {
 }
 // ------------------------------------------------------
 
-ServiceComp&
-ServiceComp::setPort(int idx, uint16_t port) {
+ServiceComp &
+ServiceComp::setPort(int idx, uint16_t port)
+{
   this->access()->setPort(idx, port);
   m_port_count = std::max(m_port_count, idx);
   return *this;
 }
 
-ServiceComp&
-ServiceComp::addPort(uint16_t port) {
+ServiceComp &
+ServiceComp::addPort(uint16_t port)
+{
   if (m_port_count < static_cast<int>(ServiceGroup::N_PORTS))
     this->access()->setPort(m_port_count++, port);
   return *this;
 }
 
-ServiceComp&
-ServiceComp::clearPorts() {
+ServiceComp &
+ServiceComp::clearPorts()
+{
   this->access()->clearPorts();
   m_port_count = 0;
   return *this;
 }
 
-ServiceComp&
-ServiceComp::fill(MsgBuffer& buffer, ServiceGroup const& svc) {
+ServiceComp &
+ServiceComp::fill(MsgBuffer &buffer, ServiceGroup const &svc)
+{
   size_t comp_size = this->calcSize();
 
   if (buffer.getSpace() < comp_size)
@@ -552,17 +585,15 @@ ServiceComp::fill(MsgBuffer& buffer, ServiceGroup const& svc) {
   // to get offset of that part of the serialization storage.
   memcpy(
     // This generates a gcc warning, but the next line doesn't. Yay.
-//    static_cast<ServiceGroup*>(reinterpret_cast<raw_t*>(m_base)),
-    &static_cast<ServiceGroup&>(*reinterpret_cast<raw_t*>(m_base)),
-    &svc,
-    sizeof(svc)
-  );
+    //    static_cast<ServiceGroup*>(reinterpret_cast<raw_t*>(m_base)),
+    &static_cast<ServiceGroup &>(*reinterpret_cast<raw_t *>(m_base)), &svc, sizeof(svc));
   buffer.use(comp_size);
   return *this;
 }
 
 int
-ServiceComp::parse(MsgBuffer& buffer) {
+ServiceComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   size_t comp_size = this->calcSize();
   if (buffer.getSpace() < comp_size)
@@ -570,8 +601,8 @@ ServiceComp::parse(MsgBuffer& buffer) {
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
-      ServiceGroup::Type svc  = this->getSvcType();
+    if (PARSE_SUCCESS == zret) {
+      ServiceGroup::Type svc = this->getSvcType();
       if (ServiceGroup::DYNAMIC != svc && ServiceGroup::STANDARD != svc)
         zret = PARSE_COMP_INVALID;
       else if (this->getLength() != comp_size - sizeof(super::raw_t))
@@ -583,75 +614,95 @@ ServiceComp::parse(MsgBuffer& buffer) {
   return zret;
 }
 // ------------------------------------------------------
-RouterIdElt&
-RouterIdComp::idElt() {
+RouterIdElt &
+RouterIdComp::idElt()
+{
   return access_field(&raw_t::m_id, m_base);
 }
 
-RouterIdElt const&
-RouterIdComp::idElt() const {
+RouterIdElt const &
+RouterIdComp::idElt() const
+{
   return access_field(&raw_t::m_id, m_base);
 }
 
-RouterIdComp&
-RouterIdComp::setIdElt(uint32_t addr, uint32_t recv_id) {
+RouterIdComp &
+RouterIdComp::setIdElt(uint32_t addr, uint32_t recv_id)
+{
   this->idElt().setAddr(addr).setRecvId(recv_id);
   return *this;
 }
 
-uint32_t RouterIdComp::getAddr() const { return this->idElt().getAddr(); }
+uint32_t
+RouterIdComp::getAddr() const
+{
+  return this->idElt().getAddr();
+}
 
-RouterIdComp&
-RouterIdComp::setAddr(uint32_t addr) {
+RouterIdComp &
+RouterIdComp::setAddr(uint32_t addr)
+{
   this->idElt().setAddr(addr);
   return *this;
 }
 
-uint32_t RouterIdComp::getRecvId() const { return this->idElt().getRecvId();}
-inline RouterIdComp&
-RouterIdComp::setRecvId(uint32_t id) {
+uint32_t
+RouterIdComp::getRecvId() const
+{
+  return this->idElt().getRecvId();
+}
+inline RouterIdComp &
+RouterIdComp::setRecvId(uint32_t id)
+{
   this->idElt().setRecvId(id);
   return *this;
 }
 
 uint32_t
-RouterIdComp::getToAddr() const {
+RouterIdComp::getToAddr() const
+{
   return access_field(&raw_t::m_to_addr, m_base);
 }
 
-RouterIdComp&
-RouterIdComp::setToAddr(uint32_t addr) {
+RouterIdComp &
+RouterIdComp::setToAddr(uint32_t addr)
+{
   access_field(&raw_t::m_to_addr, m_base) = addr;
   return *this;
 }
 
 uint32_t
-RouterIdComp::getFromCount() const {
+RouterIdComp::getFromCount() const
+{
   return get_field(&raw_t::m_from_count, m_base);
 }
 
 uint32_t
-RouterIdComp::getFromAddr(int idx) const {
+RouterIdComp::getFromAddr(int idx) const
+{
   return access_array<uint32_t>(m_base + sizeof(raw_t))[idx];
 }
 
-RouterIdComp&
-RouterIdComp::setFromAddr(int idx, uint32_t addr) {
-  access_array<uint32_t>(m_base + sizeof(raw_t))[idx] =  addr;
+RouterIdComp &
+RouterIdComp::setFromAddr(int idx, uint32_t addr)
+{
+  access_array<uint32_t>(m_base + sizeof(raw_t))[idx] = addr;
   return *this;
 }
 
 int
-RouterIdComp::findFromAddr(uint32_t addr) {
+RouterIdComp::findFromAddr(uint32_t addr)
+{
   int n = this->getFromCount();
-  uint32_t* addrs = access_array<uint32_t>(m_base + sizeof(raw_t)) + n;
+  uint32_t *addrs = access_array<uint32_t>(m_base + sizeof(raw_t)) + n;
   while (n-- != 0 && *--addrs != addr)
     ;
   return n;
 }
 
-RouterIdComp&
-RouterIdComp::fill(MsgBuffer& buffer, size_t n_caches) {
+RouterIdComp &
+RouterIdComp::fill(MsgBuffer &buffer, size_t n_caches)
+{
   size_t comp_size = this->calcSize(n_caches);
   if (buffer.getSpace() < comp_size)
     throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
@@ -666,14 +717,9 @@ RouterIdComp::fill(MsgBuffer& buffer, size_t n_caches) {
   return *this;
 }
 
-RouterIdComp&
-RouterIdComp::fillSingleton(
-  MsgBuffer& buffer,
-  uint32_t addr,
-  uint32_t recv_count,
-  uint32_t to_addr,
-  uint32_t from_addr
-) {
+RouterIdComp &
+RouterIdComp::fillSingleton(MsgBuffer &buffer, uint32_t addr, uint32_t recv_count, uint32_t to_addr, uint32_t from_addr)
+{
   size_t comp_size = this->calcSize(1);
 
   if (buffer.getSpace() < comp_size)
@@ -681,11 +727,7 @@ RouterIdComp::fillSingleton(
 
   m_base = buffer.getTail();
 
-  this->setType(COMP_TYPE)
-    .setIdElt(addr, recv_count)
-    .setToAddr(to_addr)
-    .setFromAddr(0, from_addr)
-    ;
+  this->setType(COMP_TYPE).setIdElt(addr, recv_count).setToAddr(to_addr).setFromAddr(0, from_addr);
 
   set_field(&raw_t::m_from_count, m_base, 1);
 
@@ -696,7 +738,8 @@ RouterIdComp::fillSingleton(
 }
 
 int
-RouterIdComp::parse(MsgBuffer& buffer) {
+RouterIdComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
@@ -714,67 +757,71 @@ RouterIdComp::parse(MsgBuffer& buffer) {
   return zret;
 }
 // ------------------------------------------------------
-AssignmentKeyElt&
-RouterViewComp::keyElt() {
+AssignmentKeyElt &
+RouterViewComp::keyElt()
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
-AssignmentKeyElt const&
-RouterViewComp::keyElt() const {
+AssignmentKeyElt const &
+RouterViewComp::keyElt() const
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
 uint32_t
-RouterViewComp::getChangeNumber() const {
+RouterViewComp::getChangeNumber() const
+{
   return get_field(&raw_t::m_change_number, m_base);
 }
 
-RouterViewComp&
-RouterViewComp::setChangeNumber(uint32_t n) {
+RouterViewComp &
+RouterViewComp::setChangeNumber(uint32_t n)
+{
   set_field(&raw_t::m_change_number, m_base, n);
   return *this;
 }
 
 uint32_t
-RouterViewComp::getCacheCount() const {
+RouterViewComp::getCacheCount() const
+{
   return ntohl(*m_cache_count);
 }
 
 uint32_t
-RouterViewComp::getRouterCount() const {
+RouterViewComp::getRouterCount() const
+{
   return get_field(&raw_t::m_router_count, m_base);
 }
 
-CacheIdBox&
-RouterViewComp::cacheId(int idx) {
+CacheIdBox &
+RouterViewComp::cacheId(int idx)
+{
   return m_cache_ids[idx];
 }
 
 uint32_t
-RouterViewComp::getRouterAddr(int idx) const {
+RouterViewComp::getRouterAddr(int idx) const
+{
   return access_array<uint32_t>(m_base + sizeof(raw_t))[idx];
 }
 
-RouterViewComp&
-RouterViewComp::setRouterAddr(int idx, uint32_t addr) {
+RouterViewComp &
+RouterViewComp::setRouterAddr(int idx, uint32_t addr)
+{
   access_array<uint32_t>(m_base + sizeof(raw_t))[idx] = addr;
   return *this;
 }
 
-uint32_t*
-RouterViewComp::calc_cache_count_ptr() {
-  return reinterpret_cast<uint32_t*>(
-    m_base + sizeof(raw_t)
-    + this->getRouterCount() * sizeof(uint32_t)
-  );
+uint32_t *
+RouterViewComp::calc_cache_count_ptr()
+{
+  return reinterpret_cast<uint32_t *>(m_base + sizeof(raw_t) + this->getRouterCount() * sizeof(uint32_t));
 }
 
-RouterViewComp&
-RouterViewComp::fill(
-  MsgBuffer& buffer,
-  int n_routers,
-  int n_caches
-) {
+RouterViewComp &
+RouterViewComp::fill(MsgBuffer &buffer, int n_routers, int n_caches)
+{
   // TBD: This isn't right since the upgrade to mask support
   // because the size isn't a static function of the router and
   // cache count anymore.
@@ -801,46 +848,49 @@ RouterViewComp::fill(
 }
 
 int
-RouterViewComp::parse(MsgBuffer& buffer) {
+RouterViewComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       uint32_t ncaches; // # of caches.
-      if (this->getRouterCount() > MAX_ROUTERS) zret = PARSE_MSG_INVALID;
+      if (this->getRouterCount() > MAX_ROUTERS)
+        zret = PARSE_MSG_INVALID;
       // check if cache count is past end of buffer
-      else if (static_cast<void*>(m_cache_count = this->calc_cache_count_ptr())
-        >= static_cast<void*>(buffer.getBase() + buffer.getSize())
-      )
+      else if (static_cast<void *>(m_cache_count = this->calc_cache_count_ptr()) >=
+               static_cast<void *>(buffer.getBase() + buffer.getSize()))
         zret = PARSE_COMP_WRONG_SIZE, log(LVL_DEBUG, "I_SEE_YOU: cache counter past end of buffer");
       else if ((ncaches = this->getCacheCount()) > MAX_CACHES)
         zret = PARSE_MSG_INVALID;
       else {
-        size_t comp_size = reinterpret_cast<char*>(m_cache_count+1) - m_base;
+        size_t comp_size = reinterpret_cast<char *>(m_cache_count + 1) - m_base;
         // Walk the cache ID elements.
         MsgBuffer spot(buffer);
-        CacheIdBox* box = m_cache_ids;
+        CacheIdBox *box = m_cache_ids;
         uint32_t idx = 0;
         spot.use(comp_size);
-        while ( idx < ncaches && PARSE_SUCCESS == (zret = box->parse(spot))) {
+        while (idx < ncaches && PARSE_SUCCESS == (zret = box->parse(spot))) {
           size_t k = box->getSize();
           spot.use(k);
           comp_size += k;
           ++box;
           ++idx;
         }
-        if (PARSE_SUCCESS == zret) buffer.use(comp_size);
+        if (PARSE_SUCCESS == zret)
+          buffer.use(comp_size);
       }
     }
   }
   return zret;
 }
 // ------------------------------------------------------
-CacheIdComp&
-CacheIdComp::fill(MsgBuffer& base, CacheIdBox const& src) {
+CacheIdComp &
+CacheIdComp::fill(MsgBuffer &base, CacheIdBox const &src)
+{
   size_t comp_size = src.getSize() + HEADER_SIZE;
 
   if (base.getSpace() < comp_size)
@@ -854,16 +904,17 @@ CacheIdComp::fill(MsgBuffer& base, CacheIdBox const& src) {
 }
 
 int
-CacheIdComp::parse(MsgBuffer& buffer) {
+CacheIdComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       MsgBuffer tmp(buffer);
-      tmp.use(reinterpret_cast<char*>(&(access_field(&raw_t::m_id, m_base))) - m_base);
+      tmp.use(reinterpret_cast<char *>(&(access_field(&raw_t::m_id, m_base))) - m_base);
       zret = m_box.parse(tmp);
       if (PARSE_SUCCESS == zret) {
         size_t comp_size = HEADER_SIZE + m_box.getSize();
@@ -878,72 +929,74 @@ CacheIdComp::parse(MsgBuffer& buffer) {
 }
 // ------------------------------------------------------
 uint32_t
-CacheViewComp::getChangeNumber() const {
+CacheViewComp::getChangeNumber() const
+{
   return get_field(&raw_t::m_change_number, m_base);
 }
 
-CacheViewComp&
-CacheViewComp::setChangeNumber(uint32_t n) {
+CacheViewComp &
+CacheViewComp::setChangeNumber(uint32_t n)
+{
   set_field(&raw_t::m_change_number, m_base, n);
   return *this;
 }
 
 uint32_t
-CacheViewComp::getRouterCount() const {
+CacheViewComp::getRouterCount() const
+{
   return get_field(&raw_t::m_router_count, m_base);
 }
 
 uint32_t
-CacheViewComp::getCacheCount() const {
+CacheViewComp::getCacheCount() const
+{
   return ntohl(*m_cache_count);
 }
 
 uint32_t
-CacheViewComp::getCacheAddr(int idx) const {
-  return ntohl(m_cache_count[idx+1]);
+CacheViewComp::getCacheAddr(int idx) const
+{
+  return ntohl(m_cache_count[idx + 1]);
 }
 
-CacheViewComp&
-CacheViewComp::setCacheAddr(int idx, uint32_t addr) {
-  m_cache_count[idx+1] = addr;
+CacheViewComp &
+CacheViewComp::setCacheAddr(int idx, uint32_t addr)
+{
+  m_cache_count[idx + 1] = addr;
   return *this;
 }
 
-RouterIdElt*
-CacheViewComp::atf_router_array() {
-  return reinterpret_cast<RouterIdElt*>(m_base + sizeof(raw_t));
+RouterIdElt *
+CacheViewComp::atf_router_array()
+{
+  return reinterpret_cast<RouterIdElt *>(m_base + sizeof(raw_t));
 }
 
-RouterIdElt&
-CacheViewComp::routerElt(int idx) {
+RouterIdElt &
+CacheViewComp::routerElt(int idx)
+{
   return this->atf_router_array()[idx];
 }
 
-RouterIdElt*
-CacheViewComp::findf_router_elt(uint32_t addr) {
-  for ( RouterIdElt *rtr = this->atf_router_array(),
-          *limit = rtr + this->getRouterCount() ;
-        rtr < limit;
-        ++rtr
-  ) {
-    if (rtr->getAddr() == addr) return rtr;
+RouterIdElt *
+CacheViewComp::findf_router_elt(uint32_t addr)
+{
+  for (RouterIdElt *rtr = this->atf_router_array(), *limit = rtr + this->getRouterCount(); rtr < limit; ++rtr) {
+    if (rtr->getAddr() == addr)
+      return rtr;
   }
   return 0;
 }
 
 size_t
-CacheViewComp::calcSize(int n_routers, int n_caches) {
-  return sizeof(raw_t)
-    + n_routers * sizeof(RouterIdElt)
-    + sizeof(uint32_t) + n_caches * sizeof(uint32_t)
-    ;
+CacheViewComp::calcSize(int n_routers, int n_caches)
+{
+  return sizeof(raw_t) + n_routers * sizeof(RouterIdElt) + sizeof(uint32_t) + n_caches * sizeof(uint32_t);
 }
 
-CacheViewComp&
-CacheViewComp::fill(
-  MsgBuffer& buffer,
-  detail::cache::GroupData const& group
-) {
+CacheViewComp &
+CacheViewComp::fill(MsgBuffer &buffer, detail::cache::GroupData const &group)
+{
   int i;
   size_t n_routers = group.m_routers.size();
   size_t n_caches = group.m_caches.size();
@@ -958,31 +1011,20 @@ CacheViewComp::fill(
 
   set_field(&raw_t::m_router_count, m_base, n_routers);
   // Set the pointer to the count of caches.
-  m_cache_count = reinterpret_cast<uint32_t*>(
-    m_base + sizeof(raw_t) + n_routers * sizeof(RouterIdElt)
-  );
+  m_cache_count = reinterpret_cast<uint32_t *>(m_base + sizeof(raw_t) + n_routers * sizeof(RouterIdElt));
   *m_cache_count = htonl(n_caches); // set the actual count.
 
   // Fill routers.
   i = 0;
-  for ( detail::cache::RouterBag::const_iterator spot = group.m_routers.begin(),
-          limit = group.m_routers.end();
-        spot != limit;
-        ++spot, ++i
-  ) {
-    this->routerElt(i)
-      .setAddr(spot->m_addr)
-      .setRecvId(spot->m_recv.m_sn)
-      ;
+  for (detail::cache::RouterBag::const_iterator spot = group.m_routers.begin(), limit = group.m_routers.end(); spot != limit;
+       ++spot, ++i) {
+    this->routerElt(i).setAddr(spot->m_addr).setRecvId(spot->m_recv.m_sn);
   }
 
   // fill caches.
   i = 0;
-  for ( detail::cache::CacheBag::const_iterator spot = group.m_caches.begin(),
-          limit = group.m_caches.end();
-        spot != limit;
-        ++spot, ++i
-  ) {
+  for (detail::cache::CacheBag::const_iterator spot = group.m_caches.begin(), limit = group.m_caches.end(); spot != limit;
+       ++spot, ++i) {
     this->setCacheAddr(i, spot->idAddr());
   }
 
@@ -992,18 +1034,16 @@ CacheViewComp::fill(
 }
 
 int
-CacheViewComp::parse(MsgBuffer& buffer) {
+CacheViewComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
-      m_cache_count = reinterpret_cast<uint32_t*>(
-        m_base + sizeof(raw_t)
-        + this->getRouterCount() * sizeof(RouterIdElt)
-      );
+    if (PARSE_SUCCESS == zret) {
+      m_cache_count = reinterpret_cast<uint32_t *>(m_base + sizeof(raw_t) + this->getRouterCount() * sizeof(RouterIdElt));
       size_t comp_size = this->calcSize(this->getRouterCount(), this->getCacheCount());
       if (this->getLength() != comp_size - sizeof(super::raw_t))
         zret = PARSE_COMP_WRONG_SIZE;
@@ -1014,92 +1054,98 @@ CacheViewComp::parse(MsgBuffer& buffer) {
   return zret;
 }
 // ------------------------------------------------------
-AssignmentKeyElt&
-AssignInfoComp::keyElt() {
+AssignmentKeyElt &
+AssignInfoComp::keyElt()
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
-AssignmentKeyElt const&
-AssignInfoComp::keyElt() const {
+AssignmentKeyElt const &
+AssignInfoComp::keyElt() const
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
 uint32_t
-AssignInfoComp::getKeyChangeNumber() const {
+AssignInfoComp::getKeyChangeNumber() const
+{
   return access_field(&raw_t::m_key, m_base).getChangeNumber();
 }
 
-AssignInfoComp&
-AssignInfoComp::setKeyChangeNumber(uint32_t n) {
+AssignInfoComp &
+AssignInfoComp::setKeyChangeNumber(uint32_t n)
+{
   access_field(&raw_t::m_key, m_base).setChangeNumber(n);
   return *this;
 }
 
 uint32_t
-AssignInfoComp::getKeyAddr() const {
+AssignInfoComp::getKeyAddr() const
+{
   return access_field(&raw_t::m_key, m_base).getAddr();
 }
 
-AssignInfoComp&
-AssignInfoComp::setKeyAddr(uint32_t addr) {
+AssignInfoComp &
+AssignInfoComp::setKeyAddr(uint32_t addr)
+{
   access_field(&raw_t::m_key, m_base).setAddr(addr);
   return *this;
 }
 
 uint32_t
-AssignInfoComp::getRouterCount() const {
+AssignInfoComp::getRouterCount() const
+{
   return access_field(&raw_t::m_routers, m_base).getCount();
 }
 
-RouterAssignElt&
-AssignInfoComp::routerElt(int idx) {
+RouterAssignElt &
+AssignInfoComp::routerElt(int idx)
+{
   return access_field(&raw_t::m_routers, m_base).elt(idx);
 }
 
 uint32_t
-AssignInfoComp::getCacheCount() const {
+AssignInfoComp::getCacheCount() const
+{
   return ntohl(*m_cache_count);
 }
 
 uint32_t
-AssignInfoComp::getCacheAddr(int idx) const {
-  return m_cache_count[idx+1];
+AssignInfoComp::getCacheAddr(int idx) const
+{
+  return m_cache_count[idx + 1];
 }
 
-AssignInfoComp&
-AssignInfoComp::setCacheAddr(int idx, uint32_t addr) {
-  m_cache_count[idx+1] = addr;
+AssignInfoComp &
+AssignInfoComp::setCacheAddr(int idx, uint32_t addr)
+{
+  m_cache_count[idx + 1] = addr;
   return *this;
 }
 
 size_t
-AssignInfoComp::calcSize(int n_routers, int n_caches) {
-  return sizeof(raw_t)
-    + RouterAssignListElt::calcVarSize(n_routers)
-    + HashAssignElt::calcSize(n_caches)
-    ;
+AssignInfoComp::calcSize(int n_routers, int n_caches)
+{
+  return sizeof(raw_t) + RouterAssignListElt::calcVarSize(n_routers) + HashAssignElt::calcSize(n_caches);
 }
 
-uint32_t*
-AssignInfoComp::calcCacheCountPtr() {
-  return reinterpret_cast<uint32_t*>(
-    m_base + sizeof(raw_t)
-    + access_field(&raw_t::m_routers, m_base).getVarSize()
-  );
+uint32_t *
+AssignInfoComp::calcCacheCountPtr()
+{
+  return reinterpret_cast<uint32_t *>(m_base + sizeof(raw_t) + access_field(&raw_t::m_routers, m_base).getVarSize());
 }
 
-AssignInfoComp::Bucket*
-AssignInfoComp::calcBucketPtr() {
-  return reinterpret_cast<Bucket*>(reinterpret_cast<char*>(m_cache_count) + sizeof(uint32_t) * (1 + this->getCacheCount()));
+AssignInfoComp::Bucket *
+AssignInfoComp::calcBucketPtr()
+{
+  return reinterpret_cast<Bucket *>(reinterpret_cast<char *>(m_cache_count) + sizeof(uint32_t) * (1 + this->getCacheCount()));
 }
 
-AssignInfoComp&
-AssignInfoComp::fill(
-  MsgBuffer& buffer,
-  detail::Assignment const& assign
-) {
-  RouterAssignListElt const& ralist = assign.getRouterList();
-  HashAssignElt const& ha = assign.getHash();
+AssignInfoComp &
+AssignInfoComp::fill(MsgBuffer &buffer, detail::Assignment const &assign)
+{
+  RouterAssignListElt const &ralist = assign.getRouterList();
+  HashAssignElt const &ha = assign.getHash();
   size_t n_routers = ralist.getCount();
   size_t n_caches = ha.getCount();
   size_t comp_size = this->calcSize(n_routers, n_caches);
@@ -1123,14 +1169,15 @@ AssignInfoComp::fill(
 }
 
 int
-AssignInfoComp::parse(MsgBuffer& buffer) {
+AssignInfoComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < HEADER_SIZE)
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       int n_routers = this->getRouterCount();
       int n_caches;
       m_cache_count = this->calcCacheCountPtr();
@@ -1143,54 +1190,53 @@ AssignInfoComp::parse(MsgBuffer& buffer) {
         buffer.use(comp_size);
     }
   }
-  if (PARSE_SUCCESS != zret) m_base = 0;
+  if (PARSE_SUCCESS != zret)
+    m_base = 0;
   return zret;
 }
 
-AssignmentKeyElt&
-AltAssignComp::keyElt() {
+AssignmentKeyElt &
+AltAssignComp::keyElt()
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
-AssignmentKeyElt const&
-AltAssignComp::keyElt() const {
+AssignmentKeyElt const &
+AltAssignComp::keyElt() const
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
-void*
-AltAssignComp::calcVarPtr() {
-  return reinterpret_cast<void*>(
-    m_base + sizeof(raw_t)
-    + access_field(&raw_t::m_routers, m_base).getVarSize()
-  );
+void *
+AltAssignComp::calcVarPtr()
+{
+  return reinterpret_cast<void *>(m_base + sizeof(raw_t) + access_field(&raw_t::m_routers, m_base).getVarSize());
 }
 
 uint32_t
-AltAssignComp::getRouterCount() const {
+AltAssignComp::getRouterCount() const
+{
   return access_field(&raw_t::m_routers, m_base).getCount();
 }
 
 uint32_t
-AltHashAssignComp::getCacheCount() const {
+AltHashAssignComp::getCacheCount() const
+{
   return ntohl(*m_cache_count);
 }
 
 
 size_t
-AltHashAssignComp::calcSize(int n_routers, int n_caches) {
-  return sizeof(raw_t)
-    + RouterAssignListElt::calcVarSize(n_routers)
-    + HashAssignElt::calcSize(n_caches)
-    ;
+AltHashAssignComp::calcSize(int n_routers, int n_caches)
+{
+  return sizeof(raw_t) + RouterAssignListElt::calcVarSize(n_routers) + HashAssignElt::calcSize(n_caches);
 }
 
-AltHashAssignComp&
-AltHashAssignComp::fill(
-  MsgBuffer& buffer,
-  detail::Assignment const& assign
-) {
-  RouterAssignListElt const& ralist = assign.getRouterList();
-  HashAssignElt const& ha = assign.getHash();
+AltHashAssignComp &
+AltHashAssignComp::fill(MsgBuffer &buffer, detail::Assignment const &assign)
+{
+  RouterAssignListElt const &ralist = assign.getRouterList();
+  HashAssignElt const &ha = assign.getHash();
   size_t n_routers = ralist.getCount();
   size_t n_caches = ha.getCount();
   size_t comp_size = this->calcSize(n_routers, n_caches);
@@ -1203,12 +1249,11 @@ AltHashAssignComp::fill(
   this->setType(COMP_TYPE)
     .setLength(comp_size - HEADER_SIZE)
     .setAssignType(ALT_HASH_ASSIGNMENT)
-    .setAssignLength(comp_size - HEADER_SIZE - sizeof(local_header_t))
-    ;
+    .setAssignLength(comp_size - HEADER_SIZE - sizeof(local_header_t));
   this->keyElt() = assign.getKey();
   memcpy(&(access_field(&raw_t::m_routers, m_base)), &ralist, ralist.getSize());
   // Set the pointer to the count of caches and write the count.
-  m_cache_count = static_cast<uint32_t*>(this->calcVarPtr());
+  m_cache_count = static_cast<uint32_t *>(this->calcVarPtr());
   memcpy(m_cache_count, &ha, ha.getSize());
 
   buffer.use(comp_size);
@@ -1217,17 +1262,18 @@ AltHashAssignComp::fill(
 }
 
 int
-AltHashAssignComp::parse(MsgBuffer& buffer) {
+AltHashAssignComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       int n_routers = this->getRouterCount();
       int n_caches;
-      m_cache_count = static_cast<uint32_t*>(this->calcVarPtr());
+      m_cache_count = static_cast<uint32_t *>(this->calcVarPtr());
       n_caches = this->getCacheCount();
       size_t comp_size = this->calcSize(n_routers, n_caches);
       if (this->getLength() != comp_size - HEADER_SIZE)
@@ -1236,17 +1282,16 @@ AltHashAssignComp::parse(MsgBuffer& buffer) {
         buffer.use(comp_size);
     }
   }
-  if (PARSE_SUCCESS != zret) m_base = 0;
+  if (PARSE_SUCCESS != zret)
+    m_base = 0;
   return zret;
 }
 
-AltMaskAssignComp&
-AltMaskAssignComp::fill(
-  MsgBuffer& buffer,
-  detail::Assignment const& assign
-) {
-  RouterAssignListElt const& ralist = assign.getRouterList();
-  MaskAssignElt const& ma = assign.getMask();
+AltMaskAssignComp &
+AltMaskAssignComp::fill(MsgBuffer &buffer, detail::Assignment const &assign)
+{
+  RouterAssignListElt const &ralist = assign.getRouterList();
+  MaskAssignElt const &ma = assign.getMask();
   size_t comp_size = sizeof(raw_t) + ralist.getVarSize() + ma.getSize();
 
   if (buffer.getSpace() < comp_size)
@@ -1257,12 +1302,11 @@ AltMaskAssignComp::fill(
   this->setType(COMP_TYPE)
     .setLength(comp_size - HEADER_SIZE)
     .setAssignType(ALT_MASK_ASSIGNMENT)
-    .setAssignLength(comp_size - HEADER_SIZE - sizeof(local_header_t))
-    ;
+    .setAssignLength(comp_size - HEADER_SIZE - sizeof(local_header_t));
   this->keyElt() = assign.getKey();
 
   memcpy(&(access_field(&raw_t::m_routers, m_base)), &ralist, ralist.getSize());
-  m_mask_elt = static_cast<MaskAssignElt*>(this->calcVarPtr());
+  m_mask_elt = static_cast<MaskAssignElt *>(this->calcVarPtr());
   memcpy(m_mask_elt, &ma, ma.getSize());
 
   buffer.use(comp_size);
@@ -1271,16 +1315,17 @@ AltMaskAssignComp::fill(
 }
 
 int
-AltMaskAssignComp::parse(MsgBuffer& buffer) {
+AltMaskAssignComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
-      RouterAssignListElt* ralist = &(access_field(&raw_t::m_routers, m_base));
-      m_mask_elt = static_cast<MaskAssignElt*>(this->calcVarPtr());
+    if (PARSE_SUCCESS == zret) {
+      RouterAssignListElt *ralist = &(access_field(&raw_t::m_routers, m_base));
+      m_mask_elt = static_cast<MaskAssignElt *>(this->calcVarPtr());
       size_t comp_size = sizeof(raw_t) + ralist->getVarSize() + m_mask_elt->getSize();
       if (this->getLength() != comp_size - HEADER_SIZE)
         zret = PARSE_COMP_WRONG_SIZE;
@@ -1288,40 +1333,47 @@ AltMaskAssignComp::parse(MsgBuffer& buffer) {
         buffer.use(comp_size);
     }
   }
-  if (PARSE_SUCCESS != zret) m_base = 0;
+  if (PARSE_SUCCESS != zret)
+    m_base = 0;
   return zret;
 }
 
 // ------------------------------------------------------
 CmdComp::cmd_t
-CmdComp::getCmd() const {
+CmdComp::getCmd() const
+{
   return static_cast<cmd_t>(get_field(&raw_t::m_cmd, m_base));
 }
 
-CmdComp&
-CmdComp::setCmd(cmd_t cmd) {
+CmdComp &
+CmdComp::setCmd(cmd_t cmd)
+{
   set_field(&raw_t::m_cmd, m_base, cmd);
   return *this;
 }
 
 uint32_t
-CmdComp::getCmdData() const {
+CmdComp::getCmdData() const
+{
   return get_field(&raw_t::m_cmd_data, m_base);
 }
 
-CmdComp&
-CmdComp::setCmdData(uint32_t data) {
+CmdComp &
+CmdComp::setCmdData(uint32_t data)
+{
   set_field(&raw_t::m_cmd_data, m_base, data);
   return *this;
 }
 
 inline size_t
-CmdComp::calcSize() {
+CmdComp::calcSize()
+{
   return sizeof(raw_t);
 }
 
-CmdComp&
-CmdComp::fill(MsgBuffer& buffer, cmd_t cmd, uint32_t data) {
+CmdComp &
+CmdComp::fill(MsgBuffer &buffer, cmd_t cmd, uint32_t data)
+{
   size_t comp_size = this->calcSize();
 
   if (buffer.getSpace() < comp_size)
@@ -1329,26 +1381,23 @@ CmdComp::fill(MsgBuffer& buffer, cmd_t cmd, uint32_t data) {
 
   m_base = buffer.getTail();
 
-  this->setType(COMP_TYPE)
-    .setCmd(cmd)
-    .setCmdData(data)
-    .setLength(sizeof(raw_t) - sizeof(super::raw_t))
-    ;
+  this->setType(COMP_TYPE).setCmd(cmd).setCmdData(data).setLength(sizeof(raw_t) - sizeof(super::raw_t));
   // Command length is always the same.
   set_field(&raw_t::m_length, m_base, sizeof(uint32_t));
-//  reinterpret_cast<raw_t*>(m_base)->m_length = htons(sizeof(uint32_t));
+  //  reinterpret_cast<raw_t*>(m_base)->m_length = htons(sizeof(uint32_t));
   return *this;
 }
 
 int
-CmdComp::parse(MsgBuffer& buffer) {
+CmdComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       if (this->getLength() + sizeof(super::raw_t) != this->calcSize())
         zret = PARSE_COMP_WRONG_SIZE;
     }
@@ -1356,27 +1405,31 @@ CmdComp::parse(MsgBuffer& buffer) {
   return zret;
 }
 // ------------------------------------------------------
-CapabilityElt&
-CapComp::elt(int idx) {
+CapabilityElt &
+CapComp::elt(int idx)
+{
   return access_array<CapabilityElt>(m_base + sizeof(super::raw_t))[idx];
 }
 
-CapabilityElt const&
-CapComp::elt(int idx) const {
+CapabilityElt const &
+CapComp::elt(int idx) const
+{
   return access_array<CapabilityElt>(m_base + sizeof(super::raw_t))[idx];
 }
 
 void
-CapComp::cache() const {
+CapComp::cache() const
+{
   uint32_t x; // scratch for bounds checking.
   // Reset all values.
   m_packet_forward = ServiceGroup::NO_PACKET_STYLE;
   m_packet_return = ServiceGroup::NO_PACKET_STYLE;
   m_cache_assign = ServiceGroup::NO_CACHE_ASSIGN_STYLE;
-  if (!m_base) return; // No data, everything is default.
+  if (!m_base)
+    return; // No data, everything is default.
   // Load from data.
-  for ( uint32_t i = 0, n = this->getEltCount() ; i < n ; ++i ) {
-    CapabilityElt const& elt = this->elt(i);
+  for (uint32_t i = 0, n = this->getEltCount(); i < n; ++i) {
+    CapabilityElt const &elt = this->elt(i);
     switch (elt.getCapType()) {
     case CapabilityElt::PACKET_FORWARD_METHOD:
       x = elt.getCapData();
@@ -1401,8 +1454,9 @@ CapComp::cache() const {
   m_cached = true;
 }
 
-CapComp&
-CapComp::fill(MsgBuffer& buffer, int n) {
+CapComp &
+CapComp::fill(MsgBuffer &buffer, int n)
+{
   size_t comp_size = this->calcSize(n);
   m_cached = false;
 
@@ -1418,15 +1472,16 @@ CapComp::fill(MsgBuffer& buffer, int n) {
 }
 
 int
-CapComp::parse(MsgBuffer& buffer) {
+CapComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   m_cached = false;
-  if (buffer.getSpace()< sizeof(raw_t))
+  if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       // No explicit count, compute it from length.
       m_count = this->getLength() / sizeof(CapabilityElt);
       buffer.use(this->getLength() + sizeof(super::raw_t));
@@ -1436,9 +1491,10 @@ CapComp::parse(MsgBuffer& buffer) {
 }
 // ------------------------------------------------------
 int
-QueryComp::parse(MsgBuffer& buffer) {
+QueryComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
-  if (buffer.getSpace()< sizeof(raw_t))
+  if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
@@ -1450,14 +1506,16 @@ QueryComp::parse(MsgBuffer& buffer) {
 }
 // ------------------------------------------------------
 uint32_t
-AssignMapComp::getCount() const {
+AssignMapComp::getCount() const
+{
   return access_field(&raw_t::m_assign, m_base).getCount();
 }
 
-AssignMapComp&
-AssignMapComp::fill(MsgBuffer& buffer, detail::Assignment const& assign) {
+AssignMapComp &
+AssignMapComp::fill(MsgBuffer &buffer, detail::Assignment const &assign)
+{
   size_t comp_size = sizeof(raw_t);
-  MaskAssignElt const& ma = assign.getMask();
+  MaskAssignElt const &ma = assign.getMask();
   size_t ma_size = ma.getSize(); // Not constant time.
 
   // Can't be precise, but we need at least one mask/value set with
@@ -1469,41 +1527,38 @@ AssignMapComp::fill(MsgBuffer& buffer, detail::Assignment const& assign) {
   memcpy(&(access_field(&raw_t::m_assign, m_base)), &ma, ma_size);
   comp_size += ma_size - sizeof(ma);
 
-  this->setType(COMP_TYPE)
-    .setLength(comp_size - HEADER_SIZE)
-    ;
+  this->setType(COMP_TYPE).setLength(comp_size - HEADER_SIZE);
   buffer.use(comp_size);
 
   return *this;
 }
 
 int
-AssignMapComp::parse(MsgBuffer& buffer) {
+AssignMapComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < HEADER_SIZE)
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       // TBD - Actually check the mask/value set data !!
       buffer.use(this->getLength() + HEADER_SIZE);
     }
   }
-  if (PARSE_SUCCESS != zret) m_base = 0;
+  if (PARSE_SUCCESS != zret)
+    m_base = 0;
   return zret;
 }
 // ------------------------------------------------------
-detail::Assignment::Assignment()
-  : m_key(0,0)
-  , m_active(false)
-  , m_router_list(0)
-  , m_hash_assign(0)
-  , m_mask_assign(0) {
+detail::Assignment::Assignment() : m_key(0, 0), m_active(false), m_router_list(0), m_hash_assign(0), m_mask_assign(0)
+{
 }
 
 bool
-detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
+detail::Assignment::fill(cache::GroupData &group, uint32_t addr)
+{
   // Compute the last packet received times for the routers.  For each
   // cache, compute how many routers mentioned it in their last
   // packet. Prepare an assignment from those caches.  If there are no
@@ -1511,21 +1566,18 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
   // mentioned by at least one router are purged.
 
   size_t n_routers = group.m_routers.size(); // routers in group
-  size_t n_caches = group.m_caches.size(); // caches in group
+  size_t n_caches = group.m_caches.size();   // caches in group
 
   // We need both routers and caches to do something useful.
-  if (! (n_routers && n_caches)) return false;
+  if (!(n_routers && n_caches))
+    return false;
 
   // Iteration vars.
   size_t cdx, rdx;
-  cache::RouterBag::iterator rspot,
-    rbegin = group.m_routers.begin(),
-    rend = group.m_routers.end();
-  cache::CacheBag::iterator cspot,
-    cbegin = group.m_caches.begin(),
-    cend = group.m_caches.end();
-
-  size_t nr[n_caches]; // validity check counts.
+  cache::RouterBag::iterator rspot, rbegin = group.m_routers.begin(), rend = group.m_routers.end();
+  cache::CacheBag::iterator cspot, cbegin = group.m_caches.begin(), cend = group.m_caches.end();
+
+  size_t nr[n_caches];       // validity check counts.
   memset(nr, 0, sizeof(nr)); // Set counts to zero.
 
   // Guess at size of serialization buffer. For the router list and
@@ -1544,7 +1596,7 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
   // Set assignment key
   m_key.setAddr(addr).setChangeNumber(group.m_generation);
 
-  m_router_list = reinterpret_cast<RouterAssignListElt*>(m_buffer.getBase());
+  m_router_list = reinterpret_cast<RouterAssignListElt *>(m_buffer.getBase());
   new (m_router_list) RouterAssignListElt(n_routers);
 
   // For each router, update the assignment and run over the caches
@@ -1552,15 +1604,11 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
   // recent packet. Note that the router data gets updated from
   // ISeeYou message processing as well, this is more of an initial
   // setup.
-  for ( rdx = 0, rspot = rbegin ; rspot != rend ; ++rspot, ++rdx ) {
+  for (rdx = 0, rspot = rbegin; rspot != rend; ++rspot, ++rdx) {
     // Update router assignment.
-    m_router_list->elt(rdx)
-      .setChangeNumber(rspot->m_generation)
-      .setAddr(rspot->m_addr)
-      .setRecvId(rspot->m_recv.m_sn)
-      ;
+    m_router_list->elt(rdx).setChangeNumber(rspot->m_generation).setAddr(rspot->m_addr).setRecvId(rspot->m_recv.m_sn);
     // Check cache validity.
-    for ( cdx = 0, cspot = cbegin ; cspot != cend ; ++cspot, ++cdx ) {
+    for (cdx = 0, cspot = cbegin; cspot != cend; ++cspot, ++cdx) {
       if (cspot->m_src[rdx].m_time == rspot->m_recv.m_time)
         ++(nr[cdx]);
     }
@@ -1568,19 +1616,19 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
 
   size_t k = m_router_list->getSize();
   m_buffer.use(k);
-  m_hash_assign = reinterpret_cast<HashAssignElt*>(m_buffer.getTail());
+  m_hash_assign = reinterpret_cast<HashAssignElt *>(m_buffer.getTail());
 
   // If the nr value is 0, then the cache was not included in any
   // last packet, so it should be discarded. A cache is valid if
   // nr is n_routers, indicating that every router mentioned it.
   int v_caches = 0; // valid caches
-  for ( cdx = 0, cspot = cbegin ; cspot != cend ; ++cspot, ++cdx )
+  for (cdx = 0, cspot = cbegin; cspot != cend; ++cspot, ++cdx)
     if (nr[cdx] == n_routers) {
       m_hash_assign->setAddr(cdx, cspot->idAddr());
       ++v_caches;
     }
 
-  if (! v_caches) { // no valid caches.
+  if (!v_caches) { // no valid caches.
     log(LVL_INFO, "Attempted to generate cache assignment but no valid caches were found.");
     return false;
   }
@@ -1589,41 +1637,42 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
   m_hash_assign->round_robin_assign();
   m_buffer.use(m_hash_assign->getSize());
 
-  m_mask_assign = reinterpret_cast<MaskAssignElt*>(m_buffer.getTail());
+  m_mask_assign = reinterpret_cast<MaskAssignElt *>(m_buffer.getTail());
   new (m_mask_assign) MaskAssignElt;
 
   // For now, hardwire everything to first cache.
   // We have plenty of space, but will need to check if we do something
   // more complex here.
-  m_mask_assign->init(0,0,0,0)->addValue(m_hash_assign->getAddr(0),0,0,0,0);
+  m_mask_assign->init(0, 0, 0, 0)->addValue(m_hash_assign->getAddr(0), 0, 0, 0, 0);
 
-  logf(LVL_INFO, "Generated assignment for group %d with %d routers, %d valid caches.", group.m_svc.getSvcId(), n_routers, v_caches);
+  logf(LVL_INFO, "Generated assignment for group %d with %d routers, %d valid caches.", group.m_svc.getSvcId(), n_routers,
+       v_caches);
 
   return true;
 }
 // ------------------------------------------------------
 void
-BaseMsg::setBuffer(MsgBuffer const& buffer) {
+BaseMsg::setBuffer(MsgBuffer const &buffer)
+{
   m_buffer = buffer;
 }
 
 void
-BaseMsg::finalize() {
+BaseMsg::finalize()
+{
   m_header.setLength(m_buffer.getCount() - m_header.calcSize());
   m_security.secure(m_buffer);
 }
 
 bool
-BaseMsg::validateSecurity() const {
+BaseMsg::validateSecurity() const
+{
   return m_security.validate(m_buffer);
 }
 // ------------------------------------------------------
 void
-HereIAmMsg::fill(
-    detail::cache::GroupData const& group,
-    CacheIdBox const& cache_id,
-    SecurityOption sec_opt
-) {
+HereIAmMsg::fill(detail::cache::GroupData const &group, CacheIdBox const &cache_id, SecurityOption sec_opt)
+{
   m_header.fill(m_buffer, HERE_I_AM);
   m_security.fill(m_buffer, sec_opt);
   m_service.fill(m_buffer, group.m_svc);
@@ -1632,54 +1681,58 @@ HereIAmMsg::fill(
 }
 
 void
-HereIAmMsg::fill_caps(
-    detail::cache::RouterData const& router
-) {
+HereIAmMsg::fill_caps(detail::cache::RouterData const &router)
+{
   if (router.m_send_caps) {
     m_capabilities.fill(m_buffer, 3);
-    m_capabilities.elt(0) =
-      CapabilityElt(CapabilityElt::PACKET_FORWARD_METHOD, router.m_packet_forward);
-    m_capabilities.elt(1) =
-      CapabilityElt(CapabilityElt::CACHE_ASSIGNMENT_METHOD, router.m_cache_assign);
-    m_capabilities.elt(2) =
-      CapabilityElt(CapabilityElt::PACKET_RETURN_METHOD, router.m_packet_return);
+    m_capabilities.elt(0) = CapabilityElt(CapabilityElt::PACKET_FORWARD_METHOD, router.m_packet_forward);
+    m_capabilities.elt(1) = CapabilityElt(CapabilityElt::CACHE_ASSIGNMENT_METHOD, router.m_cache_assign);
+    m_capabilities.elt(2) = CapabilityElt(CapabilityElt::PACKET_RETURN_METHOD, router.m_packet_return);
   }
 }
 
 int
-HereIAmMsg::parse(ts::Buffer const& buffer) {
+HereIAmMsg::parse(ts::Buffer const &buffer)
+{
   int zret;
   this->setBuffer(buffer);
-  if (!m_buffer.getBase()) return -EINVAL;
+  if (!m_buffer.getBase())
+    return -EINVAL;
   zret = m_header.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
-  if (HERE_I_AM != m_header.getType()) return PARSE_MSG_WRONG_TYPE;
+  if (PARSE_SUCCESS != zret)
+    return zret;
+  if (HERE_I_AM != m_header.getType())
+    return PARSE_MSG_WRONG_TYPE;
 
   // Time to look for components.
   zret = m_security.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_service.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_cache_id.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_cache_view.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   // These are optional so failures can be ignored.
-  if (m_buffer.getSpace()) m_capabilities.parse(m_buffer);
-  if (m_buffer.getSpace()) m_command.parse(m_buffer);
+  if (m_buffer.getSpace())
+    m_capabilities.parse(m_buffer);
+  if (m_buffer.getSpace())
+    m_command.parse(m_buffer);
 
   return m_buffer.getSpace() ? PARSE_DATA_OVERRUN : PARSE_SUCCESS;
 }
 // ------------------------------------------------------
 void
-RedirectAssignMsg::fill(
-  detail::cache::GroupData const& group,
-  SecurityOption sec_opt
-) {
+RedirectAssignMsg::fill(detail::cache::GroupData const &group, SecurityOption sec_opt)
+{
   m_header.fill(m_buffer, REDIRECT_ASSIGN);
   m_security.fill(m_buffer, sec_opt);
   m_service.fill(m_buffer, group.m_svc);
@@ -1697,15 +1750,10 @@ RedirectAssignMsg::fill(
 }
 // ------------------------------------------------------
 void
-ISeeYouMsg::fill(
-  detail::router::GroupData const& group,
-  SecurityOption sec_opt,
-  detail::Assignment& /* assign ATS_UNUSED */,
-  size_t to_caches,
-  size_t n_routers,
-  size_t n_caches,
-  bool /* send_capabilities ATS_UNUSED */
-) {
+ISeeYouMsg::fill(detail::router::GroupData const &group, SecurityOption sec_opt, detail::Assignment & /* assign ATS_UNUSED */,
+                 size_t to_caches, size_t n_routers, size_t n_caches, bool /* send_capabilities ATS_UNUSED */
+                 )
+{
   m_header.fill(m_buffer, I_SEE_YOU);
   m_security.fill(m_buffer, sec_opt);
   m_service.fill(m_buffer, group.m_svc);
@@ -1714,26 +1762,38 @@ ISeeYouMsg::fill(
 }
 
 int
-ISeeYouMsg::parse(ts::Buffer const& buffer) {
+ISeeYouMsg::parse(ts::Buffer const &buffer)
+{
   int zret;
   this->setBuffer(buffer);
-  if (!m_buffer.getBase()) return -EINVAL;
+  if (!m_buffer.getBase())
+    return -EINVAL;
   zret = m_header.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
-  if (I_SEE_YOU != m_header.getType()) return PARSE_MSG_WRONG_TYPE;
+  if (PARSE_SUCCESS != zret)
+    return zret;
+  if (I_SEE_YOU != m_header.getType())
+    return PARSE_MSG_WRONG_TYPE;
 
   // Time to look for components.
   zret = m_security.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_service.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_router_id.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) { logf(LVL_DEBUG, "I_SEE_YOU: Invalid %d router id", zret); return zret; }
+  if (PARSE_SUCCESS != zret) {
+    logf(LVL_DEBUG, "I_SEE_YOU: Invalid %d router id", zret);
+    return zret;
+  }
 
   zret = m_router_view.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) { logf(LVL_DEBUG, "I_SEE_YOU: Invalid %d router view", zret); return zret; }
+  if (PARSE_SUCCESS != zret) {
+    logf(LVL_DEBUG, "I_SEE_YOU: Invalid %d router view", zret);
+    return zret;
+  }
 
   // Optional components.
 
@@ -1756,23 +1816,30 @@ ISeeYouMsg::parse(ts::Buffer const& buffer) {
 }
 // ------------------------------------------------------
 int
-RemovalQueryMsg::parse(ts::Buffer const& buffer) {
+RemovalQueryMsg::parse(ts::Buffer const &buffer)
+{
   int zret;
   this->setBuffer(buffer);
-  if (!m_buffer.getBase()) return -EINVAL;
+  if (!m_buffer.getBase())
+    return -EINVAL;
   zret = m_header.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
-  if (REMOVAL_QUERY != m_header.getType()) return PARSE_MSG_WRONG_TYPE;
+  if (PARSE_SUCCESS != zret)
+    return zret;
+  if (REMOVAL_QUERY != m_header.getType())
+    return PARSE_MSG_WRONG_TYPE;
 
   // Get the components.
   zret = m_security.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_service.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_query.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   return m_buffer.getSpace() ? PARSE_DATA_OVERRUN : PARSE_SUCCESS;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpStatic.cc
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpStatic.cc b/lib/wccp/WccpStatic.cc
index db26418..d0fd91e 100644
--- a/lib/wccp/WccpStatic.cc
+++ b/lib/wccp/WccpStatic.cc
@@ -20,25 +20,26 @@
     limitations under the License.
  */
 
-# include "WccpLocal.h"
-# include "WccpMeta.h"
-# include "ink_error.h"
-# include "ink_defs.h"
+#include "WccpLocal.h"
+#include "WccpMeta.h"
+#include "ink_error.h"
+#include "ink_defs.h"
 
 /* Solaris considers SIOCGIFCONF obsolete and only defines it if
  * BSD compatibility activated. */
-# if defined(solaris)
-# define BSD_COMP
-# endif
-# include <sys/ioctl.h>
-# include <sys/socket.h>
-# include <net/if.h>
-# include <stdarg.h>
-# include <string.h>
-# include <errno.h>
-# include <stdio.h>
-
-namespace wccp {
+#if defined(solaris)
+#define BSD_COMP
+#endif
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+namespace wccp
+{
 // ------------------------------------------------------
 // Compile time checks for internal consistency.
 
@@ -47,18 +48,19 @@ struct CompileTimeChecks {
   static unsigned int const UINT8_SIZE = sizeof(uint8_t);
   // A compiler error for the following line means that the size of
   // an assignment bucket is incorrect. It must be exactly 1 byte.
-  ts::TEST_IF_TRUE< BUCKET_SIZE == UINT8_SIZE > m_check_bucket_size;
+  ts::TEST_IF_TRUE<BUCKET_SIZE == UINT8_SIZE> m_check_bucket_size;
 };
 
-ts::Errata::Code LVL_TMP = 1; ///< Temporary message.
+ts::Errata::Code LVL_TMP = 1;   ///< Temporary message.
 ts::Errata::Code LVL_FATAL = 3; ///< Fatal, cannot continue.
-ts::Errata::Code LVL_WARN = 2; ///< Significant, should be fixed.
-ts::Errata::Code LVL_INFO = 1; /// Interesting, not necessarily a problem.
+ts::Errata::Code LVL_WARN = 2;  ///< Significant, should be fixed.
+ts::Errata::Code LVL_INFO = 1;  /// Interesting, not necessarily a problem.
 ts::Errata::Code LVL_DEBUG = 0; /// Debugging information.
 
 // Find a valid local IP address given an open socket.
 uint32_t
-Get_Local_Address(int s) {
+Get_Local_Address(int s)
+{
   // If we can't find a good address in the first 255, just give up
   // and make the user specify an address.
   static int const N_REQ = 255;
@@ -70,52 +72,53 @@ Get_Local_Address(int s) {
   conf.ifc_req = req;
   if (0 == ioctl(s, SIOCGIFCONF, &conf)) {
     int idx = 0;
-    ifreq* ptr = req;
-    ifreq* limit = req + (conf.ifc_len / sizeof(*req));
-    for ( ; idx < N_REQ && ptr < limit ; ++idx, ++ptr ) {
-      zret = reinterpret_cast<sockaddr_in&>(ptr->ifr_addr).sin_addr.s_addr;
-      if ((zret & 0xFF) != 0x7F) return zret;
+    ifreq *ptr = req;
+    ifreq *limit = req + (conf.ifc_len / sizeof(*req));
+    for (; idx < N_REQ && ptr < limit; ++idx, ++ptr) {
+      zret = reinterpret_cast<sockaddr_in &>(ptr->ifr_addr).sin_addr.s_addr;
+      if ((zret & 0xFF) != 0x7F)
+        return zret;
     }
   }
   return INADDR_ANY; // fail
 }
 
 // Cheap, can't even be used twice in the same argument list.
-char const* ip_addr_to_str(uint32_t addr) {
+char const *
+ip_addr_to_str(uint32_t addr)
+{
   static char buff[4 * 3 + 3 + 1];
-  unsigned char* octet = reinterpret_cast<unsigned char*>(&addr);
+  unsigned char *octet = reinterpret_cast<unsigned char *>(&addr);
   sprintf(buff, "%d.%d.%d.%d", octet[0], octet[1], octet[2], octet[3]);
   return buff;
 }
 
 // ------------------------------------------------------
-ts::Errata&
-log(ts::Errata& err, ts::Errata::Id id, ts::Errata::Code code, char const* text) {
+ts::Errata &
+log(ts::Errata &err, ts::Errata::Id id, ts::Errata::Code code, char const *text)
+{
   err.push(id, code, text);
   return err;
 }
 
-ts::Errata&
-log(ts::Errata& err, ts::Errata::Code code, char const* text) {
+ts::Errata &
+log(ts::Errata &err, ts::Errata::Code code, char const *text)
+{
   err.push(0, code, text);
   return err;
 }
 
 ts::Errata
-log(ts::Errata::Code code, char const* text) {
+log(ts::Errata::Code code, char const *text)
+{
   ts::Errata err;
   err.push(0, code, text);
   return err;
 }
 
-ts::Errata&
-vlogf(
-  ts::Errata& err,
-  ts::Errata::Id id,
-  ts::Errata::Code code,
-  char const* format,
-  va_list& rest
-) {
+ts::Errata &
+vlogf(ts::Errata &err, ts::Errata::Id id, ts::Errata::Code code, char const *format, va_list &rest)
+{
   static size_t const SIZE = 8192;
   char buffer[SIZE];
 
@@ -124,36 +127,34 @@ vlogf(
   return err;
 }
 
-ts::Errata&
-logf(
-  ts::Errata& err,
-  ts::Errata::Id id,
-  ts::Errata::Code code,
-  char const* format,
-  ...
-) {
+ts::Errata &
+logf(ts::Errata &err, ts::Errata::Id id, ts::Errata::Code code, char const *format, ...)
+{
   va_list rest;
   va_start(rest, format);
   return vlogf(err, id, code, format, rest);
 }
 
 ts::Errata
-logf(ts::Errata::Code code, char const* format, ...) {
+logf(ts::Errata::Code code, char const *format, ...)
+{
   ts::Errata err;
   va_list rest;
   va_start(rest, format);
   return vlogf(err, ts::Errata::Id(0), code, format, rest);
 }
 
-ts::Errata&
-logf(ts::Errata& err, ts::Errata::Code code, char const* format, ...) {
+ts::Errata &
+logf(ts::Errata &err, ts::Errata::Code code, char const *format, ...)
+{
   va_list rest;
   va_start(rest, format);
   return vlogf(err, ts::Errata::Id(0), code, format, rest);
 }
 
 ts::Errata
-log_errno(ts::Errata::Code code, char const* text) {
+log_errno(ts::Errata::Code code, char const *text)
+{
   static size_t const SIZE = 1024;
   char buffer[SIZE];
   ATS_UNUSED_RETURN(strerror_r(errno, buffer, SIZE));
@@ -161,7 +162,8 @@ log_errno(ts::Errata::Code code, char const* text) {
 }
 
 ts::Errata
-vlogf_errno(ts::Errata::Code code, char const* format, va_list& rest) {
+vlogf_errno(ts::Errata::Code code, char const *format, va_list &rest)
+{
   int e = errno; // Preserve value before making system calls.
   ts::Errata err;
   int n;
@@ -180,7 +182,8 @@ vlogf_errno(ts::Errata::Code code, char const* format, va_list& rest) {
 }
 
 ts::Errata
-logf_errno(ts::Errata::Code code, char const* format, ...) {
+logf_errno(ts::Errata::Code code, char const *format, ...)
+{
   va_list rest;
   va_start(rest, format);
   return vlogf_errno(code, format, rest);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpUtil.h
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpUtil.h b/lib/wccp/WccpUtil.h
index 25bae9b..9e3d22c 100644
--- a/lib/wccp/WccpUtil.h
+++ b/lib/wccp/WccpUtil.h
@@ -20,22 +20,22 @@
     limitations under the License.
  */
 
-# if !defined(ATS_WCCP_UTIL_HEADER)
-# define ATS_WCCP_UTIL_HEADER
+#if !defined(ATS_WCCP_UTIL_HEADER)
+#define ATS_WCCP_UTIL_HEADER
 
-# include <vector>
-
-namespace wccp {
+#include <vector>
 
+namespace wccp
+{
 /// @name Message severity levels.
 //@{
 extern ts::Errata::Code LVL_FATAL; ///< Fatal, cannot continue.
-extern ts::Errata::Code LVL_WARN; ///< Significant, function degraded.
-extern ts::Errata::Code LVL_INFO; ///< Interesting, not necessarily a problem.
+extern ts::Errata::Code LVL_WARN;  ///< Significant, function degraded.
+extern ts::Errata::Code LVL_INFO;  ///< Interesting, not necessarily a problem.
 extern ts::Errata::Code LVL_DEBUG; ///< Debugging information.
-extern ts::Errata::Code LVL_TMP; ///< For temporary debugging only.
-// Handy so that temporary debugging messages can be located by grep.
-//@}
+extern ts::Errata::Code LVL_TMP;   ///< For temporary debugging only.
+                                   // Handy so that temporary debugging messages can be located by grep.
+                                   //@}
 
 /** Logging / reporting support.
     We build on top of @c Errata but we want to be able to prevent
@@ -48,72 +48,62 @@ extern ts::Errata::Code LVL_TMP; ///< For temporary debugging only.
 //@{
 /// Report literal string to an Errata.
 /// @return @a err.
-ts::Errata& log(
-  ts::Errata& err,///< Target errata.
-  ts::Errata::Id id, ///< Message ID.
-  ts::Errata::Code code, ///< Severity level.
-  char const* text ///< Message text.
-);
+ts::Errata &log(ts::Errata &err,       ///< Target errata.
+                ts::Errata::Id id,     ///< Message ID.
+                ts::Errata::Code code, ///< Severity level.
+                char const *text       ///< Message text.
+                );
 /// Report literal string to an Errata.
 /// Use message ID 0.
 /// @return @a err.
-ts::Errata& log(
-  ts::Errata& err,///< Target errata.
-  ts::Errata::Code code, ///< Severity level.
-  char const* text ///< Message text.
-);
+ts::Errata &log(ts::Errata &err,       ///< Target errata.
+                ts::Errata::Code code, ///< Severity level.
+                char const *text       ///< Message text.
+                );
 /// printf style log to Errata.
 /// @return @a err.
-ts::Errata& logf(
-  ts::Errata& err,///< Target errata.
-  ts::Errata::Id id, ///< Message ID.
-  ts::Errata::Code code, ///< Severity level.
-  char const* format, ///< Format string.
-  ... ///< Format string parameters.
-);
+ts::Errata &logf(ts::Errata &err,       ///< Target errata.
+                 ts::Errata::Id id,     ///< Message ID.
+                 ts::Errata::Code code, ///< Severity level.
+                 char const *format,    ///< Format string.
+                 ...                    ///< Format string parameters.
+                 );
 /// printf style log to Errata.
 /// The message id is set to zero.
 /// @return @a err.
-ts::Errata& logf(
-  ts::Errata& err,///< Target errata.
-  ts::Errata::Code code, ///< Severity level.
-  char const* format, ///< Format string.
-  ... ///< Format string parameters.
-);
+ts::Errata &logf(ts::Errata &err,       ///< Target errata.
+                 ts::Errata::Code code, ///< Severity level.
+                 char const *format,    ///< Format string.
+                 ...                    ///< Format string parameters.
+                 );
 /// Return an Errata populated with a literal string.
 /// Use message ID 0.
 /// @return @a err.
-ts::Errata log(
-  ts::Errata::Code code, ///< Severity level.
-  char const* text ///< Message text.
-);
+ts::Errata log(ts::Errata::Code code, ///< Severity level.
+               char const *text       ///< Message text.
+               );
 /// Return an Errata populated with a printf styleformatted string.
 /// Use message ID 0.
 /// @return @a err.
-ts::Errata logf(
-  ts::Errata::Code code, ///< Severity level.
-  char const* format, ///< Message text.
-  ...
-);
+ts::Errata logf(ts::Errata::Code code, ///< Severity level.
+                char const *format,    ///< Message text.
+                ...);
 /** Return an Errata based on @c errno.
     The literal string is combined with the system text for the current
     value of @c errno. This is modeled on @c perror. Message ID 0 is used.
     @return @a err.
  */
-ts::Errata log_errno(
-  ts::Errata::Code code, ///< Severity level.
-  char const* text ///< Message text.
-);
+ts::Errata log_errno(ts::Errata::Code code, ///< Severity level.
+                     char const *text       ///< Message text.
+                     );
 /** Return an @c Errata based on @c errno.
     @c errno and the corresponding system error string are appended to
     the results from the @a format and following arguments.
  */
-ts::Errata
-logf_errno(
-  ts::Errata::Code code,  ///< Severity code.
-  char const* format, ///< Format string.
-  ... ///< Arguments for @a format.
-);
+ts::Errata logf_errno(ts::Errata::Code code, ///< Severity code.
+                      char const *format,    ///< Format string.
+                      ...                    ///< Arguments for @a format.
+                      );
 //@}
 
 // ------------------------------------------------------
@@ -130,61 +120,77 @@ logf_errno(
     See access_field for completely unmediated access.
 */
 
-template < typename R>
-uint8_t get_field(uint8_t R::*M, char* buffer) {
-  return reinterpret_cast<R*>(buffer)->*M;
+template <typename R>
+uint8_t
+get_field(uint8_t R::*M, char *buffer)
+{
+  return reinterpret_cast<R *>(buffer)->*M;
 }
 
-template < typename R>
-uint16_t get_field(uint16_t R::*M, char* buffer) {
-  return ntohs(reinterpret_cast<R*>(buffer)->*M);
+template <typename R>
+uint16_t
+get_field(uint16_t R::*M, char *buffer)
+{
+  return ntohs(reinterpret_cast<R *>(buffer)->*M);
 }
 
-template < typename R>
-uint32_t get_field(uint32_t R::*M, char* buffer) {
-  return ntohl(reinterpret_cast<R*>(buffer)->*M);
+template <typename R>
+uint32_t
+get_field(uint32_t R::*M, char *buffer)
+{
+  return ntohl(reinterpret_cast<R *>(buffer)->*M);
 }
 
-template < typename R>
-void set_field(uint16_t R::*M, char* buffer, uint16_t value) {
-  reinterpret_cast<R*>(buffer)->*M = htons(value);
+template <typename R>
+void
+set_field(uint16_t R::*M, char *buffer, uint16_t value)
+{
+  reinterpret_cast<R *>(buffer)->*M = htons(value);
 }
 
-template < typename R>
-void set_field(uint32_t R::*M, char* buffer, uint32_t value) {
-  reinterpret_cast<R*>(buffer)->*M = htonl(value);
+template <typename R>
+void
+set_field(uint32_t R::*M, char *buffer, uint32_t value)
+{
+  reinterpret_cast<R *>(buffer)->*M = htonl(value);
 }
 
 // IP address fields are kept locally in network order so
 // we need variants without re-ordering.
 // Also required for member structures.
-template < typename R, typename T >
-T& access_field(T R::*M, void* buffer) {
-  return reinterpret_cast<R*>(buffer)->*M;
+template <typename R, typename T>
+T &
+access_field(T R::*M, void *buffer)
+{
+  return reinterpret_cast<R *>(buffer)->*M;
 }
 
 // Access an array @a T starting at @a buffer.
-template < typename T>
-T* access_array(void* buffer) {
-  return reinterpret_cast<T*>(buffer);
+template <typename T>
+T *
+access_array(void *buffer)
+{
+  return reinterpret_cast<T *>(buffer);
 }
 // Access an array of @a T starting at @a buffer.
-template < typename T >
-T const* access_array(void const* buffer) {
-  return reinterpret_cast<T const*>(buffer);
+template <typename T>
+T const *
+access_array(void const *buffer)
+{
+  return reinterpret_cast<T const *>(buffer);
 }
 
 /// Find an element in a vector by the value of a member.
 /// @return An iterator for the element, or equal to @c end if not found.
-template <
-  typename T, ///< Vector element type.
-  typename V ///< Member type.
-> typename std::vector<T>::iterator
-find_by_member(
-  std::vector<T>& container, ///< Vector with elements.
-  V T::*member, ///< Pointer to member to compare.
-  V const& value ///< Value to match.
-) {
+template <typename T, ///< Vector element type.
+          typename V  ///< Member type.
+          >
+typename std::vector<T>::iterator
+find_by_member(std::vector<T> &container, ///< Vector with elements.
+               V T::*member,              ///< Pointer to member to compare.
+               V const &value             ///< Value to match.
+               )
+{
   typename std::vector<T>::iterator spot = container.begin();
   typename std::vector<T>::iterator limit = container.end();
   while (spot != limit && (*spot).*member != value)
@@ -193,16 +199,14 @@ find_by_member(
 }
 // ------------------------------------------------------
 /// Find a non-loop back IP address from an open socket.
-uint32_t Get_Local_Address(
-  int s ///< Open socket.
-);
+uint32_t Get_Local_Address(int s ///< Open socket.
+                           );
 // ------------------------------------------------------
 /// Cheap and dirty conversion to string for debugging.
 /// @note Uses a static buffer so won't work across threads or
 /// twice in the same argument list.
-char const* ip_addr_to_str(
-  uint32_t addr ///< Address to convert.
-);
+char const *ip_addr_to_str(uint32_t addr ///< Address to convert.
+                           );
 
 /** Used for printing IP address.
     @code
@@ -210,14 +214,12 @@ char const* ip_addr_to_str(
     printf("IP address = " ATS_IP_PRINTF_CODE,ATS_IP_OCTETS(addr));
     @endcode
  */
-# define ATS_IP_PRINTF_CODE "%d.%d.%d.%d"
-# define ATS_IP_OCTETS(x) \
-  reinterpret_cast<unsigned char const*>(&(x))[0],   \
-    reinterpret_cast<unsigned char const*>(&(x))[1], \
-    reinterpret_cast<unsigned char const*>(&(x))[2], \
-    reinterpret_cast<unsigned char const*>(&(x))[3]
+#define ATS_IP_PRINTF_CODE "%d.%d.%d.%d"
+#define ATS_IP_OCTETS(x)                                                                              \
+  reinterpret_cast<unsigned char const *>(&(x))[0], reinterpret_cast<unsigned char const *>(&(x))[1], \
+    reinterpret_cast<unsigned char const *>(&(x))[2], reinterpret_cast<unsigned char const *>(&(x))[3]
 // ------------------------------------------------------
 
 } // namespace Wccp
 
-# endif // define ATS_WCCP_UTIL_HEADER
+#endif // define ATS_WCCP_UTIL_HEADER


Mime
View raw message