You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/03/23 21:32:54 UTC

[21/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

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/AsyncHttpFetch.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/AsyncHttpFetch.cc b/lib/atscppapi/src/AsyncHttpFetch.cc
index af920b0..0ad46ad 100644
--- a/lib/atscppapi/src/AsyncHttpFetch.cc
+++ b/lib/atscppapi/src/AsyncHttpFetch.cc
@@ -54,16 +54,18 @@ struct atscppapi::AsyncHttpFetchState : noncopyable {
 
   AsyncHttpFetchState(const string &url_str, HttpMethod http_method, string request_body,
                       AsyncHttpFetch::StreamingFlag streaming_flag)
-    : request_body_(request_body), result_(AsyncHttpFetch::RESULT_FAILURE), body_(NULL), body_size_(0),
-      hdr_buf_(NULL), hdr_loc_(NULL), streaming_flag_(streaming_flag), fetch_sm_(NULL) {
-    request_.reset(new Request(url_str, http_method, (streaming_flag_ == AsyncHttpFetch::STREAMING_DISABLED) ?
-                               HTTP_VERSION_1_0 : HTTP_VERSION_1_1));
+    : request_body_(request_body), result_(AsyncHttpFetch::RESULT_FAILURE), body_(NULL), body_size_(0), hdr_buf_(NULL),
+      hdr_loc_(NULL), streaming_flag_(streaming_flag), fetch_sm_(NULL)
+  {
+    request_.reset(new Request(url_str, http_method,
+                               (streaming_flag_ == AsyncHttpFetch::STREAMING_DISABLED) ? HTTP_VERSION_1_0 : HTTP_VERSION_1_1));
     if (streaming_flag_ == AsyncHttpFetch::STREAMING_ENABLED) {
       body_ = body_buffer_;
     }
   }
 
-  ~AsyncHttpFetchState() {
+  ~AsyncHttpFetchState()
+  {
     if (hdr_loc_) {
       TSMLoc null_parent_loc = NULL;
       TSHandleMLocRelease(hdr_buf_, null_parent_loc, hdr_loc_);
@@ -77,12 +79,14 @@ struct atscppapi::AsyncHttpFetchState : noncopyable {
   }
 };
 
-namespace {
-
+namespace
+{
 const unsigned int LOCAL_IP_ADDRESS = 0x0100007f;
 const int LOCAL_PORT = 8080;
 
-static int handleFetchEvents(TSCont cont, TSEvent event, void *edata) {
+static int
+handleFetchEvents(TSCont cont, TSEvent event, void *edata)
+{
   LOG_DEBUG("Received fetch event = %d, edata = %p", event, edata);
   AsyncHttpFetch *fetch_provider = static_cast<AsyncHttpFetch *>(TSContDataGet(cont));
   AsyncHttpFetchState *state = utils::internal::getAsyncHttpFetchState(*fetch_provider);
@@ -105,72 +109,74 @@ static int handleFetchEvents(TSCont cont, TSEvent event, void *edata) {
           utils::internal::initResponse(state->response_, state->hdr_buf_, state->hdr_loc_);
           LOG_DEBUG("Fetch result had a status code of %d with a body length of %ld", status, state->body_size_);
         } else {
-          LOG_ERROR("Unable to parse response; Request URL [%s]; transaction %p",
-                    state->request_->getUrl().getUrlString().c_str(), txn);
+          LOG_ERROR("Unable to parse response; Request URL [%s]; transaction %p", state->request_->getUrl().getUrlString().c_str(),
+                    txn);
           event = static_cast<TSEvent>(AsyncHttpFetch::RESULT_FAILURE);
         }
         TSHttpParserDestroy(parser);
-      }
-      else {
+      } else {
         LOG_ERROR("Successful fetch did not result in any content. Assuming failure");
         event = static_cast<TSEvent>(AsyncHttpFetch::RESULT_FAILURE);
       }
       state->result_ = static_cast<AsyncHttpFetch::Result>(event);
     }
-  }
-  else {
+  } else {
     LOG_DEBUG("Handling streaming event %d", event);
     if (event == static_cast<TSEvent>(TS_FETCH_EVENT_EXT_HEAD_DONE)) {
       utils::internal::initResponse(state->response_, TSFetchRespHdrMBufGet(state->fetch_sm_),
                                     TSFetchRespHdrMLocGet(state->fetch_sm_));
       LOG_DEBUG("Response header initialized");
       state->result_ = AsyncHttpFetch::RESULT_HEADER_COMPLETE;
-    }
-    else {
+    } else {
       state->body_size_ = TSFetchReadData(state->fetch_sm_, state->body_buffer_, sizeof(state->body_buffer_));
       LOG_DEBUG("Read %zu bytes", state->body_size_);
-      state->result_ = (event == static_cast<TSEvent>(TS_FETCH_EVENT_EXT_BODY_READY)) ?
-        AsyncHttpFetch::RESULT_PARTIAL_BODY : AsyncHttpFetch::RESULT_BODY_COMPLETE;
+      state->result_ = (event == static_cast<TSEvent>(TS_FETCH_EVENT_EXT_BODY_READY)) ? AsyncHttpFetch::RESULT_PARTIAL_BODY :
+                                                                                        AsyncHttpFetch::RESULT_BODY_COMPLETE;
     }
   }
   if (!state->dispatch_controller_->dispatch()) {
     LOG_DEBUG("Unable to dispatch result from AsyncFetch because promise has died.");
   }
 
-  if ((state->streaming_flag_ == AsyncHttpFetch::STREAMING_DISABLED) ||
-      (state->result_ == AsyncHttpFetch::RESULT_BODY_COMPLETE)) {
+  if ((state->streaming_flag_ == AsyncHttpFetch::STREAMING_DISABLED) || (state->result_ == AsyncHttpFetch::RESULT_BODY_COMPLETE)) {
     LOG_DEBUG("Shutting down");
     utils::internal::deleteAsyncHttpFetch(fetch_provider); // we must always cleans up when we're done.
     TSContDestroy(cont);
   }
   return 0;
 }
-
 }
 
-AsyncHttpFetch::AsyncHttpFetch(const string &url_str, const string &request_body) {
+AsyncHttpFetch::AsyncHttpFetch(const string &url_str, const string &request_body)
+{
   init(url_str, HTTP_METHOD_POST, request_body, STREAMING_DISABLED);
 }
 
-AsyncHttpFetch::AsyncHttpFetch(const string &url_str, HttpMethod http_method) {
+AsyncHttpFetch::AsyncHttpFetch(const string &url_str, HttpMethod http_method)
+{
   init(url_str, http_method, "", STREAMING_DISABLED);
 }
 
-AsyncHttpFetch::AsyncHttpFetch(const string &url_str, StreamingFlag streaming_flag, const string &request_body) {
+AsyncHttpFetch::AsyncHttpFetch(const string &url_str, StreamingFlag streaming_flag, const string &request_body)
+{
   init(url_str, HTTP_METHOD_POST, request_body, streaming_flag);
 }
 
-AsyncHttpFetch::AsyncHttpFetch(const string &url_str, StreamingFlag streaming_flag, HttpMethod http_method) {
+AsyncHttpFetch::AsyncHttpFetch(const string &url_str, StreamingFlag streaming_flag, HttpMethod http_method)
+{
   init(url_str, http_method, "", streaming_flag);
 }
 
-void AsyncHttpFetch::init(const string &url_str, HttpMethod http_method, const string &request_body,
-                          StreamingFlag streaming_flag) {
+void
+AsyncHttpFetch::init(const string &url_str, HttpMethod http_method, const string &request_body, StreamingFlag streaming_flag)
+{
   LOG_DEBUG("Created new AsyncHttpFetch object %p", this);
   state_ = new AsyncHttpFetchState(url_str, http_method, request_body, streaming_flag);
 }
 
-void AsyncHttpFetch::run() {
+void
+AsyncHttpFetch::run()
+{
   state_->dispatch_controller_ = getDispatchController(); // keep a copy in state so that cont handler can use it
 
   TSCont fetchCont = TSContCreate(handleFetchEvents, TSMutexCreate());
@@ -210,21 +216,18 @@ void AsyncHttpFetch::run() {
     request_str += state_->request_body_;
 
     LOG_DEBUG("Issing (non-streaming) TSFetchUrl with request\n[%s]", request_str.c_str());
-    TSFetchUrl(request_str.c_str(), request_str.size(), reinterpret_cast<struct sockaddr const *>(&addr), fetchCont,
-               AFTER_BODY, event_ids);
-  }
-  else {
-    state_->fetch_sm_ = TSFetchCreate(fetchCont, HTTP_METHOD_STRINGS[state_->request_->getMethod()].c_str(),
-                                      state_->request_->getUrl().getUrlString().c_str(),
-                                      HTTP_VERSION_STRINGS[state_->request_->getVersion()].c_str(),
-                                      reinterpret_cast<struct sockaddr const *>(&addr),
-                                      TS_FETCH_FLAGS_STREAM | TS_FETCH_FLAGS_DECHUNK);
+    TSFetchUrl(request_str.c_str(), request_str.size(), reinterpret_cast<struct sockaddr const *>(&addr), fetchCont, AFTER_BODY,
+               event_ids);
+  } else {
+    state_->fetch_sm_ =
+      TSFetchCreate(fetchCont, HTTP_METHOD_STRINGS[state_->request_->getMethod()].c_str(),
+                    state_->request_->getUrl().getUrlString().c_str(), HTTP_VERSION_STRINGS[state_->request_->getVersion()].c_str(),
+                    reinterpret_cast<struct sockaddr const *>(&addr), TS_FETCH_FLAGS_STREAM | TS_FETCH_FLAGS_DECHUNK);
     string header_value;
     for (Headers::iterator iter = headers.begin(), end = headers.end(); iter != end; ++iter) {
       HeaderFieldName header_name = (*iter).name();
       header_value = (*iter).values();
-      TSFetchHeaderAdd(state_->fetch_sm_, header_name.c_str(), header_name.length(), header_value.data(),
-                       header_value.size());
+      TSFetchHeaderAdd(state_->fetch_sm_, header_name.c_str(), header_name.length(), header_value.data(), header_value.size());
     }
     LOG_DEBUG("Launching streaming fetch");
     TSFetchLaunch(state_->fetch_sm_);
@@ -235,31 +238,44 @@ void AsyncHttpFetch::run() {
   }
 }
 
-Headers &AsyncHttpFetch::getRequestHeaders() {
+Headers &
+AsyncHttpFetch::getRequestHeaders()
+{
   return state_->request_->getHeaders();
 }
 
-AsyncHttpFetch::Result AsyncHttpFetch::getResult() const {
+AsyncHttpFetch::Result
+AsyncHttpFetch::getResult() const
+{
   return state_->result_;
 }
 
-const Url &AsyncHttpFetch::getRequestUrl() const {
+const Url &
+AsyncHttpFetch::getRequestUrl() const
+{
   return state_->request_->getUrl();
 }
 
-const string &AsyncHttpFetch::getRequestBody() const {
+const string &
+AsyncHttpFetch::getRequestBody() const
+{
   return state_->request_body_;
 }
 
-const Response &AsyncHttpFetch::getResponse() const {
+const Response &
+AsyncHttpFetch::getResponse() const
+{
   return state_->response_;
 }
 
-void AsyncHttpFetch::getResponseBody(const void *&body, size_t &body_size) const {
+void
+AsyncHttpFetch::getResponseBody(const void *&body, size_t &body_size) const
+{
   body = state_->body_;
   body_size = state_->body_size_;
 }
 
-AsyncHttpFetch::~AsyncHttpFetch() {
+AsyncHttpFetch::~AsyncHttpFetch()
+{
   delete state_;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/AsyncTimer.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/AsyncTimer.cc b/lib/atscppapi/src/AsyncTimer.cc
index 4604375..baf7c67 100644
--- a/lib/atscppapi/src/AsyncTimer.cc
+++ b/lib/atscppapi/src/AsyncTimer.cc
@@ -35,21 +35,24 @@ struct atscppapi::AsyncTimerState {
   AsyncTimer *timer_;
   shared_ptr<AsyncDispatchControllerBase> dispatch_controller_;
   AsyncTimerState(AsyncTimer::Type type, int period_in_ms, int initial_period_in_ms, AsyncTimer *timer)
-    : type_(type), period_in_ms_(period_in_ms), initial_period_in_ms_(initial_period_in_ms),
-      initial_timer_action_(NULL), periodic_timer_action_(NULL), timer_(timer) { }
+    : type_(type), period_in_ms_(period_in_ms), initial_period_in_ms_(initial_period_in_ms), initial_timer_action_(NULL),
+      periodic_timer_action_(NULL), timer_(timer)
+  {
+  }
 };
 
-namespace {
-
-int handleTimerEvent(TSCont cont, TSEvent event, void *edata) {
+namespace
+{
+int
+handleTimerEvent(TSCont cont, TSEvent event, void *edata)
+{
   AsyncTimerState *state = static_cast<AsyncTimerState *>(TSContDataGet(cont));
   if (state->initial_timer_action_) {
     LOG_DEBUG("Received initial timer event.");
     state->initial_timer_action_ = NULL; // mark it so that it won't be canceled later on
     if (state->type_ == AsyncTimer::TYPE_PERIODIC) {
       LOG_DEBUG("Scheduling periodic event now");
-      state->periodic_timer_action_ = TSContScheduleEvery(state->cont_, state->period_in_ms_,
-                                                          TS_THREAD_POOL_DEFAULT);
+      state->periodic_timer_action_ = TSContScheduleEvery(state->cont_, state->period_in_ms_, TS_THREAD_POOL_DEFAULT);
     }
   }
   if (!state->dispatch_controller_->dispatch()) {
@@ -58,39 +61,39 @@ int handleTimerEvent(TSCont cont, TSEvent event, void *edata) {
   }
   return 0;
 }
-
 }
 
-AsyncTimer::AsyncTimer(Type type, int period_in_ms, int initial_period_in_ms) {
+AsyncTimer::AsyncTimer(Type type, int period_in_ms, int initial_period_in_ms)
+{
   state_ = new AsyncTimerState(type, period_in_ms, initial_period_in_ms, this);
   state_->cont_ = TSContCreate(handleTimerEvent, TSMutexCreate());
   TSContDataSet(state_->cont_, static_cast<void *>(state_));
 }
 
-void AsyncTimer::run() {
+void
+AsyncTimer::run()
+{
   state_->dispatch_controller_ = getDispatchController(); // keep a copy in state so that cont handler can use it
   int one_off_timeout_in_ms = 0;
   int regular_timeout_in_ms = 0;
   if (state_->type_ == AsyncTimer::TYPE_ONE_OFF) {
     one_off_timeout_in_ms = state_->period_in_ms_;
-  }
-  else {
+  } else {
     one_off_timeout_in_ms = state_->initial_period_in_ms_;
     regular_timeout_in_ms = state_->period_in_ms_;
   }
   if (one_off_timeout_in_ms) {
     LOG_DEBUG("Scheduling initial/one-off event");
-    state_->initial_timer_action_ = TSContSchedule(state_->cont_, one_off_timeout_in_ms,
-                                                   TS_THREAD_POOL_DEFAULT);
-  }
-  else if (regular_timeout_in_ms) {
+    state_->initial_timer_action_ = TSContSchedule(state_->cont_, one_off_timeout_in_ms, TS_THREAD_POOL_DEFAULT);
+  } else if (regular_timeout_in_ms) {
     LOG_DEBUG("Scheduling regular timer events");
-    state_->periodic_timer_action_ = TSContScheduleEvery(state_->cont_, regular_timeout_in_ms,
-                                                         TS_THREAD_POOL_DEFAULT);
+    state_->periodic_timer_action_ = TSContScheduleEvery(state_->cont_, regular_timeout_in_ms, TS_THREAD_POOL_DEFAULT);
   }
 }
 
-void AsyncTimer::cancel() {
+void
+AsyncTimer::cancel()
+{
   if (!state_->cont_) {
     LOG_DEBUG("Already canceled");
     return;
@@ -109,7 +112,8 @@ void AsyncTimer::cancel() {
   state_->cont_ = NULL;
 }
 
-AsyncTimer::~AsyncTimer() {
+AsyncTimer::~AsyncTimer()
+{
   cancel();
   delete state_;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/CaseInsensitiveStringComparator.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/CaseInsensitiveStringComparator.cc b/lib/atscppapi/src/CaseInsensitiveStringComparator.cc
index e30ce96..34c7eac 100644
--- a/lib/atscppapi/src/CaseInsensitiveStringComparator.cc
+++ b/lib/atscppapi/src/CaseInsensitiveStringComparator.cc
@@ -22,19 +22,23 @@
 
 #include "atscppapi/CaseInsensitiveStringComparator.h"
 
-namespace {
-  static char NORMALIZED_CHARACTERS[256];
-  static volatile bool normalizer_initialized(false);
+namespace
+{
+static char NORMALIZED_CHARACTERS[256];
+static volatile bool normalizer_initialized(false);
 }
 
 using atscppapi::CaseInsensitiveStringComparator;
 using std::string;
 
-bool CaseInsensitiveStringComparator::operator()(const string &lhs, const string &rhs) const {
+bool CaseInsensitiveStringComparator::operator()(const string &lhs, const string &rhs) const
+{
   return (compare(lhs, rhs) < 0);
 }
 
-int CaseInsensitiveStringComparator::compare(const string &lhs, const string &rhs) const {
+int
+CaseInsensitiveStringComparator::compare(const string &lhs, const string &rhs) const
+{
   if (!normalizer_initialized) {
     // this initialization is safe to execute in concurrent threads - hence no locking
     for (int i = 0; i < 256; ++i) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/ClientRequest.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/ClientRequest.cc b/lib/atscppapi/src/ClientRequest.cc
index 32d7306..8df7964 100644
--- a/lib/atscppapi/src/ClientRequest.cc
+++ b/lib/atscppapi/src/ClientRequest.cc
@@ -31,31 +31,34 @@ using namespace atscppapi;
 /**
  * @private
  */
-struct atscppapi::ClientRequestState: noncopyable {
+struct atscppapi::ClientRequestState : noncopyable {
   TSHttpTxn txn_;
   TSMBuffer pristine_hdr_buf_;
   TSMLoc pristine_url_loc_;
   Url pristine_url_;
-  ClientRequestState(TSHttpTxn txn) : txn_(txn), pristine_hdr_buf_(NULL), pristine_url_loc_(NULL) { }
+  ClientRequestState(TSHttpTxn txn) : txn_(txn), pristine_hdr_buf_(NULL), pristine_url_loc_(NULL) {}
 };
 
-atscppapi::ClientRequest::ClientRequest(void *ats_txn_handle, void *hdr_buf, void *hdr_loc) :
-    Request(hdr_buf, hdr_loc) {
+atscppapi::ClientRequest::ClientRequest(void *ats_txn_handle, void *hdr_buf, void *hdr_loc) : Request(hdr_buf, hdr_loc)
+{
   state_ = new ClientRequestState(static_cast<TSHttpTxn>(ats_txn_handle));
 }
 
-atscppapi::ClientRequest::~ClientRequest() {
+atscppapi::ClientRequest::~ClientRequest()
+{
   if (state_->pristine_url_loc_ && state_->pristine_hdr_buf_) {
     TSMLoc null_parent_loc = NULL;
-    LOG_DEBUG("Releasing pristine url loc for transaction %p; hdr_buf %p, url_loc %p", state_->txn_,
-              state_->pristine_hdr_buf_, state_->pristine_url_loc_);
+    LOG_DEBUG("Releasing pristine url loc for transaction %p; hdr_buf %p, url_loc %p", state_->txn_, state_->pristine_hdr_buf_,
+              state_->pristine_url_loc_);
     TSHandleMLocRelease(state_->pristine_hdr_buf_, null_parent_loc, state_->pristine_url_loc_);
   }
 
   delete state_;
 }
 
-const Url &atscppapi::ClientRequest::getPristineUrl() const {
+const Url &
+atscppapi::ClientRequest::getPristineUrl() const
+{
   if (!state_->pristine_url_loc_) {
     TSHttpTxnPristineUrlGet(state_->txn_, &state_->pristine_hdr_buf_, &state_->pristine_url_loc_);
 
@@ -63,8 +66,8 @@ const Url &atscppapi::ClientRequest::getPristineUrl() const {
       state_->pristine_url_.init(state_->pristine_hdr_buf_, state_->pristine_url_loc_);
       LOG_DEBUG("Pristine URL initialized");
     } else {
-      LOG_ERROR("Failed to get pristine URL for transaction %p; hdr_buf %p, url_loc %p", state_->txn_,
-                state_->pristine_hdr_buf_, state_->pristine_url_loc_);
+      LOG_ERROR("Failed to get pristine URL for transaction %p; hdr_buf %p, url_loc %p", state_->txn_, state_->pristine_hdr_buf_,
+                state_->pristine_url_loc_);
     }
   } else {
     LOG_DEBUG("Pristine URL already initialized");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/GlobalPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/GlobalPlugin.cc b/lib/atscppapi/src/GlobalPlugin.cc
index b2d8581..467e4e8 100644
--- a/lib/atscppapi/src/GlobalPlugin.cc
+++ b/lib/atscppapi/src/GlobalPlugin.cc
@@ -38,17 +38,20 @@ struct atscppapi::GlobalPluginState : noncopyable {
   bool ignore_internal_transactions_;
 
   GlobalPluginState(GlobalPlugin *global_plugin, bool ignore_internal_transactions)
-    : global_plugin_(global_plugin), ignore_internal_transactions_(ignore_internal_transactions) { }
+    : global_plugin_(global_plugin), ignore_internal_transactions_(ignore_internal_transactions)
+  {
+  }
 };
 
-namespace {
-
-static int handleGlobalPluginEvents(TSCont cont, TSEvent event, void *edata) {
+namespace
+{
+static int
+handleGlobalPluginEvents(TSCont cont, TSEvent event, void *edata)
+{
   TSHttpTxn txn = static_cast<TSHttpTxn>(edata);
   GlobalPluginState *state = static_cast<GlobalPluginState *>(TSContDataGet(cont));
   if (state->ignore_internal_transactions_ && (TSHttpIsInternalRequest(txn) == TS_SUCCESS)) {
-    LOG_DEBUG("Ignoring event %d on internal transaction %p for global plugin %p", event, txn,
-              state->global_plugin_);
+    LOG_DEBUG("Ignoring event %d on internal transaction %p for global plugin %p", event, txn, state->global_plugin_);
     TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
   } else {
     LOG_DEBUG("Invoking global plugin %p for event %d on transaction %p", state->global_plugin_, event, txn);
@@ -59,7 +62,8 @@ static int handleGlobalPluginEvents(TSCont cont, TSEvent event, void *edata) {
 
 } /* anonymous namespace */
 
-GlobalPlugin::GlobalPlugin(bool ignore_internal_transactions) {
+GlobalPlugin::GlobalPlugin(bool ignore_internal_transactions)
+{
   utils::internal::initTransactionManagement();
   state_ = new GlobalPluginState(this, ignore_internal_transactions);
   TSMutex mutex = NULL;
@@ -67,12 +71,15 @@ GlobalPlugin::GlobalPlugin(bool ignore_internal_transactions) {
   TSContDataSet(state_->cont_, static_cast<void *>(state_));
 }
 
-GlobalPlugin::~GlobalPlugin() {
+GlobalPlugin::~GlobalPlugin()
+{
   TSContDestroy(state_->cont_);
   delete state_;
 }
 
-void GlobalPlugin::registerHook(Plugin::HookType hook_type) {
+void
+GlobalPlugin::registerHook(Plugin::HookType hook_type)
+{
   TSHttpHookID hook_id = utils::internal::convertInternalHookToTsHook(hook_type);
   TSHttpHookAdd(hook_id, state_->cont_);
   LOG_DEBUG("Registered global plugin %p for hook %s", this, HOOK_TYPE_STRINGS[hook_type].c_str());

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/GzipDeflateTransformation.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/GzipDeflateTransformation.cc b/lib/atscppapi/src/GzipDeflateTransformation.cc
index 5ee9f66..d375856 100644
--- a/lib/atscppapi/src/GzipDeflateTransformation.cc
+++ b/lib/atscppapi/src/GzipDeflateTransformation.cc
@@ -32,7 +32,8 @@ using namespace atscppapi::transformations;
 using std::string;
 using std::vector;
 
-namespace {
+namespace
+{
 const int GZIP_MEM_LEVEL = 8;
 const int WINDOW_BITS = 31; // Always use 31 for gzip.
 const unsigned int ONE_KB = 1024;
@@ -41,18 +42,17 @@ const unsigned int ONE_KB = 1024;
 /**
  * @private
  */
-struct atscppapi::transformations::GzipDeflateTransformationState: noncopyable {
+struct atscppapi::transformations::GzipDeflateTransformationState : noncopyable {
   z_stream z_stream_;
   bool z_stream_initialized_;
   TransformationPlugin::Type transformation_type_;
   int64_t bytes_produced_;
 
-  GzipDeflateTransformationState(TransformationPlugin::Type type) :
-        z_stream_initialized_(false), transformation_type_(type), bytes_produced_(0) {
-
+  GzipDeflateTransformationState(TransformationPlugin::Type type)
+    : z_stream_initialized_(false), transformation_type_(type), bytes_produced_(0)
+  {
     memset(&z_stream_, 0, sizeof(z_stream_));
-    int err =
-        deflateInit2(&z_stream_, Z_DEFAULT_COMPRESSION, Z_DEFLATED, WINDOW_BITS , GZIP_MEM_LEVEL, Z_DEFAULT_STRATEGY);
+    int err = deflateInit2(&z_stream_, Z_DEFAULT_COMPRESSION, Z_DEFLATED, WINDOW_BITS, GZIP_MEM_LEVEL, Z_DEFAULT_STRATEGY);
 
     if (Z_OK != err) {
       LOG_ERROR("deflateInit2 failed with error code '%d'.", err);
@@ -61,7 +61,8 @@ struct atscppapi::transformations::GzipDeflateTransformationState: noncopyable {
     }
   };
 
-  ~GzipDeflateTransformationState() {
+  ~GzipDeflateTransformationState()
+  {
     if (z_stream_initialized_) {
       deflateEnd(&z_stream_);
     }
@@ -69,15 +70,20 @@ struct atscppapi::transformations::GzipDeflateTransformationState: noncopyable {
 };
 
 
-GzipDeflateTransformation::GzipDeflateTransformation(Transaction &transaction, TransformationPlugin::Type type) : TransformationPlugin(transaction, type) {
+GzipDeflateTransformation::GzipDeflateTransformation(Transaction &transaction, TransformationPlugin::Type type)
+  : TransformationPlugin(transaction, type)
+{
   state_ = new GzipDeflateTransformationState(type);
 }
 
-GzipDeflateTransformation::~GzipDeflateTransformation() {
+GzipDeflateTransformation::~GzipDeflateTransformation()
+{
   delete state_;
 }
 
-void GzipDeflateTransformation::consume(const string &data) {
+void
+GzipDeflateTransformation::consume(const string &data)
+{
   if (data.size() == 0) {
     return;
   }
@@ -112,7 +118,8 @@ void GzipDeflateTransformation::consume(const string &data) {
     int bytes_to_write = buffer_size - state_->z_stream_.avail_out;
     state_->bytes_produced_ += bytes_to_write;
 
-    LOG_DEBUG("Iteration %d: Deflate compressed %ld bytes to %d bytes, producing output...", iteration, data.size(), bytes_to_write);
+    LOG_DEBUG("Iteration %d: Deflate compressed %ld bytes to %d bytes, producing output...", iteration, data.size(),
+              bytes_to_write);
     produce(string(reinterpret_cast<char *>(&buffer[0]), static_cast<size_t>(bytes_to_write)));
   } while (state_->z_stream_.avail_out == 0);
 
@@ -123,7 +130,9 @@ void GzipDeflateTransformation::consume(const string &data) {
   }
 }
 
-void GzipDeflateTransformation::handleInputComplete() {
+void
+GzipDeflateTransformation::handleInputComplete()
+{
   // We will flush out anything that's remaining in the gzip buffer
   int status = Z_OK;
   int iteration = 0;
@@ -143,7 +152,8 @@ void GzipDeflateTransformation::handleInputComplete() {
     state_->bytes_produced_ += bytes_to_write;
 
     if (status == Z_OK || status == Z_STREAM_END) {
-      LOG_DEBUG("Iteration %d: Gzip deflate finalize had an extra %d bytes to process, status '%d'. Producing output...", iteration, bytes_to_write, status);
+      LOG_DEBUG("Iteration %d: Gzip deflate finalize had an extra %d bytes to process, status '%d'. Producing output...", iteration,
+                bytes_to_write, status);
       produce(string(reinterpret_cast<char *>(buffer), static_cast<size_t>(bytes_to_write)));
     } else if (status != Z_STREAM_END) {
       LOG_ERROR("Iteration %d: Gzip deflinate finalize produced an error '%d'", iteration, status);
@@ -152,6 +162,7 @@ void GzipDeflateTransformation::handleInputComplete() {
 
   int64_t bytes_written = setOutputComplete();
   if (state_->bytes_produced_ != bytes_written) {
-    LOG_ERROR("Gzip bytes produced sanity check failed, deflated bytes = %" PRId64 " != written bytes = %" PRId64, state_->bytes_produced_, bytes_written);
+    LOG_ERROR("Gzip bytes produced sanity check failed, deflated bytes = %" PRId64 " != written bytes = %" PRId64,
+              state_->bytes_produced_, bytes_written);
   }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/GzipInflateTransformation.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/GzipInflateTransformation.cc b/lib/atscppapi/src/GzipInflateTransformation.cc
index 936a472..a6424a7 100644
--- a/lib/atscppapi/src/GzipInflateTransformation.cc
+++ b/lib/atscppapi/src/GzipInflateTransformation.cc
@@ -33,7 +33,8 @@ using namespace atscppapi::transformations;
 using std::string;
 using std::vector;
 
-namespace {
+namespace
+{
 const int WINDOW_BITS = 31; // Always use 31 for gzip.
 unsigned int INFLATE_SCALE_FACTOR = 6;
 }
@@ -41,15 +42,15 @@ unsigned int INFLATE_SCALE_FACTOR = 6;
 /**
  * @private
  */
-struct atscppapi::transformations::GzipInflateTransformationState: noncopyable {
+struct atscppapi::transformations::GzipInflateTransformationState : noncopyable {
   z_stream z_stream_;
   bool z_stream_initialized_;
   int64_t bytes_produced_;
   TransformationPlugin::Type transformation_type_;
 
-  GzipInflateTransformationState(TransformationPlugin::Type type) :
-        z_stream_initialized_(false), bytes_produced_(0), transformation_type_(type) {
-
+  GzipInflateTransformationState(TransformationPlugin::Type type)
+    : z_stream_initialized_(false), bytes_produced_(0), transformation_type_(type)
+  {
     memset(&z_stream_, 0, sizeof(z_stream_));
 
     int err = inflateInit2(&z_stream_, WINDOW_BITS);
@@ -60,7 +61,8 @@ struct atscppapi::transformations::GzipInflateTransformationState: noncopyable {
     }
   };
 
-  ~GzipInflateTransformationState() {
+  ~GzipInflateTransformationState()
+  {
     if (z_stream_initialized_) {
       int err = inflateEnd(&z_stream_);
       if (Z_OK != err && Z_STREAM_END != err) {
@@ -71,15 +73,20 @@ struct atscppapi::transformations::GzipInflateTransformationState: noncopyable {
 };
 
 
-GzipInflateTransformation::GzipInflateTransformation(Transaction &transaction, TransformationPlugin::Type type) : TransformationPlugin(transaction, type) {
+GzipInflateTransformation::GzipInflateTransformation(Transaction &transaction, TransformationPlugin::Type type)
+  : TransformationPlugin(transaction, type)
+{
   state_ = new GzipInflateTransformationState(type);
 }
 
-GzipInflateTransformation::~GzipInflateTransformation() {
+GzipInflateTransformation::~GzipInflateTransformation()
+{
   delete state_;
 }
 
-void GzipInflateTransformation::consume(const string &data) {
+void
+GzipInflateTransformation::consume(const string &data)
+{
   if (data.size() == 0) {
     return;
   }
@@ -110,24 +117,25 @@ void GzipInflateTransformation::consume(const string &data) {
     err = inflate(&state_->z_stream_, Z_SYNC_FLUSH);
 
     if (err != Z_OK && err != Z_STREAM_END) {
-     LOG_ERROR("Iteration %d: Inflate failed with error '%d'", iteration, err);
-     state_->z_stream_.next_out = NULL;
-     return;
+      LOG_ERROR("Iteration %d: Inflate failed with error '%d'", iteration, err);
+      state_->z_stream_.next_out = NULL;
+      return;
     }
 
-    LOG_DEBUG("Iteration %d: Gzip inflated a total of %d bytes, producingOutput...", iteration, (inflate_block_size - state_->z_stream_.avail_out));
+    LOG_DEBUG("Iteration %d: Gzip inflated a total of %d bytes, producingOutput...", iteration,
+              (inflate_block_size - state_->z_stream_.avail_out));
     produce(string(&buffer[0], (inflate_block_size - state_->z_stream_.avail_out)));
     state_->bytes_produced_ += (inflate_block_size - state_->z_stream_.avail_out);
   }
   state_->z_stream_.next_out = NULL;
 }
 
-void GzipInflateTransformation::handleInputComplete() {
+void
+GzipInflateTransformation::handleInputComplete()
+{
   int64_t bytes_written = setOutputComplete();
   if (state_->bytes_produced_ != bytes_written) {
-    LOG_ERROR("Gzip bytes produced sanity check failed, inflated bytes = %" PRId64 " != written bytes = %" PRId64, state_->bytes_produced_, bytes_written);
+    LOG_ERROR("Gzip bytes produced sanity check failed, inflated bytes = %" PRId64 " != written bytes = %" PRId64,
+              state_->bytes_produced_, bytes_written);
   }
 }
-
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Headers.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Headers.cc b/lib/atscppapi/src/Headers.cc
index 5693c52..ee7fba3 100644
--- a/lib/atscppapi/src/Headers.cc
+++ b/lib/atscppapi/src/Headers.cc
@@ -37,58 +37,73 @@ using atscppapi::header_field_value_iterator;
 
 using std::string;
 
-namespace atscppapi {
-
-HeaderFieldName::HeaderFieldName(const std::string &name) {
+namespace atscppapi
+{
+HeaderFieldName::HeaderFieldName(const std::string &name)
+{
   name_ = name;
 }
 
-HeaderFieldName::operator std::string() {
+HeaderFieldName::operator std::string()
+{
   return name_;
 }
 
-HeaderFieldName::operator const char*() {
+HeaderFieldName::operator const char *()
+{
   return name_.c_str();
 }
 
-std::string HeaderFieldName::str() {
+std::string
+HeaderFieldName::str()
+{
   return name_;
 }
 
-HeaderFieldName::size_type HeaderFieldName::length() {
+HeaderFieldName::size_type
+HeaderFieldName::length()
+{
   return name_.length();
 }
 
-const char *HeaderFieldName::c_str() {
+const char *
+HeaderFieldName::c_str()
+{
   return name_.c_str();
 }
 
-bool HeaderFieldName::operator==(const char *field_name) {
+bool HeaderFieldName::operator==(const char *field_name)
+{
   return (::strcasecmp(c_str(), field_name) == 0);
 }
 
-bool HeaderFieldName::operator==(const std::string &field_name) {
+bool HeaderFieldName::operator==(const std::string &field_name)
+{
   return operator==(field_name.c_str());
 }
 
-bool HeaderFieldName::operator!=(const char *field_name) {
+bool HeaderFieldName::operator!=(const char *field_name)
+{
   return !operator==(field_name);
 }
 
-bool HeaderFieldName::operator!=(const std::string &field_name) {
+bool HeaderFieldName::operator!=(const std::string &field_name)
+{
   return !operator==(field_name.c_str());
 }
 
 /**
  * @private
  */
-struct HeaderFieldValueIteratorState: noncopyable {
+struct HeaderFieldValueIteratorState : noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   TSMLoc field_loc_;
   int index_;
-  HeaderFieldValueIteratorState() : hdr_buf_(NULL), hdr_loc_(NULL), field_loc_(NULL), index_(0) { }
-  void reset(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc, int index) {
+  HeaderFieldValueIteratorState() : hdr_buf_(NULL), hdr_loc_(NULL), field_loc_(NULL), index_(0) {}
+  void
+  reset(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc, int index)
+  {
     hdr_buf_ = bufp;
     hdr_loc_ = hdr_loc;
     field_loc_ = field_loc;
@@ -96,51 +111,56 @@ struct HeaderFieldValueIteratorState: noncopyable {
   }
 };
 
-header_field_value_iterator::header_field_value_iterator(void *bufp, void *hdr_loc, void *field_loc, int index) {
+header_field_value_iterator::header_field_value_iterator(void *bufp, void *hdr_loc, void *field_loc, int index)
+{
   state_ = new HeaderFieldValueIteratorState();
-  state_->reset(static_cast<TSMBuffer>(bufp),
-      static_cast<TSMLoc>(hdr_loc),
-      static_cast<TSMLoc>(field_loc),
-      index);
+  state_->reset(static_cast<TSMBuffer>(bufp), static_cast<TSMLoc>(hdr_loc), static_cast<TSMLoc>(field_loc), index);
 }
 
-header_field_value_iterator::header_field_value_iterator(const header_field_value_iterator& it) {
+header_field_value_iterator::header_field_value_iterator(const header_field_value_iterator &it)
+{
   state_ = new HeaderFieldValueIteratorState();
   state_->reset(it.state_->hdr_buf_, it.state_->hdr_loc_, it.state_->field_loc_, it.state_->index_);
 }
 
-header_field_value_iterator::~header_field_value_iterator() {
+header_field_value_iterator::~header_field_value_iterator()
+{
   delete state_;
 }
 
-std::string header_field_value_iterator::operator*() {
+std::string header_field_value_iterator::operator*()
+{
   if (state_->index_ >= 0) {
     int length = 0;
     const char *str = TSMimeHdrFieldValueStringGet(state_->hdr_buf_, state_->hdr_loc_, state_->field_loc_, state_->index_, &length);
     if (length && str) {
-     return std::string(str, length);
+      return std::string(str, length);
     }
   }
   return std::string();
 }
 
-header_field_value_iterator& header_field_value_iterator::operator++() {
+header_field_value_iterator &header_field_value_iterator::operator++()
+{
   ++state_->index_;
   return *this;
 }
 
-header_field_value_iterator header_field_value_iterator::operator++(int) {
- header_field_value_iterator tmp(*this);
- operator++();
- return tmp;
+header_field_value_iterator header_field_value_iterator::operator++(int)
+{
+  header_field_value_iterator tmp(*this);
+  operator++();
+  return tmp;
 }
 
-bool header_field_value_iterator::operator==(const header_field_value_iterator& rhs) const {
+bool header_field_value_iterator::operator==(const header_field_value_iterator &rhs) const
+{
   return (state_->hdr_buf_ == rhs.state_->hdr_buf_) && (state_->hdr_loc_ == rhs.state_->hdr_loc_) &&
-                 (state_->field_loc_ == rhs.state_->field_loc_) && (state_->index_ == rhs.state_->index_);
+         (state_->field_loc_ == rhs.state_->field_loc_) && (state_->index_ == rhs.state_->index_);
 }
 
-bool header_field_value_iterator::operator!=(const header_field_value_iterator& rhs) const {
+bool header_field_value_iterator::operator!=(const header_field_value_iterator &rhs) const
+{
   return !operator==(rhs);
 }
 
@@ -151,9 +171,9 @@ struct MLocContainer {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   TSMLoc field_loc_;
-  MLocContainer(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc) :
-    hdr_buf_(bufp), hdr_loc_(hdr_loc), field_loc_(field_loc) { }
-  ~MLocContainer() {
+  MLocContainer(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc) : hdr_buf_(bufp), hdr_loc_(hdr_loc), field_loc_(field_loc) {}
+  ~MLocContainer()
+  {
     if (field_loc_ != TS_NULL_MLOC) {
       TSHandleMLocRelease(hdr_buf_, hdr_loc_, field_loc_);
     }
@@ -166,36 +186,53 @@ struct MLocContainer {
 struct HeaderFieldIteratorState {
   shared_ptr<MLocContainer> mloc_container_;
   HeaderFieldIteratorState(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc)
-    : mloc_container_(new MLocContainer(bufp, hdr_loc, field_loc)) { }
+    : mloc_container_(new MLocContainer(bufp, hdr_loc, field_loc))
+  {
+  }
 };
 
-HeaderField::~HeaderField() {
+HeaderField::~HeaderField()
+{
 }
 
-HeaderField::size_type HeaderField::size() const {
-  return TSMimeHdrFieldValuesCount(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_);
+HeaderField::size_type
+HeaderField::size() const
+{
+  return TSMimeHdrFieldValuesCount(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                   iter_.state_->mloc_container_->field_loc_);
 }
 
-header_field_value_iterator HeaderField::begin() {
-  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, 0);
+header_field_value_iterator
+HeaderField::begin()
+{
+  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                     iter_.state_->mloc_container_->field_loc_, 0);
 }
 
-header_field_value_iterator HeaderField::end() {
-  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, size());
+header_field_value_iterator
+HeaderField::end()
+{
+  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                     iter_.state_->mloc_container_->field_loc_, size());
 }
 
-HeaderFieldName HeaderField::name() const {
+HeaderFieldName
+HeaderField::name() const
+{
   int length = 0;
-  const char *str = TSMimeHdrFieldNameGet(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, &length);
+  const char *str = TSMimeHdrFieldNameGet(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                          iter_.state_->mloc_container_->field_loc_, &length);
   if (str && length) {
     return std::string(str, length);
   }
   return std::string();
 }
 
-std::string HeaderField::values(const char *join) {
+std::string
+HeaderField::values(const char *join)
+{
   std::string ret;
-  for(header_field_value_iterator it = begin(); it != end(); ++it) {
+  for (header_field_value_iterator it = begin(); it != end(); ++it) {
     if (ret.size()) {
       ret.append(join);
     }
@@ -204,15 +241,21 @@ std::string HeaderField::values(const char *join) {
   return ret;
 }
 
-std::string HeaderField::values(const std::string &join) {
+std::string
+HeaderField::values(const std::string &join)
+{
   return values(join.c_str());
 }
 
-std::string HeaderField::values(const char join) {
-  return values(std::string().append(1,join));
+std::string
+HeaderField::values(const char join)
+{
+  return values(std::string().append(1, join));
 }
 
-std::string Headers::value(const std::string key, size_type index /* = 0 */) {
+std::string
+Headers::value(const std::string key, size_type index /* = 0 */)
+{
   header_field_iterator iter = find(key);
   if (iter == end()) {
     return string();
@@ -229,74 +272,101 @@ std::string Headers::value(const std::string key, size_type index /* = 0 */) {
   return string();
 }
 
-bool HeaderField::empty() {
+bool
+HeaderField::empty()
+{
   return (begin() == end());
 }
 
-bool HeaderField::clear() {
-  return (TSMimeHdrFieldValuesClear(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_) == TS_SUCCESS);
+bool
+HeaderField::clear()
+{
+  return (TSMimeHdrFieldValuesClear(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                    iter_.state_->mloc_container_->field_loc_) == TS_SUCCESS);
 }
 
-bool HeaderField::erase(header_field_value_iterator it) {
-  return (TSMimeHdrFieldValueDelete(it.state_->hdr_buf_, it.state_->hdr_loc_, it.state_->field_loc_, it.state_->index_) == TS_SUCCESS);
+bool
+HeaderField::erase(header_field_value_iterator it)
+{
+  return (TSMimeHdrFieldValueDelete(it.state_->hdr_buf_, it.state_->hdr_loc_, it.state_->field_loc_, it.state_->index_) ==
+          TS_SUCCESS);
 }
 
-bool HeaderField::append(const std::string &value) {
+bool
+HeaderField::append(const std::string &value)
+{
   return append(value.c_str(), value.length());
 }
 
-bool HeaderField::append(const char *value, int length) {
-  return (TSMimeHdrFieldValueStringInsert(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, -1, value, -1) == TS_SUCCESS);
+bool
+HeaderField::append(const char *value, int length)
+{
+  return (TSMimeHdrFieldValueStringInsert(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                          iter_.state_->mloc_container_->field_loc_, -1, value, -1) == TS_SUCCESS);
 }
 
-bool HeaderField::setName(const std::string &str) {
-  return (TSMimeHdrFieldNameSet(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, str.c_str(), str.length()) == TS_SUCCESS);
+bool
+HeaderField::setName(const std::string &str)
+{
+  return (TSMimeHdrFieldNameSet(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                iter_.state_->mloc_container_->field_loc_, str.c_str(), str.length()) == TS_SUCCESS);
 }
 
-bool HeaderField::operator==(const char *field_name) const {
+bool HeaderField::operator==(const char *field_name) const
+{
   return (::strcasecmp(name(), field_name) == 0);
 }
 
-bool HeaderField::operator==(const std::string &field_name) const {
+bool HeaderField::operator==(const std::string &field_name) const
+{
   return operator==(field_name.c_str());
 }
 
-bool HeaderField::operator!=(const char *field_name) const {
+bool HeaderField::operator!=(const char *field_name) const
+{
   return !operator==(field_name);
 }
 
-bool HeaderField::operator!=(const std::string &field_name) const {
+bool HeaderField::operator!=(const std::string &field_name) const
+{
   return !operator==(field_name.c_str());
 }
 
-bool HeaderField::operator=(const std::string &field_value) {
-  if(!clear())
+bool HeaderField::operator=(const std::string &field_value)
+{
+  if (!clear())
     return false;
 
   return append(field_value);
 }
 
-bool HeaderField::operator=(const char *field_value) {
-  if(!clear())
+bool HeaderField::operator=(const char *field_value)
+{
+  if (!clear())
     return false;
 
   return append(field_value);
 }
 
-std::string HeaderField::operator[](const int index) {
-  return *header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, index);
+std::string HeaderField::operator[](const int index)
+{
+  return *header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                      iter_.state_->mloc_container_->field_loc_, index);
 }
 
-std::string HeaderField::str() {
+std::string
+HeaderField::str()
+{
   std::ostringstream oss;
   oss << (*this);
   return oss.str();
 }
 
-std::ostream& operator<<(std::ostream& os, HeaderField& obj) {
+std::ostream &operator<<(std::ostream &os, HeaderField &obj)
+{
   os << obj.name() << ": ";
   int count = obj.size();
-  for(HeaderField::iterator it = obj.begin(); it != obj.end(); ++it) {
+  for (HeaderField::iterator it = obj.begin(); it != obj.end(); ++it) {
     os << (*it);
     if (--count > 0)
       os << ",";
@@ -304,14 +374,18 @@ std::ostream& operator<<(std::ostream& os, HeaderField& obj) {
   return os;
 }
 
-header_field_iterator::header_field_iterator(void *hdr_buf, void *hdr_loc, void *field_loc) :
-  state_(new HeaderFieldIteratorState(static_cast<TSMBuffer>(hdr_buf), static_cast<TSMLoc>(hdr_loc),
-                                      static_cast<TSMLoc>(field_loc))) { }
+header_field_iterator::header_field_iterator(void *hdr_buf, void *hdr_loc, void *field_loc)
+  : state_(
+      new HeaderFieldIteratorState(static_cast<TSMBuffer>(hdr_buf), static_cast<TSMLoc>(hdr_loc), static_cast<TSMLoc>(field_loc)))
+{
+}
 
-header_field_iterator::header_field_iterator(const header_field_iterator& it) :
-  state_(new HeaderFieldIteratorState(*it.state_)) { }
+header_field_iterator::header_field_iterator(const header_field_iterator &it) : state_(new HeaderFieldIteratorState(*it.state_))
+{
+}
 
-header_field_iterator &header_field_iterator::operator=(const header_field_iterator &rhs) {
+header_field_iterator &header_field_iterator::operator=(const header_field_iterator &rhs)
+{
   if (this != &rhs) {
     delete state_;
     state_ = new HeaderFieldIteratorState(*rhs.state_);
@@ -319,13 +393,15 @@ header_field_iterator &header_field_iterator::operator=(const header_field_itera
   return *this;
 }
 
-header_field_iterator::~header_field_iterator() {
+header_field_iterator::~header_field_iterator()
+{
   delete state_;
 }
 
 // utility function to use to advance iterators using different functions
-HeaderFieldIteratorState *advanceIterator(HeaderFieldIteratorState *state,
-                                          TSMLoc (*getNextField)(TSMBuffer, TSMLoc, TSMLoc)) {
+HeaderFieldIteratorState *
+advanceIterator(HeaderFieldIteratorState *state, TSMLoc (*getNextField)(TSMBuffer, TSMLoc, TSMLoc))
+{
   if (state->mloc_container_->field_loc_ != TS_NULL_MLOC) {
     TSMBuffer hdr_buf = state->mloc_container_->hdr_buf_;
     TSMLoc hdr_loc = state->mloc_container_->hdr_loc_;
@@ -336,48 +412,59 @@ HeaderFieldIteratorState *advanceIterator(HeaderFieldIteratorState *state,
   return state;
 }
 
-header_field_iterator& header_field_iterator::operator++() {
+header_field_iterator &header_field_iterator::operator++()
+{
   state_ = advanceIterator(state_, TSMimeHdrFieldNext);
   return *this;
 }
 
-header_field_iterator header_field_iterator::operator++(int) {
+header_field_iterator header_field_iterator::operator++(int)
+{
   header_field_iterator tmp(*this);
   operator++();
   return tmp;
 }
 
-header_field_iterator& header_field_iterator::nextDup() {
+header_field_iterator &
+header_field_iterator::nextDup()
+{
   state_ = advanceIterator(state_, TSMimeHdrFieldNextDup);
   return *this;
 }
 
-bool header_field_iterator::operator==(const header_field_iterator& rhs) const {
-  return (state_->mloc_container_->hdr_buf_ == rhs.state_->mloc_container_->hdr_buf_) && (state_->mloc_container_->hdr_loc_ == rhs.state_->mloc_container_->hdr_loc_) &&
-      (state_->mloc_container_->field_loc_ == rhs.state_->mloc_container_->field_loc_);
+bool header_field_iterator::operator==(const header_field_iterator &rhs) const
+{
+  return (state_->mloc_container_->hdr_buf_ == rhs.state_->mloc_container_->hdr_buf_) &&
+         (state_->mloc_container_->hdr_loc_ == rhs.state_->mloc_container_->hdr_loc_) &&
+         (state_->mloc_container_->field_loc_ == rhs.state_->mloc_container_->field_loc_);
 }
 
-bool header_field_iterator::operator!=(const header_field_iterator& rhs) const {
+bool header_field_iterator::operator!=(const header_field_iterator &rhs) const
+{
   return !operator==(rhs);
 }
 
-HeaderField header_field_iterator::operator*() {
+HeaderField header_field_iterator::operator*()
+{
   return HeaderField(*this);
 }
 
 /**
  * @private
  */
-struct HeadersState: noncopyable {
+struct HeadersState : noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   bool self_created_structures_;
-  HeadersState() {
+  HeadersState()
+  {
     hdr_buf_ = TSMBufferCreate();
     hdr_loc_ = TSHttpHdrCreate(hdr_buf_);
     self_created_structures_ = true;
   }
-  void reset(TSMBuffer bufp, TSMLoc hdr_loc) {
+  void
+  reset(TSMBuffer bufp, TSMLoc hdr_loc)
+  {
     if (self_created_structures_) {
       TSHandleMLocRelease(hdr_buf_, TS_NULL_MLOC /* no parent */, hdr_loc_);
       TSMBufferDestroy(hdr_buf_);
@@ -386,65 +473,89 @@ struct HeadersState: noncopyable {
     hdr_buf_ = bufp;
     hdr_loc_ = hdr_loc;
   }
-  ~HeadersState() {
-    reset(NULL, NULL);
-  }
+  ~HeadersState() { reset(NULL, NULL); }
 };
 
-Headers::Headers() {
+Headers::Headers()
+{
   state_ = new HeadersState();
 }
 
-Headers::Headers(void *bufp, void *mloc) {
+Headers::Headers(void *bufp, void *mloc)
+{
   state_ = new HeadersState();
   reset(bufp, mloc);
 }
 
-void Headers::reset(void *bufp, void *mloc) {
+void
+Headers::reset(void *bufp, void *mloc)
+{
   state_->reset(static_cast<TSMBuffer>(bufp), static_cast<TSMLoc>(mloc));
 }
 
-Headers::~Headers() {
+Headers::~Headers()
+{
   delete state_;
 }
 
-bool Headers::isInitialized() const {
+bool
+Headers::isInitialized() const
+{
   return (state_->hdr_buf_ && state_->hdr_loc_);
 }
 
-bool Headers::empty() {
+bool
+Headers::empty()
+{
   return (begin() == end());
 }
 
-Headers::size_type Headers::size() const {
+Headers::size_type
+Headers::size() const
+{
   return TSMimeHdrFieldsCount(state_->hdr_buf_, state_->hdr_loc_);
 }
 
-Headers::size_type Headers::lengthBytes() const {
+Headers::size_type
+Headers::lengthBytes() const
+{
   return TSMimeHdrLengthGet(state_->hdr_buf_, state_->hdr_loc_);
 }
 
-header_field_iterator Headers::begin() {
+header_field_iterator
+Headers::begin()
+{
   return header_field_iterator(state_->hdr_buf_, state_->hdr_loc_, TSMimeHdrFieldGet(state_->hdr_buf_, state_->hdr_loc_, 0));
 }
 
-header_field_iterator Headers::end() {
+header_field_iterator
+Headers::end()
+{
   return header_field_iterator(state_->hdr_buf_, state_->hdr_loc_, TS_NULL_MLOC);
 }
 
-bool Headers::clear() {
+bool
+Headers::clear()
+{
   return (TSMimeHdrFieldsClear(state_->hdr_buf_, state_->hdr_loc_) == TS_SUCCESS);
 }
 
-bool Headers::erase(header_field_iterator it) {
-  return (TSMimeHdrFieldDestroy(it.state_->mloc_container_->hdr_buf_, it.state_->mloc_container_->hdr_loc_, it.state_->mloc_container_->field_loc_) == TS_SUCCESS);
+bool
+Headers::erase(header_field_iterator it)
+{
+  return (TSMimeHdrFieldDestroy(it.state_->mloc_container_->hdr_buf_, it.state_->mloc_container_->hdr_loc_,
+                                it.state_->mloc_container_->field_loc_) == TS_SUCCESS);
 }
 
-Headers::size_type Headers::erase(const std::string &key) {
+Headers::size_type
+Headers::erase(const std::string &key)
+{
   return erase(key.c_str(), key.length());
 }
 
-Headers::size_type Headers::erase(const char *key, int length) {
+Headers::size_type
+Headers::erase(const char *key, int length)
+{
   header_field_iterator iter = find(key, length);
   size_type erased_count = 0;
   while (iter != end()) {
@@ -456,9 +567,11 @@ Headers::size_type Headers::erase(const char *key, int length) {
   return erased_count;
 }
 
-Headers::size_type Headers::count(const char *key, int length) {
+Headers::size_type
+Headers::count(const char *key, int length)
+{
   size_type ret_count = 0;
-  for(header_field_iterator it = begin(); it != end(); ++it) {
+  for (header_field_iterator it = begin(); it != end(); ++it) {
     if ((*it).name() == key) {
       ret_count++;
     }
@@ -466,11 +579,15 @@ Headers::size_type Headers::count(const char *key, int length) {
   return ret_count;
 }
 
-Headers::size_type Headers::count(const std::string &key) {
+Headers::size_type
+Headers::count(const std::string &key)
+{
   return count(key.c_str(), key.length());
 }
 
-std::string Headers::values(const std::string &key, const char *join) {
+std::string
+Headers::values(const std::string &key, const char *join)
+{
   std::string ret;
   for (header_field_iterator it = find(key); it != end(); it.nextDup()) {
     if (ret.size()) {
@@ -482,19 +599,27 @@ std::string Headers::values(const std::string &key, const char *join) {
   return ret;
 }
 
-std::string Headers::values(const std::string &key, const std::string &join) {
+std::string
+Headers::values(const std::string &key, const std::string &join)
+{
   return values(key, join.c_str());
 }
 
-std::string Headers::values(const std::string &key, const char join) {
+std::string
+Headers::values(const std::string &key, const char join)
+{
   return values(key, std::string().assign(1, join));
 }
 
-header_field_iterator Headers::find(const std::string &key) {
+header_field_iterator
+Headers::find(const std::string &key)
+{
   return find(key.c_str(), key.length());
 }
 
-header_field_iterator Headers::find(const char *key, int length) {
+header_field_iterator
+Headers::find(const char *key, int length)
+{
   TSMLoc field_loc = TSMimeHdrFieldFind(state_->hdr_buf_, state_->hdr_loc_, key, length);
   if (field_loc != TS_NULL_MLOC)
     return header_field_iterator(state_->hdr_buf_, state_->hdr_loc_, field_loc);
@@ -502,7 +627,9 @@ header_field_iterator Headers::find(const char *key, int length) {
   return end();
 }
 
-Headers::iterator Headers::append(const std::string &key, const std::string &value) {
+Headers::iterator
+Headers::append(const std::string &key, const std::string &value)
+{
   TSMLoc field_loc = TS_NULL_MLOC;
 
   if (TSMimeHdrFieldCreate(state_->hdr_buf_, state_->hdr_loc_, &field_loc) == TS_SUCCESS) {
@@ -514,12 +641,15 @@ Headers::iterator Headers::append(const std::string &key, const std::string &val
     return end();
 }
 
-Headers::iterator Headers::set(const std::string &key, const std::string &value) {
+Headers::iterator
+Headers::set(const std::string &key, const std::string &value)
+{
   erase(key);
   return append(key, value);
 }
 
-HeaderField Headers::operator[](const std::string &key) {
+HeaderField Headers::operator[](const std::string &key)
+{
   // In STL fashion if the key doesn't exist it will be added with an empty value.
   header_field_iterator it = find(key);
   if (it != end()) {
@@ -529,13 +659,17 @@ HeaderField Headers::operator[](const std::string &key) {
   }
 }
 
-std::string Headers::str() {
+std::string
+Headers::str()
+{
   std::ostringstream oss;
   oss << (*this);
   return oss.str();
 }
 
-std::string Headers::wireStr() {
+std::string
+Headers::wireStr()
+{
   string retval;
   for (iterator iter = begin(), last = end(); iter != last; ++iter) {
     HeaderField hf = *iter;
@@ -547,8 +681,9 @@ std::string Headers::wireStr() {
   return retval;
 }
 
-std::ostream& operator<<(std::ostream &os, atscppapi::Headers &obj) {
-  for(header_field_iterator it = obj.begin(); it != obj.end(); ++it) {
+std::ostream &operator<<(std::ostream &os, atscppapi::Headers &obj)
+{
+  for (header_field_iterator it = obj.begin(); it != obj.end(); ++it) {
     HeaderField hf = *it;
     os << hf << std::endl;
   }
@@ -556,4 +691,3 @@ std::ostream& operator<<(std::ostream &os, atscppapi::Headers &obj) {
 }
 
 } /* atscppapi namespace */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/HttpMethod.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/HttpMethod.cc b/lib/atscppapi/src/HttpMethod.cc
index 0ce5c5f..8bde500 100644
--- a/lib/atscppapi/src/HttpMethod.cc
+++ b/lib/atscppapi/src/HttpMethod.cc
@@ -22,16 +22,7 @@
 
 #include "atscppapi/HttpMethod.h"
 
-const std::string atscppapi::HTTP_METHOD_STRINGS[] = { std::string("UNKNOWN"),
-                                                       std::string("GET"),
-                                                       std::string("POST"),
-                                                       std::string("HEAD"),
-                                                       std::string("CONNECT"),
-                                                       std::string("DELETE"),
-                                                       std::string("ICP_QUERY"),
-                                                       std::string("OPTIONS"),
-                                                       std::string("PURGE"),
-                                                       std::string("PUT"),
-                                                       std::string("TRACE"),
-                                                       std::string("PUSH") };
-
+const std::string atscppapi::HTTP_METHOD_STRINGS[] = {std::string("UNKNOWN"),   std::string("GET"),     std::string("POST"),
+                                                      std::string("HEAD"),      std::string("CONNECT"), std::string("DELETE"),
+                                                      std::string("ICP_QUERY"), std::string("OPTIONS"), std::string("PURGE"),
+                                                      std::string("PUT"),       std::string("TRACE"),   std::string("PUSH")};

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/HttpVersion.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/HttpVersion.cc b/lib/atscppapi/src/HttpVersion.cc
index 7a1e3d5..5834693 100644
--- a/lib/atscppapi/src/HttpVersion.cc
+++ b/lib/atscppapi/src/HttpVersion.cc
@@ -22,8 +22,5 @@
 
 #include "atscppapi/HttpVersion.h"
 
-const std::string atscppapi::HTTP_VERSION_STRINGS[] = { std::string("UNKNOWN"),
-                                                        std::string("HTTP/0.9"),
-                                                        std::string("HTTP/1.0"),
-                                                        std::string("HTTP/1.1") };
-
+const std::string atscppapi::HTTP_VERSION_STRINGS[] = {std::string("UNKNOWN"), std::string("HTTP/0.9"), std::string("HTTP/1.0"),
+                                                       std::string("HTTP/1.1")};

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/InterceptPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/InterceptPlugin.cc b/lib/atscppapi/src/InterceptPlugin.cc
index 9503949..8f494bf 100644
--- a/lib/atscppapi/src/InterceptPlugin.cc
+++ b/lib/atscppapi/src/InterceptPlugin.cc
@@ -48,8 +48,9 @@ struct InterceptPlugin::State {
     TSVIO vio_;
     TSIOBuffer buffer_;
     TSIOBufferReader reader_;
-    IoHandle() : vio_(NULL), buffer_(NULL), reader_(NULL) { };
-    ~IoHandle() {
+    IoHandle() : vio_(NULL), buffer_(NULL), reader_(NULL){};
+    ~IoHandle()
+    {
       if (reader_) {
         TSIOBufferReaderFree(reader_);
       }
@@ -84,15 +85,16 @@ struct InterceptPlugin::State {
   bool plugin_io_done_;
 
   State(TSCont cont, InterceptPlugin *plugin)
-    : cont_(cont), net_vc_(NULL), expected_body_size_(0), num_body_bytes_read_(0), hdr_parsed_(false),
-      hdr_buf_(NULL), hdr_loc_(NULL), num_bytes_written_(0), plugin_(plugin), timeout_action_(NULL),
-      plugin_io_done_(false) {
+    : cont_(cont), net_vc_(NULL), expected_body_size_(0), num_body_bytes_read_(0), hdr_parsed_(false), hdr_buf_(NULL),
+      hdr_loc_(NULL), num_bytes_written_(0), plugin_(plugin), timeout_action_(NULL), plugin_io_done_(false)
+  {
     plugin_mutex_ = plugin->getMutex();
     http_parser_ = TSHttpParserCreate();
   }
-  
-  ~State() {
-    TSHttpParserDestroy(http_parser_); 
+
+  ~State()
+  {
+    TSHttpParserDestroy(http_parser_);
     if (hdr_loc_) {
       TSHandleMLocRelease(hdr_buf_, TS_NULL_MLOC, hdr_loc_);
     }
@@ -102,39 +104,39 @@ struct InterceptPlugin::State {
   }
 };
 
-namespace {
-
+namespace
+{
 int handleEvents(TSCont cont, TSEvent event, void *edata);
 void destroyCont(InterceptPlugin::State *state);
-
 }
 
-InterceptPlugin::InterceptPlugin(Transaction &transaction, InterceptPlugin::Type type)
-  : TransactionPlugin(transaction) {
+InterceptPlugin::InterceptPlugin(Transaction &transaction, InterceptPlugin::Type type) : TransactionPlugin(transaction)
+{
   TSCont cont = TSContCreate(handleEvents, TSMutexCreate());
   state_ = new State(cont, this);
   TSContDataSet(cont, state_);
   TSHttpTxn txn = static_cast<TSHttpTxn>(transaction.getAtsHandle());
   if (type == SERVER_INTERCEPT) {
     TSHttpTxnServerIntercept(cont, txn);
-  }
-  else {
+  } else {
     TSHttpTxnIntercept(cont, txn);
   }
 }
 
-InterceptPlugin::~InterceptPlugin() {
+InterceptPlugin::~InterceptPlugin()
+{
   if (state_->cont_) {
     LOG_DEBUG("Relying on callback for cleanup");
     state_->plugin_ = NULL; // prevent callback from invoking plugin
-  }
-  else { // safe to cleanup
+  } else {                  // safe to cleanup
     LOG_DEBUG("Normal cleanup");
     delete state_;
   }
 }
 
-bool InterceptPlugin::produce(const void *data, int data_size) {
+bool
+InterceptPlugin::produce(const void *data, int data_size)
+{
   if (!state_->net_vc_) {
     LOG_ERROR("Intercept not operational");
     return false;
@@ -146,8 +148,7 @@ bool InterceptPlugin::produce(const void *data, int data_size) {
   }
   int num_bytes_written = TSIOBufferWrite(state_->output_.buffer_, data, data_size);
   if (num_bytes_written != data_size) {
-    LOG_ERROR("Error while writing to buffer! Attempted %d bytes but only wrote %d bytes", data_size,
-              num_bytes_written);
+    LOG_ERROR("Error while writing to buffer! Attempted %d bytes but only wrote %d bytes", data_size, num_bytes_written);
     return false;
   }
   TSVIOReenable(state_->output_.vio_);
@@ -156,7 +157,9 @@ bool InterceptPlugin::produce(const void *data, int data_size) {
   return true;
 }
 
-bool InterceptPlugin::setOutputComplete() {
+bool
+InterceptPlugin::setOutputComplete()
+{
   ScopedSharedMutexLock scopedLock(getMutex());
   if (!state_->net_vc_) {
     LOG_ERROR("Intercept not operational");
@@ -173,17 +176,21 @@ bool InterceptPlugin::setOutputComplete() {
   return true;
 }
 
-Headers &InterceptPlugin::getRequestHeaders() {
+Headers &
+InterceptPlugin::getRequestHeaders()
+{
   return state_->request_headers_;
 }
 
-bool InterceptPlugin::doRead() {
+bool
+InterceptPlugin::doRead()
+{
   int avail = TSIOBufferReaderAvail(state_->input_.reader_);
   if (avail == TS_ERROR) {
     LOG_ERROR("Error while getting number of bytes available");
     return false;
   }
-  
+
   int consumed = 0; // consumed is used to update the input buffers
   if (avail > 0) {
     int64_t num_body_bytes_in_block;
@@ -195,8 +202,7 @@ bool InterceptPlugin::doRead() {
       num_body_bytes_in_block = 0;
       if (!state_->hdr_parsed_) {
         const char *endptr = data + data_len;
-        if (TSHttpHdrParseReq(state_->http_parser_, state_->hdr_buf_, state_->hdr_loc_, &data,
-                              endptr) == TS_PARSE_DONE) {
+        if (TSHttpHdrParseReq(state_->http_parser_, state_->hdr_buf_, state_->hdr_loc_, &data, endptr) == TS_PARSE_DONE) {
           LOG_DEBUG("Parsed header");
           string content_length_str = state_->request_headers_.value("Content-Length");
           if (!content_length_str.empty()) {
@@ -206,8 +212,7 @@ bool InterceptPlugin::doRead() {
             if ((errno != ERANGE) && (end_ptr != start_ptr) && (*end_ptr == '\0')) {
               LOG_DEBUG("Got content length: %d", content_length);
               state_->expected_body_size_ = content_length;
-            }
-            else {
+            } else {
               LOG_ERROR("Invalid content length header [%s]; Assuming no content", content_length_str.c_str());
             }
           }
@@ -222,8 +227,7 @@ bool InterceptPlugin::doRead() {
           num_body_bytes_in_block = endptr - data;
         }
         consume(string(startptr, data - startptr), InterceptPlugin::REQUEST_HEADER);
-      }
-      else {
+      } else {
         num_body_bytes_in_block = data_len;
       }
       if (num_body_bytes_in_block) {
@@ -236,7 +240,7 @@ bool InterceptPlugin::doRead() {
   }
   LOG_DEBUG("Consumed %d bytes from input vio", consumed);
   TSIOBufferReaderConsume(state_->input_.reader_, consumed);
-  
+
   // Modify the input VIO to reflect how much data we've completed.
   TSVIONDoneSet(state_->input_.vio_, TSVIONDoneGet(state_->input_.vio_) + consumed);
 
@@ -247,21 +251,20 @@ bool InterceptPlugin::doRead() {
       // TODO: any further action required?
     }
     handleInputComplete();
-  }
-  else {
-    LOG_DEBUG("Reenabling input vio as %d bytes still need to be read",
-              state_->expected_body_size_ - state_->num_body_bytes_read_);
+  } else {
+    LOG_DEBUG("Reenabling input vio as %d bytes still need to be read", state_->expected_body_size_ - state_->num_body_bytes_read_);
     TSVIOReenable(state_->input_.vio_);
   }
   return true;
 }
 
-void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
+void
+InterceptPlugin::handleEvent(int abstract_event, void *edata)
+{
   TSEvent event = static_cast<TSEvent>(abstract_event);
   LOG_DEBUG("Received event %d", event);
 
   switch (event) {
-
   case TS_EVENT_NET_ACCEPT:
     LOG_DEBUG("Handling net accept");
     state_->net_vc_ = static_cast<TSVConn>(edata);
@@ -277,11 +280,11 @@ void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
     break;
 
   case TS_EVENT_VCONN_WRITE_READY: // nothing to do
-    LOG_DEBUG("Got write ready"); 
+    LOG_DEBUG("Got write ready");
     break;
 
   case TS_EVENT_VCONN_READ_READY:
-    LOG_DEBUG("Handling read ready");  
+    LOG_DEBUG("Handling read ready");
     if (doRead()) {
       break;
     }
@@ -290,12 +293,11 @@ void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
   case TS_EVENT_VCONN_READ_COMPLETE: // fall throughs intentional
   case TS_EVENT_VCONN_WRITE_COMPLETE:
   case TS_EVENT_VCONN_EOS:
-  case TS_EVENT_ERROR: // erroring out, nothing more to do
+  case TS_EVENT_ERROR:             // erroring out, nothing more to do
   case TS_EVENT_NET_ACCEPT_FAILED: // somebody canceled the transaction
     if (event == TS_EVENT_ERROR) {
       LOG_ERROR("Unknown Error!");
-    }
-    else if (event == TS_EVENT_NET_ACCEPT_FAILED) {
+    } else if (event == TS_EVENT_NET_ACCEPT_FAILED) {
       LOG_ERROR("Got net_accept_failed!");
     }
     LOG_DEBUG("Shutting down intercept");
@@ -307,10 +309,11 @@ void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
   }
 }
 
-namespace {
-
-int handleEvents(TSCont cont, TSEvent pristine_event, void *pristine_edata) {
-
+namespace
+{
+int
+handleEvents(TSCont cont, TSEvent pristine_event, void *pristine_edata)
+{
   // Separating pristine and mutable data helps debugging
   TSEvent event = pristine_event;
   void *edata = pristine_edata;
@@ -331,18 +334,15 @@ int handleEvents(TSCont cont, TSEvent pristine_event, void *pristine_edata) {
     if (state->plugin_io_done_) { // plugin is done, so can't send it saved event
       event = TS_EVENT_VCONN_EOS; // fake completion
       edata = NULL;
-    }
-    else {
+    } else {
       event = state->saved_event_;
       edata = state->saved_edata_;
     }
   }
   if (state->plugin_) {
     utils::internal::dispatchInterceptEvent(state->plugin_, event, edata);
-  }
-  else if (state->timeout_action_) { // we had scheduled a timeout on ourselves; let's wait for it
-  }
-  else { // plugin was destroyed before intercept was completed; cleaning up here
+  } else if (state->timeout_action_) { // we had scheduled a timeout on ourselves; let's wait for it
+  } else {                             // plugin was destroyed before intercept was completed; cleaning up here
     LOG_DEBUG("Cleaning up as intercept plugin is already destroyed");
     destroyCont(state);
     delete state;
@@ -350,7 +350,9 @@ int handleEvents(TSCont cont, TSEvent pristine_event, void *pristine_edata) {
   return 0;
 }
 
-void destroyCont(InterceptPlugin::State *state) {
+void
+destroyCont(InterceptPlugin::State *state)
+{
   if (state->net_vc_) {
     TSVConnShutdown(state->net_vc_, 1, 1);
     TSVConnClose(state->net_vc_);
@@ -361,5 +363,4 @@ void destroyCont(InterceptPlugin::State *state) {
     state->cont_ = NULL;
   }
 }
-
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Logger.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Logger.cc b/lib/atscppapi/src/Logger.cc
index 8302a3f..6802e5b 100644
--- a/lib/atscppapi/src/Logger.cc
+++ b/lib/atscppapi/src/Logger.cc
@@ -40,7 +40,7 @@ using atscppapi::Logger;
 /**
  * @private
  */
-struct atscppapi::LoggerState: noncopyable  {
+struct atscppapi::LoggerState : noncopyable {
   std::string filename_;
   bool add_timestamp_;
   bool rename_file_;
@@ -50,12 +50,14 @@ struct atscppapi::LoggerState: noncopyable  {
   TSTextLogObject text_log_obj_;
   bool initialized_;
 
-  LoggerState() : add_timestamp_(false), rename_file_(false), level_(Logger::LOG_LEVEL_NO_LOG), rolling_enabled_(false),
-                  rolling_interval_seconds_(-1), text_log_obj_(NULL), initialized_(false) { };
-  ~LoggerState() { };
+  LoggerState()
+    : add_timestamp_(false), rename_file_(false), level_(Logger::LOG_LEVEL_NO_LOG), rolling_enabled_(false),
+      rolling_interval_seconds_(-1), text_log_obj_(NULL), initialized_(false){};
+  ~LoggerState(){};
 };
 
-namespace {
+namespace
+{
 // Since the TSTextLog API doesn't support override the log file sizes (I will add this to TS api at some point)
 // we will use the roll size specified by default in records.config.
 const int ROLL_ON_TIME = 1; // See RollingEnabledValues in LogConfig.h
@@ -65,11 +67,13 @@ const int ROLL_ON_TIME = 1; // See RollingEnabledValues in LogConfig.h
 /*
  * These have default values specified for add_timestamp and rename_file in Logger.h
  */
-Logger::Logger() {
+Logger::Logger()
+{
   state_ = new LoggerState();
 }
 
-Logger::~Logger() {
+Logger::~Logger()
+{
   if (state_->initialized_ && state_->text_log_obj_) {
     TSTextLogObjectDestroy(state_->text_log_obj_);
   }
@@ -80,9 +84,13 @@ Logger::~Logger() {
 /*
  * These have default values specified for rolling_enabled and rolling_interval_seconds in Logger.h
  */
-bool Logger::init(const string &file, bool add_timestamp, bool rename_file, LogLevel level, bool rolling_enabled, int rolling_interval_seconds) {
+bool
+Logger::init(const string &file, bool add_timestamp, bool rename_file, LogLevel level, bool rolling_enabled,
+             int rolling_interval_seconds)
+{
   if (state_->initialized_) {
-    LOG_ERROR("Attempt to reinitialize a logger named '%s' that's already been initialized to '%s'.", file.c_str(), state_->filename_.c_str());
+    LOG_ERROR("Attempt to reinitialize a logger named '%s' that's already been initialized to '%s'.", file.c_str(),
+              state_->filename_.c_str());
     return false;
   }
   state_->filename_ = file;
@@ -116,21 +124,27 @@ bool Logger::init(const string &file, bool add_timestamp, bool rename_file, LogL
   return result == TS_SUCCESS;
 }
 
-void Logger::setLogLevel(Logger::LogLevel level) {
+void
+Logger::setLogLevel(Logger::LogLevel level)
+{
   if (state_->initialized_) {
     state_->level_ = level;
     LOG_DEBUG("Set log level to %d for log [%s]", level, state_->filename_.c_str());
   }
 }
 
-Logger::LogLevel Logger::getLogLevel() const {
+Logger::LogLevel
+Logger::getLogLevel() const
+{
   if (!state_->initialized_) {
     LOG_ERROR("Not initialized");
   }
   return state_->level_;
 }
 
-void Logger::setRollingIntervalSeconds(int seconds) {
+void
+Logger::setRollingIntervalSeconds(int seconds)
+{
   if (state_->initialized_) {
     state_->rolling_interval_seconds_ = seconds;
     TSTextLogObjectRollingIntervalSecSet(state_->text_log_obj_, seconds);
@@ -140,14 +154,18 @@ void Logger::setRollingIntervalSeconds(int seconds) {
   }
 }
 
-int Logger::getRollingIntervalSeconds() const {
+int
+Logger::getRollingIntervalSeconds() const
+{
   if (!state_->initialized_) {
     LOG_ERROR("Not initialized");
   }
   return state_->rolling_interval_seconds_;
 }
 
-void Logger::setRollingEnabled(bool enabled) {
+void
+Logger::setRollingEnabled(bool enabled)
+{
   if (state_->initialized_) {
     state_->rolling_enabled_ = enabled;
     TSTextLogObjectRollingEnabledSet(state_->text_log_obj_, enabled ? ROLL_ON_TIME : 0);
@@ -157,14 +175,18 @@ void Logger::setRollingEnabled(bool enabled) {
   }
 }
 
-bool Logger::isRollingEnabled() const {
+bool
+Logger::isRollingEnabled() const
+{
   if (!state_->initialized_) {
     LOG_ERROR("Not initialized!");
   }
   return state_->rolling_enabled_;
 }
 
-void Logger::flush() {
+void
+Logger::flush()
+{
   if (state_->initialized_) {
     TSTextLogObjectFlush(state_->text_log_obj_);
   } else {
@@ -172,43 +194,51 @@ void Logger::flush() {
   }
 }
 
-namespace {
-const int DEFAULT_BUFFER_SIZE_FOR_VARARGS = 8*1024;
+namespace
+{
+const int DEFAULT_BUFFER_SIZE_FOR_VARARGS = 8 * 1024;
 
 // We use a macro here because varargs would be a pain to forward via a helper
 // function
-#define TS_TEXT_LOG_OBJECT_WRITE(level) \
-    char buffer[DEFAULT_BUFFER_SIZE_FOR_VARARGS]; \
-    int n; \
-    va_list ap; \
-    while (true) { \
-     va_start(ap, fmt); \
-     n = vsnprintf (&buffer[0], sizeof(buffer), fmt, ap); \
-     va_end(ap); \
-     if (n > -1 && n < static_cast<int>(sizeof(buffer))) { \
-       LOG_DEBUG("logging a " level " to '%s' with length %d", state_->filename_.c_str(), n); \
-       TSTextLogObjectWrite(state_->text_log_obj_, const_cast<char*>("[" level "] %s"), buffer); \
-     } else { \
-       LOG_ERROR("Unable to log " level " message to '%s' due to size exceeding %zu bytes", state_->filename_.c_str(), sizeof(buffer)); \
-     } \
-     return; \
-    }
+#define TS_TEXT_LOG_OBJECT_WRITE(level)                                                                               \
+  char buffer[DEFAULT_BUFFER_SIZE_FOR_VARARGS];                                                                       \
+  int n;                                                                                                              \
+  va_list ap;                                                                                                         \
+  while (true) {                                                                                                      \
+    va_start(ap, fmt);                                                                                                \
+    n = vsnprintf(&buffer[0], sizeof(buffer), fmt, ap);                                                               \
+    va_end(ap);                                                                                                       \
+    if (n > -1 && n < static_cast<int>(sizeof(buffer))) {                                                             \
+      LOG_DEBUG("logging a " level " to '%s' with length %d", state_->filename_.c_str(), n);                          \
+      TSTextLogObjectWrite(state_->text_log_obj_, const_cast<char *>("[" level "] %s"), buffer);                      \
+    } else {                                                                                                          \
+      LOG_ERROR("Unable to log " level " message to '%s' due to size exceeding %zu bytes", state_->filename_.c_str(), \
+                sizeof(buffer));                                                                                      \
+    }                                                                                                                 \
+    return;                                                                                                           \
+  }
 
 } /* end anonymous namespace */
 
-void Logger::logDebug(const char *fmt, ...) {
+void
+Logger::logDebug(const char *fmt, ...)
+{
   if (state_->level_ <= LOG_LEVEL_DEBUG) {
     TS_TEXT_LOG_OBJECT_WRITE("DEBUG");
   }
 }
 
-void Logger::logInfo(const char *fmt, ...) {
+void
+Logger::logInfo(const char *fmt, ...)
+{
   if (state_->level_ <= LOG_LEVEL_INFO) {
     TS_TEXT_LOG_OBJECT_WRITE("INFO");
   }
 }
 
-void Logger::logError(const char *fmt, ...) {
+void
+Logger::logError(const char *fmt, ...)
+{
   if (state_->level_ <= LOG_LEVEL_ERROR) {
     TS_TEXT_LOG_OBJECT_WRITE("ERROR");
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Plugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Plugin.cc b/lib/atscppapi/src/Plugin.cc
index 214d278..9e319e5 100644
--- a/lib/atscppapi/src/Plugin.cc
+++ b/lib/atscppapi/src/Plugin.cc
@@ -21,15 +21,8 @@
  */
 #include "atscppapi/Plugin.h"
 
-const std::string atscppapi::HOOK_TYPE_STRINGS[] = { std::string("HOOK_READ_REQUEST_HEADERS_PRE_REMAP"),
-                                                     std::string("HOOK_READ_REQUEST_HEADERS_POST_REMAP"),
-                                                     std::string("HOOK_SEND_REQUEST_HEADERS"),
-                                                     std::string("HOOK_READ_RESPONSE_HEADERS"),
-                                                     std::string("HOOK_SEND_RESPONSE_HEADERS"),
-                                                     std::string("HOOK_OS_DNS"),
-                                                     std::string("HOOK_READ_REQUEST_HEADERS"),
-                                                     std::string("HOOK_READ_CACHE_HEADERS"),
-                                                     std::string("HOOK_CACHE_LOOKUP_COMPLETE"),
-                                                     std::string("HOOK_SELECT_ALT")
-                                                      };
-
+const std::string atscppapi::HOOK_TYPE_STRINGS[] = {
+  std::string("HOOK_READ_REQUEST_HEADERS_PRE_REMAP"), std::string("HOOK_READ_REQUEST_HEADERS_POST_REMAP"),
+  std::string("HOOK_SEND_REQUEST_HEADERS"), std::string("HOOK_READ_RESPONSE_HEADERS"), std::string("HOOK_SEND_RESPONSE_HEADERS"),
+  std::string("HOOK_OS_DNS"), std::string("HOOK_READ_REQUEST_HEADERS"), std::string("HOOK_READ_CACHE_HEADERS"),
+  std::string("HOOK_CACHE_LOOKUP_COMPLETE"), std::string("HOOK_SELECT_ALT")};

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/RemapPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/RemapPlugin.cc b/lib/atscppapi/src/RemapPlugin.cc
index 9ff07b6..f96597f 100644
--- a/lib/atscppapi/src/RemapPlugin.cc
+++ b/lib/atscppapi/src/RemapPlugin.cc
@@ -27,7 +27,9 @@
 
 using namespace atscppapi;
 
-TSRemapStatus TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo* rri) {
+TSRemapStatus
+TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
+{
   RemapPlugin *remap_plugin = static_cast<RemapPlugin *>(ih);
   Url map_from_url(rri->requestBufp, rri->mapFromUrl), map_to_url(rri->requestBufp, rri->mapToUrl);
   Transaction &transaction = utils::internal::getTransaction(rh);
@@ -51,16 +53,20 @@ TSRemapStatus TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo* rri) {
   }
 }
 
-void TSRemapDeleteInstance(void *ih) {
+void
+TSRemapDeleteInstance(void *ih)
+{
   RemapPlugin *remap_plugin = static_cast<RemapPlugin *>(ih);
   delete remap_plugin;
 }
 
-TSReturnCode TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size) {
+TSReturnCode
+TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size)
+{
   return TS_SUCCESS;
 }
 
-RemapPlugin::RemapPlugin(void **instance_handle) {
+RemapPlugin::RemapPlugin(void **instance_handle)
+{
   *instance_handle = static_cast<void *>(this);
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Request.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Request.cc b/lib/atscppapi/src/Request.cc
index 15e3235..6e1166e 100644
--- a/lib/atscppapi/src/Request.cc
+++ b/lib/atscppapi/src/Request.cc
@@ -31,7 +31,7 @@ using std::string;
 /**
  * @private
  */
-struct atscppapi::RequestState: noncopyable  {
+struct atscppapi::RequestState : noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   TSMLoc url_loc_;
@@ -41,21 +41,27 @@ struct atscppapi::RequestState: noncopyable  {
   HttpMethod method_;
   HttpVersion version_;
   bool destroy_buf_;
-  RequestState() : hdr_buf_(NULL), hdr_loc_(NULL), url_loc_(NULL), method_(HTTP_METHOD_UNKNOWN),
-                   version_(HTTP_VERSION_UNKNOWN), destroy_buf_(false) { }
+  RequestState()
+    : hdr_buf_(NULL), hdr_loc_(NULL), url_loc_(NULL), method_(HTTP_METHOD_UNKNOWN), version_(HTTP_VERSION_UNKNOWN),
+      destroy_buf_(false)
+  {
+  }
 };
 
-Request::Request() {
+Request::Request()
+{
   state_ = new RequestState();
 }
 
-Request::Request(void *hdr_buf, void *hdr_loc) {
+Request::Request(void *hdr_buf, void *hdr_loc)
+{
   state_ = new RequestState();
   init(hdr_buf, hdr_loc);
   LOG_DEBUG("Initialized request object %p with hdr_buf=%p and hdr_loc=%p", this, hdr_buf, hdr_loc);
 }
 
-Request::Request(const string &url_str, HttpMethod method, HttpVersion version) {
+Request::Request(const string &url_str, HttpMethod method, HttpVersion version)
+{
   state_ = new RequestState();
   state_->method_ = method;
   state_->version_ = version;
@@ -66,21 +72,21 @@ Request::Request(const string &url_str, HttpMethod method, HttpVersion version)
     const char *url_str_end = url_str_start + url_str.size();
     if (TSUrlParse(state_->hdr_buf_, state_->url_loc_, &url_str_start, url_str_end) != TS_PARSE_DONE) {
       LOG_ERROR("[%s] does not represent a valid url", url_str.c_str());
-    }
-    else {
+    } else {
       state_->url_.init(state_->hdr_buf_, state_->url_loc_);
     }
-  }
-  else {
+  } else {
     state_->url_loc_ = NULL;
     LOG_ERROR("Could not create URL field; hdr_buf %p", state_->hdr_buf_);
   }
 }
 
-void Request::init(void *hdr_buf, void *hdr_loc) {
+void
+Request::init(void *hdr_buf, void *hdr_loc)
+{
   if (state_->hdr_buf_ || state_->hdr_loc_) {
-    LOG_ERROR("Reinitialization; (hdr_buf, hdr_loc) current(%p, %p), attempted(%p, %p)", state_->hdr_buf_,
-              state_->hdr_loc_, hdr_buf, hdr_loc);
+    LOG_ERROR("Reinitialization; (hdr_buf, hdr_loc) current(%p, %p), attempted(%p, %p)", state_->hdr_buf_, state_->hdr_loc_,
+              hdr_buf, hdr_loc);
     return;
   }
   state_->hdr_buf_ = static_cast<TSMBuffer>(hdr_buf);
@@ -90,14 +96,15 @@ void Request::init(void *hdr_buf, void *hdr_loc) {
   TSHttpHdrUrlGet(state_->hdr_buf_, state_->hdr_loc_, &state_->url_loc_);
   if (!state_->url_loc_) {
     LOG_ERROR("TSHttpHdrUrlGet returned a null url loc, hdr_buf=%p, hdr_loc=%p", state_->hdr_buf_, state_->hdr_loc_);
-  }
-  else {
+  } else {
     state_->url_.init(state_->hdr_buf_, state_->url_loc_);
     LOG_DEBUG("Initialized url");
   }
 }
 
-HttpMethod Request::getMethod() const {
+HttpMethod
+Request::getMethod() const
+{
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     int method_len;
     const char *method_str = TSHttpHdrMethodGet(state_->hdr_buf_, state_->hdr_loc_, &method_len);
@@ -123,34 +130,42 @@ HttpMethod Request::getMethod() const {
       } else if (method_str == TS_HTTP_METHOD_TRACE) {
         state_->method_ = HTTP_METHOD_TRACE;
       }
-      LOG_DEBUG("Request method=%d [%s] on hdr_buf=%p, hdr_loc=%p",
-          state_->method_, HTTP_METHOD_STRINGS[state_->method_].c_str(), state_->hdr_buf_, state_->hdr_loc_);
+      LOG_DEBUG("Request method=%d [%s] on hdr_buf=%p, hdr_loc=%p", state_->method_, HTTP_METHOD_STRINGS[state_->method_].c_str(),
+                state_->hdr_buf_, state_->hdr_loc_);
     } else {
-      LOG_ERROR("TSHttpHdrMethodGet returned null string or it was zero length, hdr_buf=%p, hdr_loc=%p, method str=%p, method_len=%d",
-          state_->hdr_buf_, state_->hdr_loc_, method_str, method_len);
+      LOG_ERROR(
+        "TSHttpHdrMethodGet returned null string or it was zero length, hdr_buf=%p, hdr_loc=%p, method str=%p, method_len=%d",
+        state_->hdr_buf_, state_->hdr_loc_, method_str, method_len);
     }
   }
   return state_->method_;
 }
 
-Url &Request::getUrl() {
+Url &
+Request::getUrl()
+{
   return state_->url_;
 }
 
-atscppapi::HttpVersion Request::getVersion() const {
+atscppapi::HttpVersion
+Request::getVersion() const
+{
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     state_->version_ = utils::internal::getHttpVersion(state_->hdr_buf_, state_->hdr_loc_);
-    LOG_DEBUG("Request version=%d [%s] on hdr_buf=%p, hdr_loc=%p",
-        state_->version_, HTTP_VERSION_STRINGS[state_->version_].c_str(), state_->hdr_buf_, state_->hdr_loc_);
+    LOG_DEBUG("Request version=%d [%s] on hdr_buf=%p, hdr_loc=%p", state_->version_, HTTP_VERSION_STRINGS[state_->version_].c_str(),
+              state_->hdr_buf_, state_->hdr_loc_);
   }
   return state_->version_;
 }
 
-atscppapi::Headers &Request::getHeaders() const {
+atscppapi::Headers &
+Request::getHeaders() const
+{
   return state_->headers_;
 }
 
-Request::~Request() {
+Request::~Request()
+{
   if (state_->url_loc_) {
     if (state_->destroy_buf_) {
       // usually, hdr_loc is the parent of url_loc, but we created this url_loc "directly" in hdr_buf,
@@ -159,8 +174,8 @@ Request::~Request() {
       TSHandleMLocRelease(state_->hdr_buf_, null_parent_loc, state_->url_loc_);
       TSMBufferDestroy(state_->hdr_buf_);
     } else {
-      LOG_DEBUG("Destroying request object on hdr_buf=%p, hdr_loc=%p, url_loc=%p", state_->hdr_buf_,
-                state_->hdr_loc_, state_->url_loc_);
+      LOG_DEBUG("Destroying request object on hdr_buf=%p, hdr_loc=%p, url_loc=%p", state_->hdr_buf_, state_->hdr_loc_,
+                state_->url_loc_);
       TSHandleMLocRelease(state_->hdr_buf_, state_->hdr_loc_, state_->url_loc_);
     }
   }