nn_symbol.adoc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. nn_symbol(3)
  2. ============
  3. NAME
  4. ----
  5. nn_symbol - query the names and values of nanomsg symbols
  6. SYNOPSIS
  7. --------
  8. *#include <nanomsg/nn.h>*
  9. *const char *nn_symbol (int 'i', int '*value');*
  10. DESCRIPTION
  11. -----------
  12. Retrieves the symbol name and value at index 'i'. Indices start at 0. An index
  13. has no significance to its associated symbol; the mappings may change between
  14. library versions.
  15. Typically a client will iterate through the symbols until nn_symbol returns
  16. NULL in order to collect all the symbols.
  17. All symbols exposed by 'nn_symbol' are available directly in the C API,
  18. generally as preprocessor macros. Thus, this function is useful mostly for
  19. language bindings that can't parse the header file and rely on retrieving the
  20. symbols in the runtime.
  21. Note that the NN_MSG symbol is not exported by the _nn_symbol_ function. First,
  22. it is a pointer rather than an integer; second, the symbol is not supposed to
  23. be exported from language bindings to the user. Instead, language bindings
  24. should provide the zero-copy functionality in a language-specific way, if at
  25. all (zero-copy functionality may not make sense for some languages/bindings).
  26. RETURN VALUE
  27. ------------
  28. If 'i' is valid, returns the name of the symbol at that index. If the pointer
  29. 'value' is not NULL, the symbol's value is stored there.
  30. If 'i' is out-of-range, nn_symbol returns NULL and sets 'errno' to EINVAL.
  31. ERRORS
  32. ------
  33. *EINVAL*::
  34. The passed index 'i' was out-of-range; it was less than zero or greater-than-or-
  35. equal-to the number of symbols.
  36. EXAMPLE
  37. -------
  38. ----
  39. int value, i;
  40. for (i = 0; ; ++i) {
  41. const char* name = nn_symbol (i, &value);
  42. if (name == NULL) break;
  43. printf ("'%s' = %d\n", name, value);
  44. }
  45. ----
  46. SEE ALSO
  47. --------
  48. <<nn_symbol_info#,nn_symbol_info(3)>>
  49. <<nn_errno#,nn_errno(3)>>
  50. <<nn_strerror#,nn_strerror(3)>>
  51. <<nanomsg#,nanomsg(7)>>
  52. AUTHORS
  53. -------
  54. link:mailto:evan@neomantra.net[Evan Wies]