This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new cbbd973362 Add TSVConnFdGet api (#10324)
cbbd973362 is described below
commit cbbd97336224cabe140cf209222c7dabc8fa50a8
Author: Susan Hinrichs <[email protected]>
AuthorDate: Mon Sep 11 17:51:33 2023 -0500
Add TSVConnFdGet api (#10324)
(cherry picked from commit 7ddb721c4ff4e1943a3d92b889b346d398fe8756)
Conflicts:
include/ts/ts.h
---
.../api/functions/TSVConnFdGet.en.rst | 34 ++++++++++++++++++++++
include/ts/ts.h | 2 ++
src/traffic_server/InkAPI.cc | 8 +++++
3 files changed, 44 insertions(+)
diff --git a/doc/developer-guide/api/functions/TSVConnFdGet.en.rst
b/doc/developer-guide/api/functions/TSVConnFdGet.en.rst
new file mode 100644
index 0000000000..7e5a808115
--- /dev/null
+++ b/doc/developer-guide/api/functions/TSVConnFdGet.en.rst
@@ -0,0 +1,34 @@
+.. 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.
+
+
+TSVConnFdGet
+============
+
+Synopsis
+--------
+
+.. code-block:: cpp
+
+ #include <ts/ts.h>
+
+.. c:function:: int TSVConnFdGet(TSVConn vconnp)
+
+
+Description
+-----------
+Returns the file descriptor associated with the network connection :arg:`sslp`.
+It returns -1 on error.
diff --git a/include/ts/ts.h b/include/ts/ts.h
index ea28eabf63..7c56b57d9d 100644
--- a/include/ts/ts.h
+++ b/include/ts/ts.h
@@ -1289,6 +1289,8 @@ tsapi void TSVConnReenableEx(TSVConn sslvcp, TSEvent
event);
tsapi TSReturnCode TSVConnTunnel(TSVConn sslp);
/* Return the SSL object associated with the connection */
tsapi TSSslConnection TSVConnSslConnectionGet(TSVConn sslp);
+/* Return the file descriptoer associated with the connection */
+int TSVConnFdGet(TSVConn sslp);
/* Return the intermediate X509StoreCTX object that references the certificate
being validated */
tsapi TSSslVerifyCTX TSVConnSslVerifyCTXGet(TSVConn sslp);
/* Fetch a SSL context from the global lookup table */
diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index ba4b870343..7cd59605f3 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -9570,6 +9570,14 @@ TSVConnSslConnectionGet(TSVConn sslp)
return ssl;
}
+int
+TSVConnFdGet(TSVConn vconnp)
+{
+ sdk_assert(sdk_sanity_check_null_ptr(vconnp) == TS_SUCCESS);
+ NetVConnection *vc = reinterpret_cast<NetVConnection *>(vconnp);
+ return vc->get_socket();
+}
+
const char *
TSVConnSslSniGet(TSVConn sslp, int *length)
{