aboutsummaryrefslogtreecommitdiff
path: root/src/core/idhash.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-22 12:11:21 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-22 12:11:21 -0700
commit9b6ac0a1ea92b1ec99acdd021087f6d8fdc75f14 (patch)
tree7cac47944d1772997fd4d458b5bf6c311edd572c /src/core/idhash.h
parent6b66debe7532bd7c3b0c88da7332315d90a84d43 (diff)
downloadnng-9b6ac0a1ea92b1ec99acdd021087f6d8fdc75f14.tar.gz
nng-9b6ac0a1ea92b1ec99acdd021087f6d8fdc75f14.tar.bz2
nng-9b6ac0a1ea92b1ec99acdd021087f6d8fdc75f14.zip
Add support for 64-bit ids in idhash.
We intend to use this with transports where dynamic "port numbers" might be 32-bits. This would allow us to formulate a 64-bit number representing a conversation, and be able to find that conversation by the 64-bit value. Note that the hashed values are probably not perfectly optimal, as only the low order bits are particularly significant in the hash. We might want to consider XOR'ing in the upper bits to address that.
Diffstat (limited to 'src/core/idhash.h')
-rw-r--r--src/core/idhash.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/idhash.h b/src/core/idhash.h
index b21a681b..c2cecf81 100644
--- a/src/core/idhash.h
+++ b/src/core/idhash.h
@@ -28,13 +28,14 @@ typedef struct nni_idhash_entry nni_idhash_entry;
extern int nni_idhash_init(nni_idhash **);
extern void nni_idhash_fini(nni_idhash *);
-extern void nni_idhash_set_limits(nni_idhash *, uint32_t, uint32_t, uint32_t);
+extern void nni_idhash_set_limits(nni_idhash *, uint64_t, uint64_t, uint64_t);
extern int nni_idhash_create(nni_idhash **);
extern void nni_idhash_destroy(nni_idhash *);
-extern int nni_idhash_find(nni_idhash *, uint32_t, void **);
-extern int nni_idhash_remove(nni_idhash *, uint32_t);
-extern int nni_idhash_insert(nni_idhash *, uint32_t, void *);
-extern int nni_idhash_alloc(nni_idhash *, uint32_t *, void *);
+extern int nni_idhash_find(nni_idhash *, uint64_t, void **);
+extern int nni_idhash_remove(nni_idhash *, uint64_t);
+extern int nni_idhash_insert(nni_idhash *, uint64_t, void *);
+extern int nni_idhash_alloc(nni_idhash *, uint64_t *, void *);
+
extern size_t nni_idhash_count(nni_idhash *);
#endif // CORE_IDHASH_H