GNUTLS_ALPN_GET_SELECTED_PROTOCOL(3)
π gnutls_alpn_get_selected_protocol β the tea on your negotiated protocol π
okay bestie, welcome to the gnutls manual pages, the iconic series where we explain C functions like they're gossip. today's main character is gnutls_alpn_get_selected_protocol(3), aka the API function that tells you which ALPN protocol actually won the vibe check during your TLS handshake. π¦
β¨ NAME β¨
gnutls_alpn_get_selected_protocol β API function. that's it, that's the name, she's serving function and she's serving it in the gnutls manual. π
β¨ SYNOPSIS β¨
first things first, you gotta pull her in:
#include <gnutls/gnutls.h>
int gnutls_alpn_get_selected_protocol(gnutls_session_t session,
gnutls_datum_t * protocol);
look at her. so demure. so mindful. πΈ
β¨ ARGUMENTS β¨
gnutls_session_t sessionβ bestie, this is agnutls_session_ttype. it's your session. your whole situation. she's required, no cap.gnutls_datum_t * protocolβ this lil pointer is gonna hold the protocol name for you. you hand her the empty spot, she fills it with the chosen protocol. iconic behavior honestly. β¨
β¨ DESCRIPTION β¨
so here's the plot: this function lets you get the negotiated protocol name. the protocol that got picked. the one that made it through. the winner of the ALPN bracket. π
β οΈ important caveat bestie, do NOT skip this: the returned protocol should be treated as an opaque, constant value, and it is only valid during the session life. do not hang onto it. do not store it in a global. do not text it back to your ex. she expires when the session does. periodt. π
and the deets on how she got chosen: the selected protocol is the first supported by the list sent by the client. so it's not a random draw, it's not a popularity contest, it's literally first-match-wins from the client's list. iykyk. π§
β¨ RETURNS β¨
- on success,
GNUTLS_E_SUCCESS(0) is returned π slay - otherwise, a negative error code is returned π
π Since 3.2.0 β she's been around a minute, she's a veteran, respect her.
β¨ REPORTING BUGS β¨
found a bug? not the fun kind? okay so go tell the devs:
- report bugs to <bugs@gnutls.org> π§
- home page: https://www.gnutls.org π
they wanna know, fr fr. don't be shy, be a good citizen, be the main character who files a clean repro. π«Ά
β¨ COPYRIGHT β¨
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. so like, share the love, keep the receipts, keep the notice. that's the deal and honestly? fair. β
β¨ SEE ALSO β¨
the full documentation for gnutls is maintained as a Texinfo manual. so if the /usr/share/doc/gnutls/ directory does not contain the HTML form, bestie, just go visit:
https://www.gnutls.org/manual/
that's your link, that's your lore drop, that's where the rest of the story lives. π
gnutls version 3.8.13 β that's the build, that's the era, that's the footer energy. ok bye bestie, go negotiate some protocols responsibly, drink water, and remember: opaque means opaque. πππ¦β¨
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms