nbdkit_is_tls(3)

NAME
nbdkit_is_tls - get TLS status of the connection for nbdkit

SYNOPSIS
 #include <nbdkit-plugin.h>

 int nbdkit_is_tls (void);

DESCRIPTION
"nbdkit_is_tls" returns true if and only if TLS negotiation has been completed on the current connection. An nbdkit(1) plugin may use "nbdkit_is_tls" to limit connections according to whether the client connection is protected by TLS. This function uses thread-local magic so no parameter is required

nbdkit-tls-fallback-filter(1) and the nbdkit --tls=require option are other alternatives.

RETURN VALUE
The function returns 1 (true) if TLS negotiation has been completed, or 0 (false) if not.

If there is an error it calls nbdkit_error(3) and returns -1.

LANGUAGE BINDINGS
In nbdkit-ocaml-plugin(3):

 NBDKit.is_tls : unit -> bool

In nbdkit-python-plugin(3):

 import nbdkit
 tls = nbdkit.is_tls()

In nbdkit-rust-plugin(3):

 use nbdkit::*;
 pub fn is_tls() -> Result<bool>

In nbdkit-sh-plugin(3) the TLS flag is available as parameter $4 of the "open" method.

HISTORY
"nbdkit_is_tls" was added in nbdkit 1.22.

SEE ALSO
nbdkit(1), nbdkit_export_name(3), nbdkit-plugin(3), nbdkit-filter(3), nbdkit-tls(1), nbdkit-tls-fallback-filter(1).

AUTHORS
Eric Blake

COPYRIGHT
Copyright Red Hat

LICENSE
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

•   Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

•   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

•   Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.