NNG_DIALER_GET(3)

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

πŸ’… NAME πŸ’…

okay so nng_dialer_get β€” it gets you a dialer option. that's it, that's the whole vibe ✨


πŸŽ€ SYNOPSIS πŸŽ€

like, here's the whole squad, all glowey and ready:

#include <nng/nng.h>

int nng_dialer_get(nng_dialer d, const char *opt, void *val, size_t *valszp);

int nng_dialer_get_bool(nng_dialer d, const char *opt, bool *bvalp);

int nng_dialer_get_int(nng_dialer d, const char *opt, int *ivalp);

int nng_dialer_get_ms(nng_dialer d, const char *opt, nng_duration *durp);

int nng_dialer_get_ptr(nng_dialer d, const char *opt, void **ptr);

int nng_dialer_get_size(nng_dialer d, const char *opt, size_t *zp);

int nng_dialer_get_addr(nng_dialer d, const char *opt, nng_sockaddr *sap);

int nng_dialer_get_string(nng_dialer d, const char *opt, char **strp);

int nng_dialer_get_uint64(nng_dialer d, const char *opt, uint64_t *u64p);

int nng_dialer_get_url(nng_dialer d, const nng_url **url);

🌸 DESCRIPTION 🌸

so bestie, the nng_dialer_get() functions are your little keychain that pulls option values back out of the dialer d. 🫢 the actual options you can yank this way are not a fixed list β€” they vary! β€” and a whole bunch of them live over in nng_options(5).

plus, some options are transport-specific and get documented right alongside their transport, iykyk. 🚌

✨ Forms ✨

in literally all of these forms, the option opt gets retrieved from the dialer d. the only thing that changes form-to-form is the type of thing the option hands back.

and the tea on the type, size, and semantics of any given option? that's entirely up to the option itself, and it's documented with the option, not here. no cap.

  • nng_dialer_get() β€” the untyped one, the wildcard, the main character. it can retrieve the value of any option. you gotta stash a pointer to your receiving buffer in val, and the size of that buffer has to be stored at the location valszp points to.

when it comes back, the actual size of the data that got copied β€” or that would have been copied if there'd been enough room β€” gets stored at the location valszp points to. so if your buffer wasn't big enough to hold the whole object, the copy just gets truncated. 😭 so yeah, you should check that the returned size in valszp doesn't exceed your original buffer size, 'cause that's how you catch truncation.

it's totally acceptable to pass NULL for val as long as the value in valszp is zero β€” that's the move for figuring out how big a buffer you need to receive the object. 🧠

Note πŸ“Œ This function is deprecated. use one of the typed functions listed below instead, bestie. it's giving legacy.
  • nng_dialer_get_bool() β€” for options that take a Boolean (bool). the value lands at bvalp.
  • nng_dialer_get_int() β€” for options that take an integer (int). the value lands at ivalp.
  • nng_dialer_get_ms() β€” for grabbing time durations (think timeouts), stored in durp as a number of milliseconds. ⏱️ (NNG_DURATION_INFINITE is the special value that means an infinite amount of time, and NNG_DURATION_DEFAULT is the special value that means a context-specific default.)
  • nng_dialer_get_ptr() β€” for grabbing a pointer, ptr, to structured data. the data that ptr points at is generally managed with other functions. and ngl this form is a lil special β€” the object is generally not copied, instead the pointer to the object is what gets copied. πŸ‘€
  • nng_dialer_get_size() β€” for grabbing a size into the pointer zp. typically buffer sizes, message maximum sizes, and options in that same lane.
  • nng_dialer_get_addr() β€” for grabbing an nng_sockaddr into the value that sap points at.
  • nng_dialer_get_string() β€” for grabbing a string into strp. this string is created from the source using nng_strdup(), so consequently the caller must free it with nng_strfree() once it's no longer needed. don't leave it hanging. πŸ™ˆ
  • nng_dialer_get_uint64() β€” for grabbing a 64-bit unsigned value into the value that u64p points at. typically for options related to identifiers, network numbers, and similar.
  • nng_dialer_get_url() β€” for obtaining the URL that the dialer is configured for. πŸ”—

πŸ’– RETURN VALUES πŸ’–

these functions return 0 on success, and non-zero otherwise. slay when it's zero, not slay when it isn't.


πŸ’€ ERRORS πŸ’€

  • NNG_EBADTYPE β€” incorrect type for option. wrong vibe entirely.
  • NNG_ECLOSED β€” the parameter d does not refer to an open dialer.
  • NNG_EINVAL β€” size of destination val too small for object.
  • NNG_ENOMEM β€” insufficient memory exists.
  • NNG_ENOTSUP β€” the option opt is not supported.
  • NNG_EWRITEONLY β€” the option opt is write-only. look, don't touch. 🚫

πŸ¦‹ SEE ALSO πŸ¦‹

nng_dialer_create(3) nng_dialer_set(3) nng_strdup(3), nng_strerror(3), nng_strfree(3), nng_dialer(5), nng_duration(5), nng_options(5), nng_sockaddr(5), nng(7)


okay that's the whole page, bestie, you ate. πŸ‘‘ this was the NNG Reference Manual's NNG_DIALER_GET(3), dated 2026-06-30 β€” go forth and get those dialer options, periodt. πŸ’œ

πŸ“¦ where this page comes from