You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2015/01/30 02:55:25 UTC

trafficserver git commit: TS-3349: Add DscpSet API's

Repository: trafficserver
Updated Branches:
  refs/heads/master 5b29777eb -> d37199709


TS-3349: Add DscpSet API's


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d3719970
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d3719970
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d3719970

Branch: refs/heads/master
Commit: d3719970905887d7781dce7d883ae11cbf3fcccc
Parents: 5b29777
Author: Phil Sorber <so...@apache.org>
Authored: Thu Jan 29 15:28:18 2015 -0700
Committer: Phil Sorber <so...@apache.org>
Committed: Thu Jan 29 18:51:43 2015 -0700

----------------------------------------------------------------------
 CHANGES                                         |  2 +
 .../api/TSHttpTxnClientPacketDscpSet.en.rst     | 45 +++++++++++++++++++
 .../api/TSHttpTxnServerPacketDscpSet.en.rst     | 47 ++++++++++++++++++++
 plugins/header_rewrite/operators.cc             |  2 +-
 proxy/InkAPI.cc                                 | 42 +++++++++++++++++
 proxy/api/ts/ts.h                               | 18 ++++++++
 6 files changed, 155 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3719970/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index e5cf274..c45c471 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
+  *) [TS-3349] Add DscpSet API's.
+
   *) [TS-3343] outbound transparent can end up with Connection: keep-alive headers on failures
 
   *) [TS-3344] 401 responses invalidate cache entry even if TSHttpTxnServerRespIgnore() used

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3719970/doc/reference/api/TSHttpTxnClientPacketDscpSet.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/api/TSHttpTxnClientPacketDscpSet.en.rst b/doc/reference/api/TSHttpTxnClientPacketDscpSet.en.rst
new file mode 100644
index 0000000..eb3368c
--- /dev/null
+++ b/doc/reference/api/TSHttpTxnClientPacketDscpSet.en.rst
@@ -0,0 +1,45 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you under the Apache License, Version
+   2.0 (the "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied.  See the License for the specific language governing
+   permissions and limitations under the License.
+
+
+TSHttpTxnClientPacketDscpSet
+============================
+
+Change packet DSCP for the client side connection.
+
+
+Synopsis
+--------
+
+`#include <ts/ts.h>`
+
+.. c:function:: TSReturnCode TSHttpTxnClientPacketDscpSet(TSHttpTxn txnp, int dscp)
+
+
+Description
+-----------
+
+.. note::
+
+   The change takes effect immediately
+
+
+See Also
+--------
+
+`Traffic Shaping`_
+
+.. _Traffic Shaping:
+                 https://cwiki.apache.org/confluence/display/TS/Traffic+Shaping

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3719970/doc/reference/api/TSHttpTxnServerPacketDscpSet.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/api/TSHttpTxnServerPacketDscpSet.en.rst b/doc/reference/api/TSHttpTxnServerPacketDscpSet.en.rst
new file mode 100644
index 0000000..a3f19fe
--- /dev/null
+++ b/doc/reference/api/TSHttpTxnServerPacketDscpSet.en.rst
@@ -0,0 +1,47 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you under the Apache License, Version
+   2.0 (the "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied.  See the License for the specific language governing
+   permissions and limitations under the License.
+
+
+TSHttpTxnServerPacketDscpSet
+============================
+
+Change packet DSCP for the server side connection.
+
+
+Synopsis
+--------
+
+`#include <ts/ts.h>`
+
+.. c:function:: TSReturnCode TSHttpTxnServerPacketDscpSet(TSHttpTxn txnp, int dscp)
+
+
+Description
+-----------
+
+.. note::
+
+   The change takes effect immediately, if no OS connection has been
+   made, then this sets the mark that will be used IF an OS connection
+   is established
+
+
+See Also
+--------
+
+`Traffic Shaping`_
+
+.. _Traffic Shaping:
+                 https://cwiki.apache.org/confluence/display/TS/Traffic+Shaping

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3719970/plugins/header_rewrite/operators.cc
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/operators.cc b/plugins/header_rewrite/operators.cc
index 9b34edf..22aceee 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -570,6 +570,6 @@ void
 OperatorSetConnDSCP::exec(const Resources& res) const
 {
   if (res.txnp) {
-    TSHttpTxnClientPacketTosSet(res.txnp, _ds_value.get_int_value() << 2);
+    TSHttpTxnClientPacketDscpSet(res.txnp, _ds_value.get_int_value());
   }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3719970/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index d906a80..efd6572 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -5433,6 +5433,48 @@ TSHttpTxnServerPacketTosSet(TSHttpTxn txnp, int tos)
   return TS_SUCCESS;
 }
 
+TSReturnCode
+TSHttpTxnClientPacketDscpSet(TSHttpTxn txnp, int dscp)
+{
+  sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
+  HttpSM *sm = (HttpSM *) txnp;
+  if (NULL == sm->ua_session) {
+    return TS_ERROR;
+  }
+
+  NetVConnection *vc = sm->ua_session->get_netvc();
+  if (NULL == vc) {
+    return TS_ERROR;
+  }
+
+  vc->options.packet_tos = (uint32_t)dscp << 2;
+  vc->apply_options();
+  return TS_SUCCESS;
+}
+
+TSReturnCode
+TSHttpTxnServerPacketDscpSet(TSHttpTxn txnp, int dscp)
+{
+  sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
+  HttpSM *sm = (HttpSM *) txnp;
+
+  // change the tos on an active server session
+  if (NULL != sm->ua_session) {
+    HttpServerSession *ssn = sm->ua_session->get_server_session();
+    if (NULL != ssn) {
+      NetVConnection *vc = ssn->get_netvc();
+      if (vc != NULL) {
+        vc->options.packet_tos = (uint32_t)dscp << 2;
+        vc->apply_options();
+      }
+    }
+  }
+
+  // update the transactions mark config for future connections
+  TSHttpTxnConfigIntSet(txnp, TS_CONFIG_NET_SOCK_PACKET_TOS_OUT, dscp << 2);
+  return TS_SUCCESS;
+}
+
 // Set the body, or, if you provide a NULL buffer, clear the body message
 void
 TSHttpTxnErrorBodySet(TSHttpTxn txnp, char *buf, size_t buflength, char *mimetype)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3719970/proxy/api/ts/ts.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h b/proxy/api/ts/ts.h
index b5b0abe..8093c3a 100644
--- a/proxy/api/ts/ts.h
+++ b/proxy/api/ts/ts.h
@@ -1412,6 +1412,24 @@ extern "C"
   */
   tsapi TSReturnCode TSHttpTxnServerPacketTosSet(TSHttpTxn txnp, int tos);
 
+  /** Change packet DSCP for the client side connection
+   *
+      @note The change takes effect immediately
+
+      @return TS_SUCCESS if the client connection was modified
+  */
+  tsapi TSReturnCode TSHttpTxnClientPacketDscpSet(TSHttpTxn txnp, int dscp);
+
+  /** Change packet DSCP for the server side connection
+   *
+
+      @note The change takes effect immediately, if no OS connection has been
+      made, then this sets the mark that will be used IF an OS connection
+      is established
+
+      @return TS_SUCCESS if the (future?) server connection was modified
+  */
+  tsapi TSReturnCode TSHttpTxnServerPacketDscpSet(TSHttpTxn txnp, int dscp);
 
   /**
      Sets an error type body to a transaction. Note that both string arguments