MS_limits.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. /**
  2. * \file MS_limits.h
  3. *
  4. * This file lists all the Tunable constants used in
  5. * EtherMind Mesh Stack modules.
  6. */
  7. /*
  8. * Copyright (C) 2016. Mindtree Ltd.
  9. * All rights reserved.
  10. */
  11. #ifndef _H_MS_LIMITS_
  12. #define _H_MS_LIMITS_
  13. /* ----------------------------------------------------------------------- */
  14. /* ============================= Bearer ================================ */
  15. /* ----------------------------------------------------------------------- */
  16. #define MS_NUM_NETWORK_INTERFACES 2
  17. #define MS_NUM_PROVISIONING_INTERFACES 2
  18. /* ----------------------------------------------------------------------- */
  19. /* ============================= Network =============================== */
  20. /* ----------------------------------------------------------------------- */
  21. /*
  22. * In a 'flooding' mesh implementation, one of the methods used to restrict
  23. * unlimited flooding, is using message cache.
  24. * This parameter specifies the size of the Network message cache.
  25. *
  26. * Minimum Value: 2
  27. * Maximum Value: can be anything.
  28. */
  29. #define MS_NET_CACHE_SIZE 30 //10->30 by ZQ
  30. /*
  31. * Maximum number of subnets the device can store information about.
  32. *
  33. * Minimum Value: 1
  34. * Maximum Value: can be anything.
  35. */
  36. #define MS_MAX_SUBNETS 3
  37. /*
  38. * Maximum number of device keys the device can store information about.
  39. * As a configuration client, there should be one additional space to
  40. * contain device key of configuration server.
  41. *
  42. * Minimum Value: 1
  43. * Maximum Value: can be anything.
  44. */
  45. #define MS_MAX_DEV_KEYS 256
  46. /*
  47. * Maximum number of addresses present in each proxy filter list.
  48. *
  49. * Minimum Value: 1
  50. * Maximum Value: can be anything.
  51. */
  52. #define MS_PROXY_FILTER_LIST_SIZE 5
  53. /*
  54. * The distance between the network sequence numbers, for every persistent
  55. * storage write. If the device is powered cycled, it will resume transmission
  56. * using the sequence number from start of next block.
  57. *
  58. * Minimum Value: can be anything. A smaller value will reduce the flash lifetime.
  59. * Maximum Value: can be anything.
  60. */
  61. #define MS_NET_SEQ_NUMBER_BLOCK_SIZE 512// 2048
  62. /*
  63. * The timeout in millisecond for proxy advertisement with Network ID for
  64. * each subnet
  65. *
  66. * Minimum Value: can be anything. Larger value will have lesser timeout load.
  67. * Maximum Value: can be anything.
  68. */
  69. #define PROXY_SUBNET_NETID_ADV_TIMEOUT (300 | EM_TIMEOUT_MILLISEC) //100
  70. /*
  71. * The timeout in millisecond for proxy advertisement with Node Identity for
  72. * each subnet
  73. *
  74. * Minimum Value: can be anything. Larger value will have lesser timeout load.
  75. * Maximum Value: can be anything.
  76. */
  77. #define PROXY_SUBNET_NODEID_ADV_TIMEOUT (300 | EM_TIMEOUT_MILLISEC) //100
  78. /*
  79. * The time period for proxy advertisement with Node Identity
  80. *
  81. * Minimum Value: Default 60 seconds as in specification
  82. * Maximum Value: can be anything.
  83. */
  84. #define PROXY_NODEID_ADV_TIMEOUT (60000 | EM_TIMEOUT_MILLISEC)
  85. /* ----------------------------------------------------------------------- */
  86. /* ============================= Transport ============================= */
  87. /* ----------------------------------------------------------------------- */
  88. /*
  89. * This parameter specifies the maximum number of Low Power Nodes (LPNs)
  90. * to which friendship can be established as a Friend.
  91. *
  92. * Minimum Value: 1
  93. * Maximum Value: can be anything.
  94. */
  95. #define MS_MAX_LPNS 5
  96. /*
  97. * Replay Protection cache is required to protect against relay attacks.
  98. * This parameter specifies the size of the Replay Protection cache.
  99. *
  100. * Minimum Value: 2
  101. * Maximum Value: can be anything.
  102. */
  103. #define MS_REPLAY_CACHE_SIZE 30
  104. /*
  105. * Reassembled SAR Rx cache is to avoid handling of segmented frames
  106. * which are already received and acked by the local implementation.
  107. * Saves the unnecessary effort of reassmbly and complex handling by
  108. * the upper layers to handle reception of same payload again from
  109. * the same source device.
  110. *
  111. * Minimum Value: 2
  112. * Maximum Value: can be anything.
  113. */
  114. #define MS_REASSEMBLED_CACHE_SIZE 30
  115. /*
  116. * The number of times to retry the FriendPoll message when
  117. * the FriendUpdate message is not received for the first attempt
  118. * of FriendPoll in the current sequence. When this count expires,
  119. * the friendship will be terminated with the Friend node.
  120. *
  121. * Minimum Value: 1
  122. * Maximum Value: can be anything.
  123. */
  124. #define MS_FRND_POLL_RETRY_COUNT 10
  125. /*
  126. * Number of Segmentation and Reassembly contexts.
  127. * Used during both reception and transmission and also for associated
  128. * LPNs.
  129. *
  130. * Minimum Value: 2
  131. * Maximum Value: can be anything.
  132. */
  133. #define LTRN_SAR_CTX_MAX 16
  134. /*
  135. * Segment Transmission Timeout.
  136. *
  137. * Minimum Value: 200 MS
  138. * Maximum Value: can be anything.
  139. */
  140. #define LTRN_RTX_TIMEOUT 200 /* Millisecond */
  141. /*
  142. * Segment Transmission Count.
  143. *
  144. * Minimum Value: 2
  145. * Maximum Value: can be anything.
  146. */
  147. #define LTRN_RTX_COUNT_UNICASS 5
  148. #define LTRN_RTX_COUNT_GROUP 3
  149. /*
  150. * Ack Timeout.
  151. *
  152. * Minimum Value: 200 MS
  153. * Maximum Value: can be anything.
  154. */
  155. /* TODO: Use ack timeout configured based on the TTL in the received frame */
  156. #define LTRN_ACK_TIMEOUT 50 /* Millisecond */
  157. /*
  158. * Incomplete Timeout.
  159. *
  160. * Minimum Value: 10 Seconds (10000 MS)
  161. * Maximum Value: can be anything.
  162. */
  163. /* TODO: Use ack timeout configured based on the TTL in the received frame */
  164. #define LTRN_INCOMPLETE_TIMEOUT (20*1000) /* Millisecond */
  165. /*
  166. * Receive window is the time in ms for which the Friend will be transmitting the
  167. * response to any request from the LPN after the Receive delay time of
  168. * getting any request
  169. *
  170. * Minimum Value: 100
  171. * Maximum Value: As required
  172. */
  173. #define MS_FRND_RECEIVE_WINDOW 100
  174. /*
  175. * This parameter defines the maximum number of messages that the friend
  176. * is capabale to queue for a single Low Power Node
  177. *
  178. * Minimum Value: 2
  179. * Maximum Value: As required
  180. */
  181. #define MS_FRIEND_MESSAGEQUEUE_SIZE 15
  182. /*
  183. * This parameter defines the maximum number of subscription addresses
  184. * that the friend is capabale to store for a single Low Power Node
  185. *
  186. * Minimum Value: 1
  187. * Maximum Value: As required
  188. */
  189. #define MS_FRIEND_SUBSCRIPTION_LIST_SIZE 8
  190. /*
  191. * This parameter defines the initial timeout in milliseconds
  192. * to be used to track the Friend clear Confirmation after
  193. * sending of a Friend Clear message
  194. *
  195. * Minimum Value: 1000
  196. * Maximum Value: As required
  197. */
  198. #define LPN_CLEAR_RETRY_TIMEOUT_INITIAL 1000
  199. /*
  200. * This parameter defines the timeout in milliseconds
  201. * to be used to retry friend request attempts in case an
  202. * offer is not received.
  203. *
  204. * Minimum Value: 1100
  205. * Maximum Value: As required
  206. */
  207. #define MS_TRN_FRNDREQ_RETRY_TIMEOUT 1200
  208. /* ----------------------------------------------------------------------- */
  209. /* ============================= Access ================================= */
  210. /* ----------------------------------------------------------------------- */
  211. /*
  212. * This parameter specifies the maximum number of elements.
  213. *
  214. * Minimum Value: 1
  215. * Maximum Value: can be anything.
  216. */
  217. #define MS_ACCESS_ELEMENT_COUNT 5
  218. /*
  219. * This parameter specifies the maximum number of models.
  220. *
  221. * Minimum Value: 1
  222. * Maximum Value: can be anything.
  223. */
  224. #define MS_ACCESS_MODEL_COUNT 10// 5
  225. /*
  226. * Maximum number of Applications (keys) the device can store information about.
  227. *
  228. * Minimum Value: 1
  229. * Maximum Value: can be anything.
  230. */
  231. #define MS_MAX_APPS 5
  232. /*
  233. * Maximum number of Virtual Addresses the device can store information about.
  234. *
  235. * Minimum Value: 1
  236. * Maximum Value: can be anything.
  237. */
  238. #define MS_MAX_VIRTUAL_ADDRS 5
  239. /*
  240. * Maximum number of Non-Virtual Addresses the device can store information about.
  241. *
  242. * Minimum Value: 1
  243. * Maximum Value: can be anything.
  244. */
  245. #define MS_MAX_NON_VIRTUAL_ADDRS 5
  246. /*
  247. * Maximum number of Addresses the device can store information about.
  248. * This includes both the Virtual and non-virtual addresses.
  249. *
  250. * Note: This depends on the other configurations.
  251. * Defined here for easy reference. Do not change manually.
  252. */
  253. #define MS_MAX_ADDRS (MS_MAX_VIRTUAL_ADDRS + MS_MAX_NON_VIRTUAL_ADDRS)
  254. #if (MS_MAX_ADDRS != (MS_MAX_VIRTUAL_ADDRS + MS_MAX_NON_VIRTUAL_ADDRS))
  255. #error "MS_MAX_ADDRS != (MS_MAX_VIRTUAL_ADDRS + MS_MAX_NON_VIRTUAL_ADDRS)"
  256. #endif /* (MS_MAX_ADDRS != (MS_MAX_VIRTUAL_ADDRS + MS_MAX_NON_VIRTUAL_ADDRS)) */
  257. /*
  258. * Maximum number of Transition Timers.
  259. *
  260. * Minimum Value: 1
  261. * Maximum Value: can be anything.
  262. */
  263. #define MS_MAX_NUM_TRANSITION_TIMERS 5
  264. /*
  265. * Maximum number of Periodic Step Timers.
  266. *
  267. * Minimum Value: 1
  268. * Maximum Value: can be anything.
  269. */
  270. #define MS_MAX_NUM_PERIODIC_STEP_TIMERS 5
  271. /* ----------------------------------------------------------------------- */
  272. /* ========================== Health Model ============================== */
  273. /* ----------------------------------------------------------------------- */
  274. /*
  275. * This parameter specifies the maximum number of Health Servers
  276. * to be supported.
  277. *
  278. * Minimum Value: 1
  279. * Maximum Value: can be anything.
  280. */
  281. #define MS_HEALTH_SERVER_MAX 2
  282. /* ----------------------------------------------------------------------- */
  283. /* ============================= Misc. ================================== */
  284. /* ----------------------------------------------------------------------- */
  285. /*
  286. * This parameter specifies Default Company ID.
  287. *
  288. * Phyplus Inc - Company ID
  289. * Ref: https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers
  290. */
  291. #define MS_DEFAULT_COMPANY_ID 0x0504
  292. /*
  293. * This parameter specifies a 16-bit vendor-assigned product identifier.
  294. */
  295. #define MS_DEFAULT_PID 0x6212
  296. /*
  297. * This parameter specifies a 16-bit vendor-assigned product version identifier.
  298. */
  299. #define MS_DEFAULT_VID 0x0000
  300. #endif /* _H_MS_LIMITS_ */