NNG_TLS_CONFIG_AUTH_MODE(3tls)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

πŸ’– NNG_TLS_CONFIG_AUTH_MODE πŸ’–

okay bestie, welcome to the NNG Reference Manual β€” this lil page is nng_tls_config_auth_mode(3tls) and it's literally the vibe check for your TLS peers 🌸


✨ NAME ✨

nng_tls_config_auth_mode β€” configure authentication mode 🫢


🌈 SYNOPSIS 🌈

#include <nng/nng.h>
#include <nng/supplemental/tls/tls.h>

typedef enum nng_tls_auth_mode {
        NNG_TLS_AUTH_MODE_NONE,
        NNG_TLS_AUTH_MODE_OPTIONAL,
        NNG_TLS_AUTH_MODE_REQUIRED
} nng_tls_auth_mode;

int nng_tls_config_auth_mode(nng_tls_config *cfg, nng_tls_auth_mode mode);

πŸŽ€ DESCRIPTION πŸŽ€

so nng_tls_config_auth_mode() sets the authentication mode that every TLS session using this configuration object is gonna use. it's giving who gets to walk in and who gets carded at the door πŸ’…

the possible modes are, in order:

  • NNG_TLS_AUTH_MODE_NONE β€” no authentication of the TLS peer happens, at all, periodt. nobody's checking anybody's ID. this is the default for TLS servers, because servers typically don't authenticate their clients (they're just out here vibing, running the place 🫢).
  • NNG_TLS_AUTH_MODE_OPTIONAL β€” if the peer shows up with a certificate, bestie, it is validated. but if the peer doesn't present a valid certificate? the session is still allowed to proceed, just without authentication. soft launch energy ✨.
  • NNG_TLS_AUTH_MODE_REQUIRED β€” a check is made to make sure the peer has presented a valid certificate used for the session. if the peer's certificate is invalid or missing, the session is refused, no cap 🚫. this is the default for clients β€” clients are the ones out here needing to know exactly who they're talking to πŸ‘‘.

πŸ¦‹ RETURN VALUES πŸ¦‹

this function returns 0 on success, and non-zero otherwise. slay when it works, sad when it doesn't 😭


πŸ’€ ERRORS πŸ’€

here's the roster of what can go wrong:

  • NNG_ENOMEM β€” insufficient memory is available. the RAM said "not today" πŸ™ˆ
  • NNG_EINVAL β€” an invalid mode was specified. you handed it a mode that isn't a mode, bestie, it's giving nonsense πŸ’€
  • NNG_EBUSY β€” the configuration cfg is already in use, and cannot be modified. it's locked in, main character energy, you cannot touch it πŸ”₯

🌸 SEE ALSO 🌸


and that's the whole page, bestie!! this one's from the NNG Reference Manual, dated 2026-06-30 β€” go forth and authenticate responsibly πŸ§šπŸ’œβ­

πŸ“¦ where this page comes from