aboutsummaryrefslogtreecommitdiff
path: root/src/core/message.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-02-26 00:22:11 -0800
committerGarrett D'Amore <garrett@damore.org>2020-02-26 20:48:22 -0800
commitabab1392c11395d387e3072c4f5788d284846093 (patch)
treedbb1ecb2b166338496981c7d8e3e9e16b977b995 /src/core/message.h
parent6a59b15fba1085432c4c18952680e14d80dd134a (diff)
downloadnng-abab1392c11395d387e3072c4f5788d284846093.tar.gz
nng-abab1392c11395d387e3072c4f5788d284846093.tar.bz2
nng-abab1392c11395d387e3072c4f5788d284846093.zip
fixes #1171 message header could be inlined in the message structure
This uses a maximum 64-byte header and should avoid allocations and cache misses, leading to a small performance boost overall.
Diffstat (limited to 'src/core/message.h')
-rw-r--r--src/core/message.h34
1 files changed, 3 insertions, 31 deletions
diff --git a/src/core/message.h b/src/core/message.h
index 53b644c4..03991166 100644
--- a/src/core/message.h
+++ b/src/core/message.h
@@ -33,30 +33,9 @@ extern void nni_msg_header_clear(nni_msg *);
extern int nni_msg_header_trim(nni_msg *, size_t);
extern int nni_msg_header_chop(nni_msg *, size_t);
extern void nni_msg_dump(const char *, const nni_msg *);
-extern int nni_msg_append_u16(nni_msg *, uint16_t);
-extern int nni_msg_append_u32(nni_msg *, uint32_t);
-extern int nni_msg_append_u64(nni_msg *, uint64_t);
-extern int nni_msg_insert_u16(nni_msg *, uint16_t);
-extern int nni_msg_insert_u32(nni_msg *, uint32_t);
-extern int nni_msg_insert_u64(nni_msg *, uint64_t);
-extern int nni_msg_header_append_u16(nni_msg *, uint16_t);
-extern int nni_msg_header_append_u32(nni_msg *, uint32_t);
-extern int nni_msg_header_append_u64(nni_msg *, uint64_t);
-extern int nni_msg_header_insert_u16(nni_msg *, uint16_t);
-extern int nni_msg_header_insert_u32(nni_msg *, uint32_t);
-extern int nni_msg_header_insert_u64(nni_msg *, uint64_t);
-extern uint16_t nni_msg_trim_u16(nni_msg *);
-extern uint32_t nni_msg_trim_u32(nni_msg *);
-extern uint64_t nni_msg_trim_u64(nni_msg *);
-extern uint16_t nni_msg_chop_u16(nni_msg *);
-extern uint32_t nni_msg_chop_u32(nni_msg *);
-extern uint64_t nni_msg_chop_u64(nni_msg *);
-extern uint16_t nni_msg_header_trim_u16(nni_msg *);
+extern void nni_msg_header_append_u32(nni_msg *, uint32_t);
extern uint32_t nni_msg_header_trim_u32(nni_msg *);
-extern uint64_t nni_msg_header_trim_u64(nni_msg *);
-extern uint16_t nni_msg_header_chop_u16(nni_msg *);
-extern uint32_t nni_msg_header_chop_u32(nni_msg *);
-extern uint64_t nni_msg_header_chop_u64(nni_msg *);
+extern uint32_t nni_msg_trim_u32(nni_msg *);
extern void nni_msg_set_pipe(nni_msg *, uint32_t);
extern uint32_t nni_msg_get_pipe(const nni_msg *);
@@ -65,7 +44,7 @@ extern uint32_t nni_msg_get_pipe(const nni_msg *);
// this functionality MUST be certain to use nni_msg_unique() before
// passing a message out of their control (e.g. to user programs.)
// Failure to do so will likely result in corruption.
-extern void nni_msg_clone(nni_msg *);
+extern void nni_msg_clone(nni_msg *);
extern nni_msg *nni_msg_unique(nni_msg *);
// nni_msg_pull_up ensures that the message is unique, and that any
// header present is "pulled up" into the message body. If the function
@@ -74,11 +53,4 @@ extern nni_msg *nni_msg_unique(nni_msg *);
// original message in that case (same semantics as realloc).
extern nni_msg *nni_msg_pull_up(nni_msg *);
-// These should only be used when the transport or protocol is absolutely
-// certain that there is adequate room. There is about 32 bytes of
-// header and trailer space for a newly allocated message, and transports
-// should generally not be burning more than half that.
-extern void nni_msg_must_append_u32(nni_msg *, uint32_t);
-extern void nni_msg_header_must_append_u32(nni_msg *, uint32_t);
-
#endif // CORE_SOCKET_H