gnutls_dtls_cookie_send(3)

okay bestie, welcome to the gnutls manual, page for gnutls_dtls_cookie_send(3) ✨ this one's a whole vibe β€” it's the bouncer at the DTLS club door and she does NOT let just anybody in 🫢


✨ NAME ✨

gnutls_dtls_cookie_send β€” API function πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/dtls.h>

int gnutls_dtls_cookie_send(gnutls_datum_t * key, void * client_data,
size_t client_data_size, gnutls_dtls_prestate_st * prestate,
gnutls_transport_ptr_t ptr, gnutls_push_func push_func);

🌸 ARGUMENTS 🌸

  • gnutls_datum_t * key β€” bestie this is a random key, and it's the one doing the heavy lifting at cookie generation time πŸ”‘
  • void * client_data β€” the data that tells you who the client is, like their address 🏠 (it's the client's identity, fr fr)
  • size_t client_data_size β€” the size of the client's data, literally just how big that thing is πŸ“
  • gnutls_dtls_prestate_st * prestate β€” the cookie you already got handed back from gnutls_dtls_cookie_verify() πŸͺ
  • gnutls_transport_ptr_t ptr β€” a transport pointer, and push_func is gonna use it to do its thing 🚚
  • gnutls_push_func push_func β€” the function that's gonna be used to reply, she's the one who talks back πŸ“£

πŸ’… DESCRIPTION πŸ’…

so here's the tea β˜• this function is your anti-DoS armor. It's how you protect a DTLS server from denial of service attacks by making the client reply with a cookie that this function sent. Sneaky? No, iconic. πŸ‘‘

The way that works: it makes sure that the client you allocated resources for (i.e. gnutls_session_t) is literally the same one the original incoming packet came from. no catfishing allowed πŸ’€

ok and this part MATTERS: this function must be called at the very first incoming packet, prior to allocating any resources, and it must be followed up by gnutls_dtls_cookie_verify(). That's the order, periodt. Don't freestyle it πŸ™ˆ

⭐ RETURNS ⭐

the number of bytes sent πŸŽ‰ or a negative error code if things went sideways 😭


πŸ¦‹ SINCE πŸ¦‹

3.0 β€” she's been around, a true veteran πŸ’œ


πŸ”₯ REPORTING BUGS πŸ”₯

found a bug? tell the girlies:


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. 🫢 (yes bestie, keep the notice, it's the rules)


🌈 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/


and that's the whole page, no cap πŸ’– this was gnutls 3.8.13 talking, mwah, go protect your servers bestie πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from