gnutls_x509_cidr_to_rfc5280(3)

✨ NAME ✨

okay bestie, meet gnutls_x509_cidr_to_rfc5280 β€” literally just an API function, and yes that's the whole name, she's not hiding anything πŸ’…

(this page lives in the gnutls manual, section 3, iykyk)


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnutls/x509.h>

int gnutls_x509_cidr_to_rfc5280(const char * cidr, gnutls_datum_t *
cidr_rfc5280);

🌸 ARGUMENTS 🌸

  • const char * cidr β€” the CIDR, in RFC4632 format (IP/prefix), and it's gotta be null-terminated, no exceptions bestie πŸ™ˆ
  • gnutls_datum_t * cidr_rfc5280 β€” where the CIDR range lands once it's been glow-up'd into RFC5280 format ✨

πŸ’– DESCRIPTION πŸ’–

so the way this works is: this function takes a text CIDR range with a prefix β€” think '10.0.0.0/8' β€” and converts it to RFC5280 format, which is the IP address in network byte order followed by its network mask. iconic, honestly. and it works for both IPv4 and IPv6, so she's versatile 🫢

the resulting object is directly usable for IP name constraints usage, like for example in the functions gnutls_x509_name_constraints_add_permitted or gnutls_x509_name_constraints_add_excluded. so you can just take your little converted datum and go straight to business, no middle steps, we love that for us.

⚠️ heads up bestie: the data in the datum needs to be deallocated using gnutls_free(). don't forget, or it's giving memory leak energy πŸ’€

🌈 RETURNS 🌈

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value 😭 (not the slay outcome, but she's honest about it)


⭐ SINCE ⭐

3.5.4 β€” so she's been around a minute, a real veteran queen πŸ‘‘


πŸŽ€ REPORTING BUGS πŸŽ€

found a bug? don't suffer in silence, report 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. so like, share her, just don't strip her credits 🫢


🧚 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, bestie β€” gnutls version 3.8.13, manual section 3, gnutls_x509_cidr_to_rfc5280(3). go convert some CIDR ranges, you absolute main character πŸ’œβœ¨

πŸ“¦ where this page comes from