nbd_get_tls_negotiated(3)

hey bestie πŸ’– welcome to the nbd_get_tls_negotiated(3) page β€” this one lives in the LIBNBD manual, and it’s all about checking whether TLS actually got negotiated on a connection ✨

πŸŽ€ NAME πŸŽ€

nbd_get_tls_negotiated β€” find out if TLS was negotiated on a connection. That’s the whole assignment, no cap πŸ’…

✨ SYNOPSIS ✨

        #include <libnbd.h>

        int nbd_get_tls_negotiated (
              struct nbd_handle *h
            );

πŸ¦‹ DESCRIPTION πŸ¦‹

After you’ve connected, you can call this to find out whether the connection is using TLS. It’s normally useful only if you set the TLS request mode to LIBNBD_TLS_ALLOW (peep nbd_set_tls(3)), because in that mode it tries to use TLS but falls back to unencrypted if TLS wasn’t available. This function tells you whether TLS was negotiated or not, periodt. πŸ”₯

In LIBNBD_TLS_REQUIRE mode (the most secure one), the connection would have failed if TLS could not be negotiated. With LIBNBD_TLS_DISABLE mode, TLS is not tried automatically; but if the NBD server uses the less-common SELECTIVETLS mode, this function reports whether a manual nbd_opt_starttls(3) enabled TLS or if the connection is still plaintext. iykyk πŸ’€

🌈 RETURN VALUE 🌈

This call returns a boolean value. That’s it, that’s the tea πŸ“

🚨 ERRORS 🚨

On error -1 is returned. 😭

Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error.

The following parameters must not be NULL: h. For more information see "Non-NULL parameters" in libnbd(3). Don’t pass a NULL handle, bestie β€” that’s not the vibe. πŸ™ˆ

πŸ¦‹ HANDLE STATE πŸ¦‹

nbd_get_tls_negotiated can be called when the handle is in these states:

  • Handle created, before connecting β€” ❌ error
  • Connecting β€” ❌ error
  • Connecting & handshaking (opt_mode) β€” βœ… allowed
  • Connected to the server β€” βœ… allowed
  • Connection shut down β€” βœ… allowed
  • Handle dead β€” ❌ error

🌸 VERSION 🌸

This function first appeared in libnbd 1.2.

If you need to test if this function is available at compile time check if the following macro is defined:

        #define LIBNBD_HAVE_NBD_GET_TLS_NEGOTIATED 1

πŸ‘‘ SEE ALSO πŸ‘‘

Go peek at these:

πŸ’… AUTHORS πŸ’…

  • Eric Blake
  • Richard W.M. Jones

Copyright Red Hat

πŸ’œ LICENSE πŸ’œ

Legal bestie moment: here’s the exact license text, no edits, because words matter. 🫢

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA


okay bye bestie πŸ’… this page is from libnbd-1.25.8, dated 2026-10-13, and the footer name is nbd_get_tls_negotiated(3) 🫢

πŸ“¦ where this page comes from