aboutsummaryrefslogtreecommitdiff
path: root/src/core/message.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/message.c')
-rw-r--r--src/core/message.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/core/message.c b/src/core/message.c
index 79031400..824fc079 100644
--- a/src/core/message.c
+++ b/src/core/message.c
@@ -1,5 +1,5 @@
//
-// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -326,6 +326,12 @@ nni_msg_unique(nni_msg *m)
return (m2);
}
+bool
+nni_msg_shared(nni_msg *m)
+{
+ return (nni_atomic_get(&m->m_refcnt) > 1);
+}
+
// nni_msg_pull_up ensures that the message is unique, and that any header
// is merged with the message. The main purpose of doing this is to break
// up the inproc binding -- protocols send messages to inproc with a
@@ -575,6 +581,24 @@ nni_msg_header_append_u32(nni_msg *m, uint32_t val)
m->m_header_len += sizeof(val);
}
+uint32_t
+nni_msg_header_peek_u32(nni_msg *m)
+{
+ uint32_t val;
+ uint8_t *dst;
+ dst = (void *) m->m_header_buf;
+ NNI_GET32(dst, val);
+ return (val);
+}
+
+void
+nni_msg_header_poke_u32(nni_msg *m, uint32_t val)
+{
+ uint8_t *dst;
+ dst = (void *) m->m_header_buf;
+ NNI_PUT32(dst, val);
+}
+
void
nni_msg_clear(nni_msg *m)
{