fixes #849 Simplify nn_ep operations
diff --git a/src/core/ep.c b/src/core/ep.c
index d32fee3..6587007 100644
--- a/src/core/ep.c
+++ b/src/core/ep.c
@@ -85,7 +85,7 @@
 {
     nn_assert_state (self, NN_EP_STATE_IDLE);
 
-    self->vfptr->destroy (self);
+    self->ops.destroy (self->tran);
     nn_list_item_term (&self->item);
     nn_fsm_term (&self->fsm);
 }
@@ -143,7 +143,7 @@
     ep = nn_cont (self, struct nn_ep, fsm);
 
     if (nn_slow (src == NN_FSM_ACTION && type == NN_FSM_STOP)) {
-        ep->vfptr->stop (ep);
+        ep->ops.stop (ep->tran);
         ep->state = NN_EP_STATE_STOPPING;
         return;
     }
@@ -229,23 +229,17 @@
     nn_sock_stat_increment (self->sock, name, increment);
 }
 
-/*  Get transport private state object. */
-void *nn_ep_tran_private (struct nn_ep *self)
-{
-    return self->tran_private;
-}
-
 int nn_ep_ispeer_ep (struct nn_ep *self, struct nn_ep *other)
 {
     return nn_ep_ispeer (self, other->sock->socktype->protocol);
 }
 
 /*  Set up an ep for use by a transport.  Note that the core will already have
-    done most of the initialization steps.  The associated data can be retrieved
-    later with nn_ep_tran_private(). */
-void nn_ep_tran_setup (struct nn_ep *ep, const struct nn_ep_vfptr *vfptr,
-    void *data)
+    done most of the initialization steps.  The tran is passed as the argument
+    to the ops. */
+void nn_ep_tran_setup (struct nn_ep *ep, const struct nn_ep_ops *ops,
+    void *tran)
 {
-    ep->vfptr = vfptr;
-    ep->tran_private = data;
+    ep->ops = *ops;
+    ep->tran = tran;
 }
diff --git a/src/core/ep.h b/src/core/ep.h
index b585ef5..c1a3767 100644
--- a/src/core/ep.h
+++ b/src/core/ep.h
@@ -47,10 +47,10 @@
     int last_errno;
 
     /*  Transport private state structure */
-    void *tran_private;
+    void *tran;
 
     /*  Transport specific operations */
-    const struct nn_ep_vfptr *vfptr;
+    struct nn_ep_ops ops;
 };
 
 int nn_ep_init (struct nn_ep *self, int src, struct nn_sock *sock, int eid,
diff --git a/src/transport.h b/src/transport.h
index 0f17575..7d590e0 100644
--- a/src/transport.h
+++ b/src/transport.h
@@ -67,23 +67,20 @@
 
 struct nn_ep;
 
-struct nn_ep_vfptr {
+struct nn_ep_ops {
 
     /*  Ask the endpoint to stop itself. The endpoint is allowed to linger
         to send the pending outbound data. When done, it reports the fact by
         invoking nn_ep_stopped() function. */
-    void (*stop) (struct nn_ep *);
+    void (*stop) (void *);
 
-    /*  Deallocate the endpoint object. */
-    void (*destroy) (struct nn_ep *);
+    /*  Deallocate the endpoint object. It will already have been stopped. */
+    void (*destroy) (void *);
 };
 
-/*  Gets the opaque value stored by a transport at setup time. */
-void *nn_ep_tran_private (struct nn_ep *);
-
-/*  Set up an ep for use by a transport.  The final opaque argument can be
-    accessed later by calling nn_ep_tran_private(). */
-void nn_ep_tran_setup (struct nn_ep *, const struct nn_ep_vfptr *, void *);
+/*  Set up an ep for use by a transport.  The final opaque argument is passed
+    as the first argument to the ops entry points. */
+void nn_ep_tran_setup (struct nn_ep *, const struct nn_ep_ops *, void *);
 
 /*  Notify the user that stopping is done. */
 void nn_ep_stopped (struct nn_ep *);
diff --git a/src/transports/inproc/binproc.c b/src/transports/inproc/binproc.c
index d7fc7d6..bc98e3d 100644
--- a/src/transports/inproc/binproc.c
+++ b/src/transports/inproc/binproc.c
@@ -39,9 +39,9 @@
 #define NN_BINPROC_SRC_SINPROC 1
 
 /*  Implementation of nn_ep interface. */
-static void nn_binproc_stop (struct nn_ep *);
-static void nn_binproc_destroy (struct nn_ep *);
-static const struct nn_ep_vfptr nn_binproc_vfptr = {
+static void nn_binproc_stop (void *);
+static void nn_binproc_destroy (void *);
+static const struct nn_ep_ops nn_binproc_ops = {
     nn_binproc_stop,
     nn_binproc_destroy
 };
@@ -87,24 +87,20 @@
         return rc;
     }
 
-    nn_ep_tran_setup (ep, &nn_binproc_vfptr, self);
+    nn_ep_tran_setup (ep, &nn_binproc_ops, self);
     return 0;
 }
 
-static void nn_binproc_stop (struct nn_ep *ep)
+static void nn_binproc_stop (void *self)
 {
-    struct nn_binproc *binproc;
-
-    binproc = nn_ep_tran_private (ep);
+    struct nn_binproc *binproc = self;
 
     nn_fsm_stop (&binproc->fsm);
 }
 
-static void nn_binproc_destroy (struct nn_ep *ep)
+static void nn_binproc_destroy (void *self)
 {
-    struct nn_binproc *binproc;
-
-    binproc = nn_ep_tran_private (ep);
+    struct nn_binproc *binproc = self;
 
     nn_list_term (&binproc->sinprocs);
     nn_fsm_term (&binproc->fsm);
diff --git a/src/transports/inproc/cinproc.c b/src/transports/inproc/cinproc.c
index 06d9466..9d1460f 100644
--- a/src/transports/inproc/cinproc.c
+++ b/src/transports/inproc/cinproc.c
@@ -42,9 +42,9 @@
 #define NN_CINPROC_SRC_SINPROC 1
 
 /*  Implementation of nn_ep callback interface. */
-static void nn_cinproc_stop (struct nn_ep *);
-static void nn_cinproc_destroy (struct nn_ep *);
-static const struct nn_ep_vfptr nn_cinproc_vfptr = {
+static void nn_cinproc_stop (void *);
+static void nn_cinproc_destroy (void *);
+static const struct nn_ep_ops nn_cinproc_ops = {
     nn_cinproc_stop,
     nn_cinproc_destroy
 };
@@ -64,7 +64,7 @@
     self = nn_alloc (sizeof (struct nn_cinproc), "cinproc");
     alloc_assert (self);
 
-    nn_ep_tran_setup (ep, &nn_cinproc_vfptr, self);
+    nn_ep_tran_setup (ep, &nn_cinproc_ops, self);
 
     nn_ins_item_init (&self->item, ep);
     nn_fsm_init_root (&self->fsm, nn_cinproc_handler, nn_cinproc_shutdown,
@@ -83,20 +83,16 @@
     return 0;
 }
 
-static void nn_cinproc_stop (struct nn_ep *ep)
+static void nn_cinproc_stop (void *self)
 {
-    struct nn_cinproc *cinproc;
-
-    cinproc = nn_ep_tran_private (ep);
+    struct nn_cinproc *cinproc = self;
 
     nn_fsm_stop (&cinproc->fsm);
 }
 
-static void nn_cinproc_destroy (struct nn_ep *ep)
+static void nn_cinproc_destroy (void *self)
 {
-    struct nn_cinproc *cinproc;
-
-    cinproc = nn_ep_tran_private (ep);
+    struct nn_cinproc *cinproc = self;
 
     nn_list_term (&cinproc->sinprocs);
     nn_fsm_term (&cinproc->fsm);
diff --git a/src/transports/ipc/bipc.c b/src/transports/ipc/bipc.c
index 4b729ab..c728776 100644
--- a/src/transports/ipc/bipc.c
+++ b/src/transports/ipc/bipc.c
@@ -73,9 +73,9 @@
 };
 
 /*  nn_ep virtual interface implementation. */
-static void nn_bipc_stop (struct nn_ep *self);
-static void nn_bipc_destroy (struct nn_ep *self);
-const struct nn_ep_vfptr nn_bipc_ep_vfptr = {
+static void nn_bipc_stop (void *self);
+static void nn_bipc_destroy (void *self);
+const struct nn_ep_ops nn_bipc_ep_ops = {
     nn_bipc_stop,
     nn_bipc_destroy
 };
@@ -99,8 +99,8 @@
 
 
     /*  Initialise the structure. */
-    nn_ep_tran_setup (ep, &nn_bipc_ep_vfptr, self);
     self->ep = ep;
+    nn_ep_tran_setup (ep, &nn_bipc_ep_ops, self);
     nn_fsm_init_root (&self->fsm, nn_bipc_handler, nn_bipc_shutdown,
         nn_ep_getctx (ep));
     self->state = NN_BIPC_STATE_IDLE;
@@ -120,20 +120,16 @@
     return 0;
 }
 
-static void nn_bipc_stop (struct nn_ep *ep)
+static void nn_bipc_stop (void *self)
 {
-    struct nn_bipc *bipc;
-
-    bipc = nn_ep_tran_private (ep);
+    struct nn_bipc *bipc = self;
 
     nn_fsm_stop (&bipc->fsm);
 }
 
-static void nn_bipc_destroy (struct nn_ep *ep)
+static void nn_bipc_destroy (void *self)
 {
-    struct nn_bipc *bipc;
-
-    bipc = nn_ep_tran_private (ep);
+    struct nn_bipc *bipc = self;
 
     nn_assert_state (bipc, NN_BIPC_STATE_IDLE);
     nn_list_term (&bipc->aipcs);
diff --git a/src/transports/ipc/cipc.c b/src/transports/ipc/cipc.c
index 844cf94..db64cf5 100644
--- a/src/transports/ipc/cipc.c
+++ b/src/transports/ipc/cipc.c
@@ -77,9 +77,9 @@
 };
 
 /*  nn_ep virtual interface implementation. */
-static void nn_cipc_stop (struct nn_ep *ep);
-static void nn_cipc_destroy (struct nn_ep *ep);
-const struct nn_ep_vfptr nn_cipc_ep_vfptr = {
+static void nn_cipc_stop (void *self);
+static void nn_cipc_destroy (void *self);
+const struct nn_ep_ops nn_cipc_ep_ops = {
     nn_cipc_stop,
     nn_cipc_destroy
 };
@@ -104,7 +104,7 @@
 
     /*  Initialise the structure. */
     self->ep = ep;
-    nn_ep_tran_setup (ep, &nn_cipc_ep_vfptr, self);
+    nn_ep_tran_setup (ep, &nn_cipc_ep_ops, self);
     nn_fsm_init_root (&self->fsm, nn_cipc_handler, nn_cipc_shutdown,
         nn_ep_getctx (ep));
     self->state = NN_CIPC_STATE_IDLE;
@@ -128,20 +128,16 @@
     return 0;
 }
 
-static void nn_cipc_stop (struct nn_ep *ep)
+static void nn_cipc_stop (void *self)
 {
-    struct nn_cipc *cipc;
-
-    cipc = nn_ep_tran_private (ep);
+    struct nn_cipc *cipc = self;
 
     nn_fsm_stop (&cipc->fsm);
 }
 
-static void nn_cipc_destroy (struct nn_ep *ep)
+static void nn_cipc_destroy (void *self)
 {
-    struct nn_cipc *cipc;
-
-    cipc = nn_ep_tran_private (ep);
+    struct nn_cipc *cipc = self;
 
     nn_sipc_term (&cipc->sipc);
     nn_backoff_term (&cipc->retry);
diff --git a/src/transports/tcp/btcp.c b/src/transports/tcp/btcp.c
index a22b60c..37541f1 100644
--- a/src/transports/tcp/btcp.c
+++ b/src/transports/tcp/btcp.c
@@ -79,9 +79,9 @@
 };
 
 /*  nn_ep virtual interface implementation. */
-static void nn_btcp_stop (struct nn_ep *);
-static void nn_btcp_destroy (struct nn_ep *);
-const struct nn_ep_vfptr nn_btcp_ep_vfptr = {
+static void nn_btcp_stop (void *);
+static void nn_btcp_destroy (void *);
+const struct nn_ep_ops nn_btcp_ep_ops = {
     nn_btcp_stop,
     nn_btcp_destroy
 };
@@ -111,7 +111,7 @@
     self->ep = ep;
     alloc_assert (self);
 
-    nn_ep_tran_setup (ep, &nn_btcp_ep_vfptr, self);
+    nn_ep_tran_setup (ep, &nn_btcp_ep_ops, self);
     addr = nn_ep_getaddr (ep);
 
     /*  Parse the port. */
@@ -157,20 +157,16 @@
     return 0;
 }
 
-static void nn_btcp_stop (struct nn_ep *ep)
+static void nn_btcp_stop (void *self)
 {
-    struct nn_btcp *btcp;
-
-    btcp = nn_ep_tran_private (ep);
+    struct nn_btcp *btcp = self;
 
     nn_fsm_stop (&btcp->fsm);
 }
 
-static void nn_btcp_destroy (struct nn_ep *ep)
+static void nn_btcp_destroy (void *self)
 {
-    struct nn_btcp *btcp;
-
-    btcp = nn_ep_tran_private (ep);
+    struct nn_btcp *btcp = self;
 
     nn_assert_state (btcp, NN_BTCP_STATE_IDLE);
     nn_list_term (&btcp->atcps);
diff --git a/src/transports/tcp/ctcp.c b/src/transports/tcp/ctcp.c
index fb1fc73..8486f2b 100644
--- a/src/transports/tcp/ctcp.c
+++ b/src/transports/tcp/ctcp.c
@@ -93,9 +93,9 @@
 };
 
 /*  nn_ep virtual interface implementation. */
-static void nn_ctcp_stop (struct nn_ep *ep);
-static void nn_ctcp_destroy (struct nn_ep *ep);
-const struct nn_ep_vfptr nn_ctcp_ep_vfptr = {
+static void nn_ctcp_stop (void *);
+static void nn_ctcp_destroy (void *);
+const struct nn_ep_ops nn_ctcp_ep_ops = {
     nn_ctcp_stop,
     nn_ctcp_destroy
 };
@@ -133,7 +133,7 @@
 
     /*  Initalise the endpoint. */
     self->ep = ep;
-    nn_ep_tran_setup (ep, &nn_ctcp_ep_vfptr, self);
+    nn_ep_tran_setup (ep, &nn_ctcp_ep_ops, self);
 
     /*  Check whether IPv6 is to be used. */
     ipv4onlylen = sizeof (ipv4only);
@@ -198,20 +198,16 @@
     return 0;
 }
 
-static void nn_ctcp_stop (struct nn_ep *ep)
+static void nn_ctcp_stop (void *self)
 {
-    struct nn_ctcp *ctcp;
-
-    ctcp = nn_ep_tran_private (ep);
+    struct nn_ctcp *ctcp = self;
 
     nn_fsm_stop (&ctcp->fsm);
 }
 
-static void nn_ctcp_destroy (struct nn_ep *ep)
+static void nn_ctcp_destroy (void *self)
 {
-    struct nn_ctcp *ctcp;
-
-    ctcp = nn_ep_tran_private (ep);
+    struct nn_ctcp *ctcp = self;
 
     nn_dns_term (&ctcp->dns);
     nn_stcp_term (&ctcp->stcp);
diff --git a/src/transports/ws/bws.c b/src/transports/ws/bws.c
index 98c5448..1242f8a 100644
--- a/src/transports/ws/bws.c
+++ b/src/transports/ws/bws.c
@@ -78,9 +78,9 @@
 };
 
 /*  nn_ep virtual interface implementation. */
-static void nn_bws_stop (struct nn_ep *);
-static void nn_bws_destroy (struct nn_ep *);
-const struct nn_ep_vfptr nn_bws_ep_vfptr = {
+static void nn_bws_stop (void *);
+static void nn_bws_destroy (void *);
+const struct nn_ep_ops nn_bws_ep_ops = {
     nn_bws_stop,
     nn_bws_destroy
 };
@@ -110,7 +110,7 @@
     alloc_assert (self);
     self->ep = ep;
 
-    nn_ep_tran_setup (ep, &nn_bws_ep_vfptr, self);
+    nn_ep_tran_setup (ep, &nn_bws_ep_ops, self);
     addr = nn_ep_getaddr (ep);
 
     /*  Parse the port. */
@@ -156,20 +156,16 @@
     return 0;
 }
 
-static void nn_bws_stop (struct nn_ep *ep)
+static void nn_bws_stop (void *self)
 {
-    struct nn_bws *bws;
-
-    bws = nn_ep_tran_private (ep);
+    struct nn_bws *bws = self;
 
     nn_fsm_stop (&bws->fsm);
 }
 
-static void nn_bws_destroy (struct nn_ep *ep)
+static void nn_bws_destroy (void *self)
 {
-    struct nn_bws *bws;
-
-    bws = nn_ep_tran_private (ep);
+    struct nn_bws *bws = self;
 
     nn_assert_state (bws, NN_BWS_STATE_IDLE);
     nn_list_term (&bws->awss);
diff --git a/src/transports/ws/cws.c b/src/transports/ws/cws.c
index 546430f..d71290f 100644
--- a/src/transports/ws/cws.c
+++ b/src/transports/ws/cws.c
@@ -108,9 +108,9 @@
 };
 
 /*  nn_ep virtual interface implementation. */
-static void nn_cws_stop (struct nn_ep *ep);
-static void nn_cws_destroy (struct nn_ep *ep);
-const struct nn_ep_vfptr nn_cws_ep_vfptr = {
+static void nn_cws_stop (void *);
+static void nn_cws_destroy (void *);
+const struct nn_ep_ops nn_cws_ep_ops = {
     nn_cws_stop,
     nn_cws_destroy
 };
@@ -152,7 +152,7 @@
     self->ep = ep;
 
     /*  Initalise the endpoint. */
-    nn_ep_tran_setup (ep, &nn_cws_ep_vfptr, self);
+    nn_ep_tran_setup (ep, &nn_cws_ep_ops, self);
 
     /*  Check whether IPv6 is to be used. */
     ipv4onlylen = sizeof (ipv4only);
@@ -260,20 +260,16 @@
     return 0;
 }
 
-static void nn_cws_stop (struct nn_ep *ep)
+static void nn_cws_stop (void *self)
 {
-    struct nn_cws *cws;
-
-    cws = nn_ep_tran_private (ep);
+    struct nn_cws *cws = self;
 
     nn_fsm_stop (&cws->fsm);
 }
 
-static void nn_cws_destroy (struct nn_ep *ep)
+static void nn_cws_destroy (void *self)
 {
-    struct nn_cws *cws;
-
-    cws = nn_ep_tran_private (ep);
+    struct nn_cws *cws = self;
 
     nn_chunkref_term (&cws->resource);
     nn_chunkref_term (&cws->remote_host);