gnutls_record_recv_seq(3)

πŸ’– gnutls_record_recv_seq β€” the gnutls manual page, bestie edition πŸ’–

okay so you're deep in the gnutls docs, huh? love that for you. this one lives in the gnutls manual (section 3, the library calls), and it's all about grabbing data off a session and peeking at which packet it came from. let's get into it 🫢


✨ NAME ✨

gnutls_record_recv_seq β€” it's an API function, babes. that's the whole name. iconic, honestly.


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

ssize_t gnutls_record_recv_seq(gnutls_session_t session, void * data,
       size_t data_size, unsigned char * seq);

like… look at her. four little params and a dream ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_session_t session β€” this is a gnutls_session_t type. that's it, that's the whole vibe. it's your session, your girl, your connection πŸ’…
  • void * data β€” the buffer that the data will be read into. so like, the lil basket where the bytes land 🧺
  • size_t data_size β€” the number of requested bytes. how many you're asking for, bestie.
  • unsigned char * seq β€” this is the packet's 64-bit sequence number. it should have space for 8 bytes. yes, eight. count them. don't be stingy with the buffer 😭

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture gnutls_record_recv(). this function is literally the same thing, EXCEPT it also hands you back the sequence number of the data alongside the data itself. that's the whole plot twist.

why do you care? because in DTLS, record packets might be received out-of-order. the universe is chaos, packets show up whenever they want, no cap. so having that sequence number is lowkey essential.

the returned 8-byte sequence number is an integer in big-endian format, and you should treat it as a unique message identification. it's giving "this specific packet, and no other." periodt πŸ’…


πŸ‘‘ RETURNS πŸ‘‘

  • the number of bytes received, and zero on EOF
  • a negative error code is returned in case of an error
  • heads up: the number of bytes received might be less than data_size. don't come for her, that's just how it is πŸ™ˆ

⭐ SINCE ⭐

3.0 β€” she's been here a minute. seasoned. veteran behavior 🌈


πŸ’€ REPORTING BUGS πŸ’€

found a bug? don't suffer in silence, tell the people:


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… go off, 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, go visit:

https://www.gnutls.org/manual/
bestie reminder: if the local docs ghost you, the website will never ghost you 🫢

and that's the page, fr fr πŸ’– this was gnutls_record_recv_seq(3) from the gnutls manual, version 3.8.13 β€” mwah, slay, go read your packets in order (or don't, that's literally what seq is for) πŸ’…πŸŽ€

πŸ“¦ where this page comes from