gnutls_record_get_direction(3)

πŸ’– gnutls_record_get_direction(3) πŸ’–

okay bestie, welcome to the gnutls section 3 manual, this one's about gnutls_record_get_direction and it's genuinely so useful once you get the vibe ✨


🌸 NAME 🌸

gnutls_record_get_direction β€” it's an API function, and it tells you which way the data was tryna go πŸ‘€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnutls/gnutls.h>

int gnutls_record_get_direction(gnutls_session_t session);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_session_t session β€” bestie, it's a gnutls_session_t type. that's the whole thing. it's your session. πŸ’…

✨ DESCRIPTION ✨

so like, this function is the moment when you need to know whether a GnuTLS function got interrupted while it was sending or while it was receiving, so you can call select() or poll() the right way. it's giving "which one do i wait on" energy 🫢

it spills the tea about the internals of the record protocol, so it's only useful if a previous gnutls function call β€” like gnutls_handshake(), for example β€” got interrupted and returned GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN. after an interrupt like that, your app can call select() or poll() before it goes back to restoring the interrupted GnuTLS function. icon behaviour, honestly 🌈

⚠️ ok important though: this function's output is unreliable if you're using the same session in different threads for sending and receiving. like, do not do that and then trust the answer. not me warning you twice πŸ’€

πŸ’œ RETURNS πŸ’œ

  • 0 β€” it got interrupted while trying to read data πŸ“–
  • 1 β€” it got interrupted while trying to write data ✍️

that's it, that's the whole return value situation, no cap πŸ“


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? spill it 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. slay, that's the license, go forth and redistribute πŸ’–


⭐ 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, then bestie, go here instead:

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


and that's the whole page!! this was gnutls version 3.8.13 btw, from the gnutls peeps β€” mwah, take care of your sessions and don't share them across threads for send + recv, ily bye πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from