NNG_TLS_CONFIG_AUTH_MODE(3tls)
π 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 configurationcfgis already in use, and cannot be modified. it's locked in, main character energy, you cannot touch it π₯
πΈ SEE ALSO πΈ
nng_strerror(3)nng_tls_config_alloc(3tls)nng_tls_config_ca_chain(3tls)nng_tls_config_ca_file(3tls)nng_tls_config_server_name(3tls)nng(7)
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
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms