#include <nanomsg/nn.h>
int nn_symbol_info (int i, struct nn_symbol_properties *buf, int buflen);
Retrieves the symbol name and value at index i. Indices start at 0. An index has no significance to its associated symbol; the mappings may change between library versions.
The nn_symbol_properties has the following definition:
struct nn_symbol_properties { /* The constant value */ int value; /* The constant name */ const char* name; /* The constant namespace, or zero for namespaces themselves */ int ns; /* The option type for socket option constants */ int type; /* The unit for the option value for socket option constants */ int unit; };
More structure members may be added in future, but the input pointer will be written only up to buflen so the ABI is forward-compatible.
Typically a client will iterate through the symbols until nn_symbol_info returns NULL in order to collect all the symbols.
All symbols exposed by nn_symbol_info are available directly in the C API, generally as preprocessor macros. Thus, this function is useful mostly for language bindings that can't parse the header file and rely on retrieving the symbols at runtime.
Note that the NN_MSG symbol is not exported by the nn_symbol_info function. First, it is a pointer rather than an integer; second, the symbol is not supposed to be exported from language bindings to the user. Instead, language bindings should provide the zero-copy functionality in a language-specific way, if at all (zero-copy functionality may not make sense for some languages/bindings).
NN_NS_NAMESPACE
NN_NS_VERSION
NN_NS_DOMAIN
NN_NS_TRANSPORT
NN_NS_PROTOCOL
NN_NS_OPTION_LEVEL
NN_NS_SOCKET_OPTION
NN_NS_TRANSPORT_OPTION
NN_NS_OPTION_TYPE
NN_NS_FLAG
NN_NS_ERROR
NN_NS_LIMIT
NN_NS_EVENT
NN_TYPE_NONE
NN_TYPE_INT
NN_TYPE_STR
More types may be added in the future to nanomsg. You may enumerate all of them using the nn_symbol_info itself by checking NN_NS_OPTION_TYPE namespace.
NN_UNIT_NONE
NN_UNIT_BYTES
NN_UNIT_MILLISECONDS
NN_UNIT_PRIORITY
NN_UNIT_BOOLEAN
More types may be added in the future to nanomsg. You may enumerate all of them using the nn_symbol_info itself by checking NN_NS_OPTION_TYPE namespace.
If i is valid, returns the number of bytes stored at the structure. The maximum value that can be returned is buflen.
If i is out-of-range, nn_symbol_info returns zero.
int i; for (i = 0; ; ++i) { struct nn_symbol_properties sym; int rc = nn_symbol_info (i, &sym, sizeof (sym)); if(rc == 0) break; assert (rc == sizeof (sym)); printf ("'%s' = %d\n", sym.name, sym.value); }
nn_symbol(3) nn_errno(3) nn_strerror(3) nanomsg(7)