This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.1.x by this push:
new 5347c81e1c Add TSVConnFdGet api (#10324)
5347c81e1c is described below
commit 5347c81e1c5349ebee9495d5d92a8e209de8b40e
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
src/traffic_server/InkAPI.cc
---
.../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 226b3c6f1e..6b39abf925 100644
--- a/include/ts/ts.h
+++ b/include/ts/ts.h
@@ -1219,6 +1219,8 @@ tsapi void TSVConnReenable(TSVConn sslvcp);
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 */
+tsapi int TSVConnFdGet(TSVConn sslp);
/* Fetch a SSL context from the global lookup table */
tsapi TSSslContext TSSslContextFindByName(const char *name);
tsapi TSSslContext TSSslContextFindByAddr(struct sockaddr const *);
diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index 56d135107d..4c7a221a82 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -9199,6 +9199,14 @@ TSVConnSSLConnectionGet(TSVConn sslp)
return ssl;
}
+tsapi int
+SVConnFdGet(TSVConn vconnp)
+{
+ sdk_assert(sdk_sanity_check_null_ptr(vconnp) == TS_SUCCESS);
+ NetVConnection *vc = reinterpret_cast<NetVConnection *>(vconnp);
+ return vc->get_socket();
+}
+
tsapi TSSslContext
TSSslContextFindByName(const char *name)
{