aboutsummaryrefslogtreecommitdiff
path: root/src/nng.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nng.c')
-rw-r--r--src/nng.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/nng.c b/src/nng.c
index d51d781c..345f47d9 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -2179,3 +2179,58 @@ nng_udp_multicast_membership(nng_udp *udp, nng_sockaddr *sa, bool join)
return (
nni_plat_udp_multicast_membership((nni_plat_udp *) udp, sa, join));
}
+
+struct nng_id_map_s {
+ nni_id_map m;
+};
+
+int
+nng_id_map_alloc(nng_id_map **map, uint64_t lo, uint64_t hi, int flags)
+{
+ nng_id_map *m;
+
+ if ((m = NNI_ALLOC_STRUCT(m)) == NULL) {
+ return (NNG_ENOMEM);
+ }
+ nni_id_map_init(
+ &m->m, lo, hi, (flags & NNG_MAP_RANDOM) ? true : false);
+ *map = m;
+ return (0);
+}
+
+void
+nng_id_map_free(nng_id_map *map)
+{
+ nni_id_map_fini(&map->m);
+ NNI_FREE_STRUCT(map);
+}
+
+void *
+nng_id_get(nng_id_map *map, uint64_t id)
+{
+ return (nni_id_get(&map->m, id));
+}
+
+int
+nng_id_set(nng_id_map *map, uint64_t id, void *val)
+{
+ return (nni_id_set(&map->m, id, val));
+}
+
+int
+nng_id_remove(nng_id_map *map, uint64_t id)
+{
+ return (nni_id_remove(&map->m, id));
+}
+
+int
+nng_id_alloc(nng_id_map *map, uint64_t *id, void *val)
+{
+ return (nni_id_alloc(&map->m, id, val));
+}
+
+bool
+nng_id_visit(nng_id_map *map, uint64_t *id, void **valp, uint32_t *cursor)
+{
+ return (nni_id_visit(&map->m, id, valp, cursor));
+}