gnunet_constants.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2009 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @author Christian Grothoff
  18. *
  19. * @file
  20. * Global constants for performance tuning
  21. *
  22. * @defgroup constants Constant definitions
  23. * Global constants for performance tuning
  24. * @{
  25. */
  26. #ifndef GNUNET_CONSTANTS_H
  27. #define GNUNET_CONSTANTS_H
  28. #ifdef __cplusplus
  29. extern "C"
  30. {
  31. #if 0 /* keep Emacsens' auto-indent happy */
  32. }
  33. #endif
  34. #endif
  35. /**
  36. * Bandwidth (in/out) to assume initially (before either peer has
  37. * communicated any particular preference). Should be rather low; set
  38. * so that at least one maximum-size message can be send roughly once
  39. * per minute.
  40. */
  41. #define GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT GNUNET_BANDWIDTH_value_init (1024 \
  42. * 1024)
  43. /**
  44. * After how long do we consider a connection to a peer dead
  45. * if we don't receive messages from the peer?
  46. */
  47. #define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply ( \
  48. GNUNET_TIME_UNIT_MINUTES, 5)
  49. /**
  50. * How long do we delay reading more from a peer after a quota violation?
  51. */
  52. #define GNUNET_CONSTANTS_QUOTA_VIOLATION_TIMEOUT GNUNET_TIME_relative_multiply ( \
  53. GNUNET_TIME_UNIT_SECONDS, 2)
  54. /**
  55. * After how long do we consider a service unresponsive
  56. * even if we assume that the service commonly does not
  57. * respond instantly (DNS, Database, etc.).
  58. */
  59. #define GNUNET_CONSTANTS_SERVICE_TIMEOUT GNUNET_TIME_relative_multiply ( \
  60. GNUNET_TIME_UNIT_MINUTES, 10)
  61. /**
  62. * How long do we delay messages to get larger packet sizes (CORKing)?
  63. */
  64. #define GNUNET_CONSTANTS_MAX_CORK_DELAY GNUNET_TIME_relative_multiply ( \
  65. GNUNET_TIME_UNIT_SECONDS, 1)
  66. /**
  67. * After what amount of latency for a message do we print a warning?
  68. */
  69. #define GNUNET_CONSTANTS_LATENCY_WARN GNUNET_TIME_relative_multiply ( \
  70. GNUNET_TIME_UNIT_SECONDS, 3)
  71. /**
  72. * Until which load do we consider the peer overly idle
  73. * (which means that we would like to use more resources).<p>
  74. *
  75. * Note that we use 70 to leave some room for applications
  76. * to consume resources "idly" (i.e. up to 85%) and then
  77. * still have some room for "paid for" resource consumption.
  78. */
  79. #define GNUNET_CONSTANTS_IDLE_LOAD_THRESHOLD 70
  80. /**
  81. * For how long do we allow unused bandwidth
  82. * from the past to carry over into the future? (in seconds)
  83. */
  84. #define GNUNET_CONSTANTS_MAX_BANDWIDTH_CARRY_S 5
  85. /**
  86. * After how long do we expire an address in a HELLO that we just
  87. * validated? This value is also used for our own addresses when we
  88. * create a HELLO.
  89. */
  90. #define GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply ( \
  91. GNUNET_TIME_UNIT_HOURS, 12)
  92. /**
  93. * How long do we cache records at most in the DHT?
  94. */
  95. #define GNUNET_CONSTANTS_DHT_MAX_EXPIRATION GNUNET_TIME_relative_multiply ( \
  96. GNUNET_TIME_UNIT_HOURS, 24)
  97. /**
  98. * Size of the `struct EncryptedMessage` of the core (which
  99. * is the per-message overhead of the core).
  100. */
  101. #define GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE (24 + sizeof(struct \
  102. GNUNET_HashCode))
  103. /**
  104. * What is the maximum size for encrypted messages? Note that this
  105. * number imposes a clear limit on the maximum size of any message.
  106. * Set to a value close to 64k but not so close that transports will
  107. * have trouble with their headers.
  108. *
  109. * Could theoretically be 64k minus (#GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE +
  110. * #GNUNET_CONSTANTS_TRANSPORT_SIZE_OUTBOUND_MESSAGE), but we're going
  111. * to be more conservative for now.
  112. */
  113. #define GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE (63 * 1024)
  114. /**
  115. * Size of the CADET message overhead:
  116. * = sizeof (struct GNUNET_CADET_TunnelEncryptedMessage)
  117. * + sizeof (struct GNUNET_CADET_ChannelAppDataMessage)
  118. * + sizeof (struct GNUNET_CADET_ConnectionEncryptedAckMessage))
  119. *
  120. * Checked for correcteness in gnunet-service-cadet_tunnel.c: GCT_init().
  121. */
  122. #define GNUNET_CONSTANTS_CADET_P2P_OVERHEAD 164
  123. /**
  124. * Maximum message size that can be sent on CADET.
  125. */
  126. #define GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE \
  127. (GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE \
  128. - GNUNET_CONSTANTS_CADET_P2P_OVERHEAD)
  129. /**
  130. * Largest block that can be stored in the DHT.
  131. */
  132. #define GNUNET_CONSTANTS_MAX_BLOCK_SIZE (62 * 1024)
  133. /**
  134. * K-value that must be used for the bloom filters in 'GET'
  135. * queries.
  136. */
  137. #define GNUNET_CONSTANTS_BLOOMFILTER_K 16
  138. #if 0 /* keep Emacsens' auto-indent happy */
  139. {
  140. #endif
  141. #ifdef __cplusplus
  142. }
  143. #endif
  144. #endif
  145. /** @} */ /* end of group */