aboutsummaryrefslogtreecommitdiff
path: root/src/core/socket.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-20 01:19:06 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-20 01:19:06 -0800
commitcb7e65fd5004fd24a7c23137e849c2828d2de6c3 (patch)
tree3de27fee15b13faf6ef649ea9760f173555b1bdc /src/core/socket.h
parenta26375dc1ec12c41aaedf3e374175d37a1ae84e9 (diff)
downloadnng-cb7e65fd5004fd24a7c23137e849c2828d2de6c3.tar.gz
nng-cb7e65fd5004fd24a7c23137e849c2828d2de6c3.tar.bz2
nng-cb7e65fd5004fd24a7c23137e849c2828d2de6c3.zip
fixes #18 Sockets should be uint32_t's (handles) not pointers.
Diffstat (limited to 'src/core/socket.h')
-rw-r--r--src/core/socket.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/socket.h b/src/core/socket.h
index 1743869a..2a30fae5 100644
--- a/src/core/socket.h
+++ b/src/core/socket.h
@@ -13,10 +13,13 @@
// NB: This structure is supplied here for use by the CORE. Use of this library
// OUSIDE of the core is STRICTLY VERBOTEN. NO DIRECT ACCESS BY PROTOCOLS OR
// TRANSPORTS.
-struct nng_socket {
+struct nni_socket {
nni_mtx s_mx;
nni_cv s_cv;
+ uint32_t s_id;
+ uint32_t s_refcnt;
+
nni_msgq * s_uwq; // Upper write queue
nni_msgq * s_urq; // Upper read queue
@@ -60,6 +63,8 @@ struct nng_socket {
uint32_t s_nextid; // Next Pipe ID.
};
+extern int nni_sock_hold(nni_sock **, uint32_t);
+extern void nni_sock_rele(nni_sock *);
extern int nni_sock_open(nni_sock **, uint16_t);
extern void nni_sock_close(nni_sock *);
extern int nni_sock_shutdown(nni_sock *);
@@ -71,6 +76,7 @@ extern int nni_sock_recvmsg(nni_sock *, nni_msg **, nni_time);
extern int nni_sock_sendmsg(nni_sock *, nni_msg *, nni_time);
extern int nni_sock_dial(nni_sock *, const char *, nni_ep **, int);
extern int nni_sock_listen(nni_sock *, const char *, nni_ep **, int);
+extern uint32_t nni_sock_id(nni_sock *);
// Set error codes for applications. These are only ever
// called from the filter functions in protocols, and thus