aboutsummaryrefslogtreecommitdiff
path: root/src/core/defs.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-01-20 23:31:55 -0800
committerGarrett D'Amore <garrett@damore.org>2020-01-20 23:35:08 -0800
commit38c005e7c07b5ccaab3345dc8c66cbc27b95692a (patch)
tree7d35c74df9f0f320942e6c8c601e963a4cc11741 /src/core/defs.h
parent058ad941dc55ad6288f6b07f4cdf237fd13f1a93 (diff)
downloadnng-38c005e7c07b5ccaab3345dc8c66cbc27b95692a.tar.gz
nng-38c005e7c07b5ccaab3345dc8c66cbc27b95692a.tar.bz2
nng-38c005e7c07b5ccaab3345dc8c66cbc27b95692a.zip
fixes #1169 survey and xsurvey could use message cloning
fixes #1160 Consider limiting maximum hop count to 15 fixes #1098 Maximum maxTTL should be compile time defined This doesn't expose the max-MaxTTL in the CMakeList.txt -- there is really no reason anyone should be changing it. This does not yet inline the message header into the nni_msg_t, but it is my intention to do so soon, and eliminate most of the conditional cases for failure on inserting into the header.
Diffstat (limited to 'src/core/defs.h')
-rw-r--r--src/core/defs.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/core/defs.h b/src/core/defs.h
index 9e320e1d..eaba7428 100644
--- a/src/core/defs.h
+++ b/src/core/defs.h
@@ -1,5 +1,5 @@
//
-// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitoar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -161,4 +161,18 @@ typedef enum {
typedef nni_type nni_opt_type;
+// NNI_MAX_MAX_TTL is the maximum value that MAX_TTL can be set to -
+// i.e. the number of nng_device boundaries that a message can traverse.
+// This value drives the size of pre-allocated headers and back-trace
+// buffers -- we need 4 bytes for each hop, plus 4 bytes for the request
+// identifier. Thus, it is recommended not to set this value too large.
+// (It is possible to scale out to inconceivably large networks with
+// only a few hops - we have yet to see more than 4 in practice.)
+#ifndef NNI_MAX_MAX_TTL
+#define NNI_MAX_MAX_TTL 15
+#endif
+
+// NNI_MAX_HEADER_SIZE is our header size.
+#define NNI_MAX_HEADER_SIZE ((NNI_MAX_MAX_TTL + 1) * sizeof(uint32_t))
+
#endif // CORE_DEFS_H