aboutsummaryrefslogtreecommitdiff
path: root/src/nng.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-10-24 15:26:14 -0700
committerGarrett D'Amore <garrett@damore.org>2017-10-24 16:30:09 -0700
commit4250fc119057eb6a6b534e9c0758488cc5fb034e (patch)
treec64efe1ae1115cf3aacdedf365c11398c8d99ba8 /src/nng.h
parenta7b20c3babd965b12dec8cb5ff0883a4d8d1116d (diff)
downloadnng-4250fc119057eb6a6b534e9c0758488cc5fb034e.tar.gz
nng-4250fc119057eb6a6b534e9c0758488cc5fb034e.tar.bz2
nng-4250fc119057eb6a6b534e9c0758488cc5fb034e.zip
fixes #132 Implement saner notification for file descriptors
This eliminates the "quasi-functional" notify API altogether. The aio framework will be coming soon to replace it. As a bonus, apps (legacy apps) that use the notification FDs will see improved performance, since we don't have to context switch to give them a notification.
Diffstat (limited to 'src/nng.h')
-rw-r--r--src/nng.h62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/nng.h b/src/nng.h
index d740dfc0..c228a6d7 100644
--- a/src/nng.h
+++ b/src/nng.h
@@ -48,8 +48,6 @@ typedef uint32_t nng_listener;
typedef uint32_t nng_pipe;
typedef int32_t nng_duration; // in milliseconds
typedef struct nng_msg nng_msg;
-typedef struct nng_event nng_event;
-typedef struct nng_notify nng_notify;
typedef struct nng_snapshot nng_snapshot;
typedef struct nng_stat nng_stat;
@@ -100,66 +98,6 @@ NNG_DECL int nng_getopt_ms(nng_socket, const char *, nng_duration *);
NNG_DECL int nng_getopt_size(nng_socket, const char *, size_t *);
NNG_DECL int nng_getopt_uint64(nng_socket, const char *, uint64_t *);
-// nng_notify_func is a user function that is executed upon certain
-// events. See below.
-//
-// NOTE WELL: This API is to be replaced in the future with an
-// alternate API based on our AIO async I/O handles. We recommend
-// against building this API too firmly into application code at
-// this juncture.
-typedef void (*nng_notify_func)(nng_event *, void *);
-
-// nng_setnotify sets a notification callback. The callback will be
-// called for any of the requested events, and will be executed on a
-// separate thread. Event delivery is not guaranteed, and can fail
-// if events occur more quickly than the callback can handle, or
-// if memory or other resources are scarce.
-NNG_DECL nng_notify *nng_setnotify(nng_socket, int, nng_notify_func, void *);
-
-// nng_unsetnotify unregisters a previously registered notification callback.
-// Once this returns, the associated callback will not be executed any longer.
-// If the callback is running when this called, then it will wait until that
-// callback completes. (The caller of this function should not hold any
-// locks acqured by the callback, in order to avoid a deadlock.)
-NNG_DECL void nng_unsetnotify(nng_socket, nng_notify *);
-
-// Event types. Sockets can have multiple different kind of events.
-// Note that these are edge triggered -- therefore the status indicated
-// may have changed since the notification occurred.
-//
-// NNG_EV_CAN_RCV - A message is ready for receive.
-// NNG_EV_CAN_SND - A message can be sent.
-// NNG_EV_ERROR - An error condition on the socket occurred.
-// NNG_EV_PIPE_ADD - A new pipe (connection) is added to the socket.
-// NNG_EV_PIPE_REM - A pipe (connection) is removed from the socket.
-// NNG_EV_ENDPT_ADD - An endpoint is added to the socket.
-// NNG_EV_ENDPT_REM - An endpoint is removed from the socket.
-#define NNG_EV_BIT(x) (1U << (x))
-enum nng_ev_bit_enum {
- NNG_EV_CAN_RCV = NNG_EV_BIT(0),
- NNG_EV_CAN_SND = NNG_EV_BIT(1),
- NNG_EV_ERROR = NNG_EV_BIT(2),
- NNG_EV_PIPE_ADD = NNG_EV_BIT(3),
- NNG_EV_PIPE_REM = NNG_EV_BIT(4),
- NNG_EV_DIALER_ADD = NNG_EV_BIT(5),
- NNG_EV_DIALER_REM = NNG_EV_BIT(6),
- NNG_EV_LISTENER_ADD = NNG_EV_BIT(7),
- NNG_EV_LISTENER_REM = NNG_EV_BIT(8),
-
- // XXX: Remove these.
- NNG_EV_ENDPT_ADD = NNG_EV_DIALER_ADD,
- NNG_EV_ENDPT_REM = NNG_EV_DIALER_REM,
-};
-
-// The following functions return more detailed information about the event.
-// Some of the values will not make sense for some event types, in which case
-// the value returned will be NULL.
-NNG_DECL int nng_event_type(nng_event *);
-
-NNG_DECL nng_socket nng_event_socket(nng_event *);
-
-NNG_DECL const char *nng_event_reason(nng_event *);
-
// nng_listen creates a listening endpoint with no special options,
// and starts it listening. It is functionally equivalent to the legacy
// nn_bind(). The underlying endpoint is returned back to the caller in the