gnutls_session_ext_register(3)

πŸ’– gnutls_session_ext_register β€” bestie's guide to registering your very own TLS extension πŸ’–

okay so this is a page from the gnutls manual (yes, the gnutls one, the TLS library, she's iconic) and today we're talking about gnutls_session_ext_register(3). it's giving "let me add my own extension to this session" energy. sit down, grab a strawberry πŸ“, we're doing this.


✨ NAME ✨

gnutls_session_ext_register β€” API function. that's it, that's the name, short and slay.


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

int gnutls_session_ext_register(gnutls_session_t session, const char *
name, int id, gnutls_ext_parse_type_t parse_point, gnutls_ext_recv_func
recv_func, gnutls_ext_send_func send_func, gnutls_ext_deinit_data_func
deinit_func, gnutls_ext_pack_func pack_func, gnutls_ext_unpack_func
unpack_func, unsigned flags);

look at her. ten parameters. main character energy fr fr πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_session_t session β€” the session where this extension is gonna live. it's the session, the one and only, no sharing bestie.
  • const char * name β€” the name you're giving the extension you're registering. yes you get to name her, choose wisely πŸ¦‹
  • int id β€” the numeric id of the extension. numbers only, this is the ID card.
  • gnutls_ext_parse_type_t parse_point β€” the parse type of the extension (peep gnutls_ext_parse_type_t for the deets). this is when in the handshake she gets parsed.
  • gnutls_ext_recv_func recv_func β€” a function to receive the data. incoming πŸ“₯
  • gnutls_ext_send_func send_func β€” a function to send the data. outgoing πŸ“€
  • gnutls_ext_deinit_data_func deinit_func β€” a function that deinitializes any private data. cleanup era, we love to see it 🧹
  • gnutls_ext_pack_func pack_func β€” a function which serializes the extension's private data (used on session packing for resumption). she packs it up all cute for later πŸ’Ό
  • gnutls_ext_unpack_func unpack_func β€” a function which will deserialize the extension's private data. unpacking, obviously πŸ’…
  • unsigned flags β€” must be zero, or flags from gnutls_ext_flags_t. zero or the flag list, no in-between.

πŸ’œ DESCRIPTION πŸ’œ

so like. this function registers a new extension type. periodt. but listen β€” the extension will be only usable within the registered session. it's not going global, it's a session-exclusive little thing, iykyk.

if the extension type is already registered, then GNUTLS_E_ALREADY_REGISTERED gets returned. rude, but fair. unless you pass the flag GNUTLS_EXT_FLAG_OVERRIDE_INTERNAL β€” then you're overriding, and that's on period.

that override flag, when specified, can be used to override certain extensions introduced after 3.6.0. it's expected to be used by applications that handle custom extensions which aren't currently supported in GnuTLS β€” but direct support for them may be added in the future. so like, heads up, your little workaround might get adopted by the library one day πŸ‘€.

each registered extension can store temporary data into the gnutls_session_t structure using gnutls_ext_set_data(), and they can be retrieved using gnutls_ext_get_data(). store and retrieve, a whole little ecosystem 🌈.

the validity of the extension you registered can be given by the appropriate flags of gnutls_ext_flags_t. and if no validity is given, then the registered extension will be valid for client and TLS1.2 server hello (or encrypted extensions for TLS1.3). so if you say nothing, that's the default vibe check result ✨.


⭐ RETURNS ⭐

GNUTLS_E_SUCCESS on success πŸŽ‰ β€” otherwise a negative error code, aka not the vibe 😭.


πŸ¦‹ SINCE πŸ¦‹

3.5.5. she's been around, she's a legacy icon πŸ‘‘


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? don't be shy, report bugs to <bugs@gnutls.org>. home page: https://www.gnutls.org


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 yes, you can share this, just keep the receipts πŸ’–)


🌟 SEE ALSO 🌟

the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:

https://www.gnutls.org/manual/


okay that's the whole page bestie, you ate that 🫢 this was gnutls_session_ext_register(3) from the gnutls manual, version 3.8.13, brought to you with so much love. mwah πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from