Repository: trafficserver
Updated Branches:
  refs/heads/master ef6d97239 -> 0bbef1e04


[TS-3502]: Add TS API TSHttpTxnServerFdGet to get origin socket's fd


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

Branch: refs/heads/master
Commit: 450d45d84411b4e5b1012b55ec2c265e359801df
Parents: ef6d972
Author: Sudheer Vinukonda <[email protected]>
Authored: Thu Apr 9 19:04:43 2015 +0000
Committer: Sudheer Vinukonda <[email protected]>
Committed: Thu Apr 9 19:04:43 2015 +0000

----------------------------------------------------------------------
 doc/reference/api/TSHttpSsnClientFdGet.en.rst | 31 ++++++++++++++++++++++
 doc/reference/api/TSHttpTxnClientFdGet.en.rst | 31 ++++++++++++++++++++++
 doc/reference/api/TSHttpTxnServerFdGet.en.rst | 31 ++++++++++++++++++++++
 proxy/InkAPI.cc                               | 23 ++++++++++++++++
 proxy/api/ts/ts.h                             |  1 +
 5 files changed, 117 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/450d45d8/doc/reference/api/TSHttpSsnClientFdGet.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/api/TSHttpSsnClientFdGet.en.rst 
b/doc/reference/api/TSHttpSsnClientFdGet.en.rst
new file mode 100644
index 0000000..02723ea
--- /dev/null
+++ b/doc/reference/api/TSHttpSsnClientFdGet.en.rst
@@ -0,0 +1,31 @@
+.. 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.
+
+
+TSHttpSsnClientFdGet
+=====================
+
+Synopsis
+--------
+
+`#include <ts/ts.h>`
+
+.. c:function:: TSReturnCode TSHttpSsnClientFdGet(TSHttpTxn txnp, int *fdp)
+
+
+Description
+-----------
+Get the socket descriptor for the client socket in :arg:`fdp` for the 
transaction :arg:`ssn`. 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/450d45d8/doc/reference/api/TSHttpTxnClientFdGet.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/api/TSHttpTxnClientFdGet.en.rst 
b/doc/reference/api/TSHttpTxnClientFdGet.en.rst
new file mode 100644
index 0000000..9d938e9
--- /dev/null
+++ b/doc/reference/api/TSHttpTxnClientFdGet.en.rst
@@ -0,0 +1,31 @@
+.. 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.
+
+
+TSHttpTxnClientFdGet
+=====================
+
+Synopsis
+--------
+
+`#include <ts/ts.h>`
+
+.. c:function:: TSReturnCode TSHttpTxnClientFdGet(TSHttpTxn txnp, int *fdp)
+
+
+Description
+-----------
+Get the socket descriptor for the client socket in :arg:`fdp` for the 
transaction :arg:`txnp`. 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/450d45d8/doc/reference/api/TSHttpTxnServerFdGet.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/api/TSHttpTxnServerFdGet.en.rst 
b/doc/reference/api/TSHttpTxnServerFdGet.en.rst
new file mode 100644
index 0000000..510bafb
--- /dev/null
+++ b/doc/reference/api/TSHttpTxnServerFdGet.en.rst
@@ -0,0 +1,31 @@
+.. 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.
+
+
+TSHttpTxnServerFdGet
+=====================
+
+Synopsis
+--------
+
+`#include <ts/ts.h>`
+
+.. c:function:: TSReturnCode TSHttpTxnServerFdGet(TSHttpTxn txnp, int *fdp)
+
+
+Description
+-----------
+Get the socket descriptor for the server socket in :arg:`fdp` for the 
transaction :arg:`txnp`. 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/450d45d8/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index c3269f8..b57edde 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7006,6 +7006,29 @@ TSHttpTxnClientFdGet(TSHttpTxn txnp, int *fdp)
   return TSHttpSsnClientFdGet(ssnp, fdp);
 }
 
+TSReturnCode
+TSHttpTxnServerFdGet(TSHttpTxn txnp, int *fdp)
+{
+  sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
+  sdk_assert(sdk_sanity_check_null_ptr((void*)fdp) == TS_SUCCESS);
+
+  HttpSM *sm = reinterpret_cast<HttpSM *>(txnp);
+  *fdp = -1;
+
+  HttpServerSession *ss = sm->get_server_session();
+  if (ss == NULL) {
+    return TS_ERROR;
+  }
+
+  NetVConnection *vc = ss->get_netvc();
+  if (vc == NULL) {
+    return TS_ERROR;
+  }
+
+  *fdp = vc->get_socket();
+  return TS_SUCCESS;
+}
+
 /* Matcher Utils */
 char *
 TSMatcherReadIntoBuffer(char *file_name, int *file_len)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/450d45d8/proxy/api/ts/ts.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h b/proxy/api/ts/ts.h
index 1484836..1060b3e 100644
--- a/proxy/api/ts/ts.h
+++ b/proxy/api/ts/ts.h
@@ -1358,6 +1358,7 @@ tsapi struct sockaddr const 
*TSHttpTxnNextHopAddrGet(TSHttpTxn txnp);
 tsapi TSReturnCode TSHttpTxnClientFdGet(TSHttpTxn txnp, int *fdp);
 tsapi TSReturnCode TSHttpTxnOutgoingAddrSet(TSHttpTxn txnp, struct sockaddr 
const *addr);
 tsapi TSReturnCode TSHttpTxnOutgoingTransparencySet(TSHttpTxn txnp, int flag);
+tsapi TSReturnCode TSHttpTxnServerFdGet(TSHttpTxn txnp, int* fdp);
 
 /* TS-1008: the above TXN calls for the Client conn should work with SSN */
 tsapi struct sockaddr const *TSHttpSsnClientAddrGet(TSHttpSsn ssnp);

Reply via email to