blob: 0c69232ddcc6732321cd38eff9fa3e96995cf272 [file]
.. 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.
.. include:: ../../../common.defs
.. default-domain:: cpp
TSNetVConnClientAddrGet
***********************
Synopsis
========
.. code-block:: cpp
#include <ts/ts.h>
.. function:: struct sockaddr const * TSNetVConnClientAddrGet(TSVConn vc)
Description
===========
Return the socket address of the client for the network virtual connection
:arg:`vc`. The returned pointer references storage owned by |TS| and is
only valid for the duration of the current callback; plugins that need to
keep the value across callbacks must copy it into their own storage.
This is the VConn-level counterpart of :func:`TSHttpTxnClientAddrGet` and
is appropriate in low-level hooks (for example, SSL or TCP hooks) where
no HTTP session or transaction is yet associated with the connection.
If the listener that accepted the connection has the ``pp-clnt`` flag set
and a PROXY Protocol header was successfully parsed, the returned address
is the PROXY-Protocol source address rather than the immediate TCP peer.
Without ``pp-clnt`` the returned address is the immediate TCP peer even
when PROXY Protocol is enabled. Use ``TSNetVConnRemoteAddrGet()`` if the
immediate TCP peer is always required regardless of ``pp-clnt``. See
:ref:`Proxy Protocol <proxy-protocol>` for the full enumeration of
surfaces gated by ``pp-clnt``.
Return Value
============
A pointer to the client address, or ``nullptr`` if :arg:`vc` is invalid
or no client address is available.
See Also
========
:manpage:`TSAPI(3ts)`,
:func:`TSHttpTxnClientAddrGet`,
:func:`TSHttpSsnClientAddrGet`