diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-04-30 21:41:40 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-05-01 12:27:19 -0700 |
| commit | 4998964a435fe0f02a2d81b01fdb837214674e72 (patch) | |
| tree | dc5fe29da0574fc1510ab6f9b23b54ffd68cd97b /src/nng.h | |
| parent | 63bdb2c28bc185096e579d1922d57cb71ecaa36b (diff) | |
| download | nng-4998964a435fe0f02a2d81b01fdb837214674e72.tar.gz nng-4998964a435fe0f02a2d81b01fdb837214674e72.tar.bz2 nng-4998964a435fe0f02a2d81b01fdb837214674e72.zip | |
fixes #381 Want comparators for various types
Diffstat (limited to 'src/nng.h')
| -rw-r--r-- | src/nng.h | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -92,6 +92,15 @@ typedef struct nng_snapshot nng_snapshot; typedef struct nng_stat nng_stat; typedef struct nng_aio nng_aio; +// Initializers. +// clang-format off +#define NNG_PIPE_INITIALIZER { 0 } +#define NNG_SOCKET_INITIALIZER { 0 } +#define NNG_DIALER_INITIALIZER { 0 } +#define NNG_LISTENER_INITIALIZER { 0 } +#define NNG_CTX_INITIALIZER { 0 } +// clang-format on + // Some address details. This is in some ways like a traditional sockets // sockaddr, but we have our own to cope with our unique families, etc. // The details of this structure are directly exposed to applications. @@ -181,6 +190,10 @@ NNG_DECL void nng_fini(void); // resources. NNG_DECL int nng_close(nng_socket); +// nng_socket_id returns the positive socket id for the socket, or -1 +// if the socket is not valid. +NNG_DECL int nng_socket_id(nng_socket); + // nng_closeall closes all open sockets. Do not call this from // a library; it will affect all sockets. NNG_DECL void nng_closeall(void); @@ -249,6 +262,14 @@ NNG_DECL int nng_dialer_close(nng_dialer); // connections and releasing all associated resources. NNG_DECL int nng_listener_close(nng_listener); +// nng_dialer_id returns the positive dialer ID, or -1 if the dialer is +// invalid. +NNG_DECL int nng_dialer_id(nng_dialer); + +// nng_listener_id returns the positive listener ID, or -1 if the listener is +// invalid. +NNG_DECL int nng_listener_id(nng_listener); + // nng_dialer_setopt sets an option for a specific dialer. Note // dialer options may not be altered on a running dialer. NNG_DECL int nng_dialer_setopt(nng_dialer, const char *, const void *, size_t); @@ -379,6 +400,11 @@ NNG_DECL int nng_ctx_open(nng_ctx *, nng_socket); // nng_ctx_close closes the context. NNG_DECL int nng_ctx_close(nng_ctx); +// nng_ctx_id returns the numeric id for the context; this will be +// a postive value for a valid context, or < 0 for an invalid context. +// A valid context is not necessarily an *open* context. +NNG_DECL int nng_ctx_id(nng_ctx); + // nng_ctx_recv receives asynchronously. It works like nng_recv_aio, but // uses a local context instead of the socket global context. NNG_DECL void nng_ctx_recv(nng_ctx, nng_aio *); @@ -573,6 +599,7 @@ NNG_DECL int nng_pipe_getopt_uint64(nng_pipe, const char *, uint64_t *); NNG_DECL int nng_pipe_getopt_ptr(nng_pipe, const char *, void **); NNG_DECL int nng_pipe_getopt_string(nng_pipe, const char *, char **); NNG_DECL int nng_pipe_close(nng_pipe); +NNG_DECL int nng_pipe_id(nng_pipe); // Flags. enum nng_flag_enum { |
