PageRenderTime 79ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/platform/FNET/fnet_stack/stack/fnet_stack_config.h

https://gitlab.com/fuggles/ucos
C Header | 955 lines | 347 code | 116 blank | 492 comment | 2 complexity | e3c1620e958ddd7ae03ebf69f37a8339 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0
  1. /**************************************************************************
  2. *
  3. * Copyright 2011-2015 by Andrey Butok. FNET Community.
  4. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc.
  5. *
  6. ***************************************************************************
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License Version 3
  9. * or later (the "LGPL").
  10. *
  11. * As a special exception, the copyright holders of the FNET project give you
  12. * permission to link the FNET sources with independent modules to produce an
  13. * executable, regardless of the license terms of these independent modules,
  14. * and to copy and distribute the resulting executable under terms of your
  15. * choice, provided that you also meet, for each linked independent module,
  16. * the terms and conditions of the license of that module.
  17. * An independent module is a module which is not derived from or based
  18. * on this library.
  19. * If you modify the FNET sources, you may extend this exception
  20. * to your version of the FNET sources, but you are not obligated
  21. * to do so. If you do not wish to do so, delete this
  22. * exception statement from your version.
  23. *
  24. * This program is distributed in the hope that it will be useful,
  25. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * and the GNU Lesser General Public License along with this program.
  30. * If not, see <http://www.gnu.org/licenses/>.
  31. *
  32. **********************************************************************/ /*!
  33. *
  34. * @file fnet_stack_config.h
  35. *
  36. * @author Andrey Butok
  37. *
  38. * @brief Main TCP/IP stack default configuration file.
  39. *
  40. ***************************************************************************/
  41. /************************************************************************
  42. * !!!DO NOT MODIFY THIS FILE!!!
  43. ************************************************************************/
  44. #ifndef _FNET_STACK_CONFIG_H_
  45. #define _FNET_STACK_CONFIG_H_
  46. /*****************************************************************************
  47. * IP6-specific parameters.
  48. ******************************************************************************/
  49. /*! @addtogroup fnet_platform_stack_ip6_config */
  50. /*! @{ */
  51. /**************************************************************************/ /*!
  52. * @def FNET_CFG_IP6
  53. * @brief IPv6 protocol support:
  54. * - @b @c 1 = is enabled.
  55. * - @c 0 = is disabled (Default value).@n
  56. *
  57. * @see FNET_CFG_IP4
  58. * @showinitializer
  59. ******************************************************************************/
  60. #ifndef FNET_CFG_IP6
  61. #define FNET_CFG_IP6 (0)
  62. #endif
  63. /**************************************************************************/ /*!
  64. * @def FNET_CFG_ND6_NEIGHBOR_CACHE_SIZE
  65. * @brief Maximum number of entries in neighbor cache (per interface).
  66. *
  67. * @note A small cache size may result in an
  68. * excessive number of Neighbor Discovery messages if entries are
  69. * discarded and rebuilt in quick succession.
  70. * @showinitializer
  71. ******************************************************************************/
  72. #ifndef FNET_CFG_ND6_NEIGHBOR_CACHE_SIZE
  73. #define FNET_CFG_ND6_NEIGHBOR_CACHE_SIZE (5)
  74. #endif
  75. /**************************************************************************/ /*!
  76. * @def FNET_CFG_ND6_PREFIX_LIST_SIZE
  77. * @brief Maximum number of entries in the Prefix list (per interface).
  78. * @showinitializer
  79. ******************************************************************************/
  80. #ifndef FNET_CFG_ND6_PREFIX_LIST_SIZE
  81. #define FNET_CFG_ND6_PREFIX_LIST_SIZE (4)
  82. #endif
  83. /**************************************************************************/ /*!
  84. * @def FNET_CFG_ND6_ROUTER_LIST_SIZE
  85. * @brief Maximum number of entries in the Default Router list (per interface).
  86. *
  87. * @note RFC4861: However, a host MUST retain at least two router
  88. * addresses and SHOULD retain more.
  89. * @showinitializer
  90. ******************************************************************************/
  91. #ifndef FNET_CFG_ND6_ROUTER_LIST_SIZE
  92. #define FNET_CFG_ND6_ROUTER_LIST_SIZE (2)
  93. #endif
  94. /**************************************************************************/ /*!
  95. * @def FNET_CFG_ND6_DAD_TRANSMITS
  96. * @brief (RFC4862 5.1)The number of consecutive Neighbor
  97. * Solicitation messages sent while performing Duplicate Address
  98. * Detection on a tentative address. A value of zero indicates that
  99. * Duplicate Address Detection is not performed on tentative
  100. * addresses. A value of one indicates a single transmission with no
  101. * follow-up retransmissions. @n
  102. * Default is @c 1.
  103. * @showinitializer
  104. ******************************************************************************/
  105. #ifndef FNET_CFG_ND6_DAD_TRANSMITS
  106. #define FNET_CFG_ND6_DAD_TRANSMITS (1)
  107. #endif
  108. /* Check minimum values.*/
  109. #if FNET_CFG_ND6_ROUTER_LIST_SIZE < 1
  110. #error FNET_CFG_ND6_ROUTER_LIST_SIZE must be > 0
  111. #endif
  112. #if FNET_CFG_ND6_NEIGHBOR_CACHE_SIZE < 1
  113. #error FNET_CFG_ND6_NEIGHBOR_CACHE_SIZE must be > 0
  114. #endif
  115. #if FNET_CFG_ND6_PREFIX_LIST_SIZE < 1
  116. #error FNET_CFG_ND6_PREFIX_LIST_SIZE must be > 0
  117. #endif
  118. /**************************************************************************/ /*!
  119. * @def FNET_CFG_ND6_RDNSS
  120. * @brief Recursive DNS Server Option (RFC6106) support via router advertisemnt:
  121. * - @b @c 1 = is enabled (Default value).
  122. * - @c 0 = is disabled.@n
  123. * @see FNET_CFG_ND6_RDNSS_LIST_SIZE
  124. *
  125. * @showinitializer
  126. ******************************************************************************/
  127. #ifndef FNET_CFG_ND6_RDNSS
  128. #define FNET_CFG_ND6_RDNSS (1)
  129. #endif
  130. /**************************************************************************/ /*!
  131. * @def FNET_CFG_ND6_RDNSS_LIST_SIZE
  132. * @brief Maximum number of entries in the RDNSS address list (per interface).
  133. *
  134. * @note RFC6106: Specified a sufficient number of RDNSS addresses as three.
  135. *
  136. * @see FNET_CFG_ND6_RDNSS
  137. * @showinitializer
  138. ******************************************************************************/
  139. #ifndef FNET_CFG_ND6_RDNSS_LIST_SIZE
  140. #define FNET_CFG_ND6_RDNSS_LIST_SIZE (3)
  141. #endif
  142. /* Control FNET_CFG_ND6_RDNSS_LIST_SIZE minimum value.*/
  143. #if FNET_CFG_ND6_RDNSS_LIST_SIZE < 1
  144. #undef FNET_CFG_ND6_RDNSS_LIST_SIZE
  145. #define FNET_CFG_ND6_RDNSS_LIST_SIZE (1)
  146. #endif
  147. /**************************************************************************/ /*!
  148. * @def FNET_CFG_IP6_FRAGMENTATION
  149. * @brief IPv6 fragmentation:
  150. * - @b @c 1 = is enabled (Default value). @n The IPv6 will attempt
  151. * to reassemble the IPv6 packet fragments and will be able to
  152. * generate fragmented IPv6 packets.
  153. * - @c 0 = is disabled. The IPv6 will
  154. * silently discard the fragmented IPv6 packets..
  155. * @showinitializer
  156. ******************************************************************************/
  157. #ifndef FNET_CFG_IP6_FRAGMENTATION
  158. #define FNET_CFG_IP6_FRAGMENTATION (1)
  159. #endif
  160. /**************************************************************************/ /*!
  161. * @def FNET_CFG_IP6_PMTU_DISCOVERY
  162. * @brief Path MTU Discovery for IPv6:
  163. * - @b @c 1 = is enabled (Default value).
  164. * - @c 0 = is disabled.
  165. * @showinitializer
  166. ******************************************************************************/
  167. #ifndef FNET_CFG_IP6_PMTU_DISCOVERY
  168. #define FNET_CFG_IP6_PMTU_DISCOVERY (1)
  169. #endif
  170. /**************************************************************************/ /*!
  171. * @def FNET_CFG_NETIF_IP6_ADDR_MAX
  172. * @brief Maximum number of IPv6 addresses that can be bound to an interface.
  173. * @showinitializer
  174. ******************************************************************************/
  175. #ifndef FNET_CFG_NETIF_IP6_ADDR_MAX
  176. #define FNET_CFG_NETIF_IP6_ADDR_MAX (5)
  177. #endif
  178. #if FNET_CFG_NETIF_IP6_ADDR_MAX < 2
  179. #undef FNET_CFG_NETIF_IP6_ADDR_MAX
  180. #define FNET_CFG_NETIF_IP6_ADDR_MAX (2)
  181. #endif
  182. /**************************************************************************/ /*!
  183. * @def FNET_CFG_MLD
  184. * @brief Multicast Listener Discovery (MLDv1) support:
  185. * - @c 1 = is enabled. Its enabling is optional for multicast
  186. * traffic that takes place inside only one local network.
  187. * - @b @c 0 = is disabled (Default value).
  188. *
  189. * @showinitializer
  190. ******************************************************************************/
  191. #ifndef FNET_CFG_MLD
  192. #define FNET_CFG_MLD (0)
  193. #endif
  194. /*! @} */
  195. /*! @addtogroup fnet_platform_stack_ip4_config */
  196. /*! @{ */
  197. /**************************************************************************/ /*!
  198. * @def FNET_CFG_IP4
  199. * @brief IPv4 protocol support:
  200. * - @b @c 1 = is enabled (Default value).
  201. * - @c 0 = is disabled.@n
  202. *
  203. * @see FNET_CFG_IP6
  204. * @showinitializer
  205. ******************************************************************************/
  206. #ifndef FNET_CFG_IP4
  207. #define FNET_CFG_IP4 (1)
  208. #endif
  209. /**************************************************************************/ /*!
  210. * @def FNET_CFG_IP4_FRAGMENTATION
  211. * @brief IP fragmentation:
  212. * - @c 1 = is enabled. The IP will attempt
  213. * to reassemble the IP packet fragments and will be able to
  214. * generate fragmented IP packets.
  215. * - @b @c 0 = is disabled (Default value). The IP will
  216. * silently discard the fragmented IP packets..
  217. * @showinitializer
  218. ******************************************************************************/
  219. #ifndef FNET_CFG_IP4_FRAGMENTATION
  220. #define FNET_CFG_IP4_FRAGMENTATION (0)
  221. #endif
  222. /**************************************************************************/ /*!
  223. * @def FNET_CFG_ETH0_IP4_ADDR
  224. * @brief Defines the default IP address for the Ethernet-0 interface.
  225. * At runtime, it can be changed by @ref fnet_netif_set_ip4_addr().
  226. * @showinitializer
  227. ******************************************************************************/
  228. #ifndef FNET_CFG_ETH0_IP4_ADDR
  229. #define FNET_CFG_ETH0_IP4_ADDR (FNET_IP4_ADDR_INIT(192, 168, 0, 20))
  230. #endif
  231. /**************************************************************************/ /*!
  232. * @def FNET_CFG_ETH0_IP4_MASK
  233. * @brief Defines the default IP Subnetmask for the Ethernet-0 interface.
  234. * At runtime, it can be changed by @ref fnet_netif_set_ip4_subnet_mask().
  235. * @showinitializer
  236. ******************************************************************************/
  237. #ifndef FNET_CFG_ETH0_IP4_MASK
  238. #define FNET_CFG_ETH0_IP4_MASK (FNET_IP4_ADDR_INIT(255U, 255U, 255U, 0U))
  239. #endif
  240. /**************************************************************************/ /*!
  241. * @def FNET_CFG_ETH0_IP4_GW
  242. * @brief Defines the default Gateway IP address for the Ethernet-0 interface.
  243. * At runtime, it can be changed by @ref fnet_netif_set_ip4_gateway().
  244. * @showinitializer
  245. ******************************************************************************/
  246. #ifndef FNET_CFG_ETH0_IP4_GW
  247. #define FNET_CFG_ETH0_IP4_GW (FNET_IP4_ADDR_INIT(0U, 0U, 0U, 0U))
  248. #endif
  249. /**************************************************************************/ /*!
  250. * @def FNET_CFG_ETH0_IP4_DNS
  251. * @brief Defines the default DNS IP address for the Ethernet-0 interface.
  252. * At runtime, it can be changed by @ref fnet_netif_set_ip4_dns().
  253. * @showinitializer
  254. ******************************************************************************/
  255. #ifndef FNET_CFG_ETH0_IP4_DNS
  256. #define FNET_CFG_ETH0_IP4_DNS (FNET_IP4_ADDR_INIT(0U, 0U, 0U, 0U))
  257. #endif
  258. /**************************************************************************/ /*!
  259. * @def FNET_CFG_ETH1_IP4_ADDR
  260. * @brief Defines the default IP address for the Ethernet-1 interface.
  261. * At runtime, it can be changed by @ref fnet_netif_set_ip4_addr().
  262. * @showinitializer
  263. ******************************************************************************/
  264. #ifndef FNET_CFG_ETH1_IP4_ADDR
  265. #define FNET_CFG_ETH1_IP4_ADDR (FNET_IP4_ADDR_INIT(192U, 168U, 0U, 21U))
  266. #endif
  267. /**************************************************************************/ /*!
  268. * @def FNET_CFG_ETH1_IP4_MASK
  269. * @brief Defines the default IP Subnetmask for the Ethernet-1 interface.
  270. * At runtime, it can be changed by @ref fnet_netif_set_ip4_subnet_mask().
  271. * @showinitializer
  272. ******************************************************************************/
  273. #ifndef FNET_CFG_ETH1_IP4_MASK
  274. #define FNET_CFG_ETH1_IP4_MASK (FNET_IP4_ADDR_INIT(255U, 255U, 255U, 0U))
  275. #endif
  276. /**************************************************************************/ /*!
  277. * @def FNET_CFG_ETH1_IP4_GW
  278. * @brief Defines the default Gateway IP address for the Ethernet-1 interface.
  279. * At runtime, it can be changed by @ref fnet_netif_set_ip4_gateway().
  280. * @showinitializer
  281. ******************************************************************************/
  282. #ifndef FNET_CFG_ETH1_IP4_GW
  283. #define FNET_CFG_ETH1_IP4_GW (FNET_IP4_ADDR_INIT(0U, 0U, 0U, 0U))
  284. #endif
  285. /**************************************************************************/ /*!
  286. * @def FNET_CFG_ETH1_IP4_DNS
  287. * @brief Defines the default DNS IP address for the Ethernet-1 interface.
  288. * At runtime, it can be changed by @ref fnet_netif_set_ip4_dns().
  289. * @showinitializer
  290. ******************************************************************************/
  291. #ifndef FNET_CFG_ETH1_IP4_DNS
  292. #define FNET_CFG_ETH1_IP4_DNS (FNET_IP4_ADDR_INIT(0U, 0U, 0U, 0U))
  293. #endif
  294. /**************************************************************************/ /*!
  295. * @def FNET_CFG_LOOPBACK_IP4_ADDR
  296. * @brief Defines the IP address for the Loopback interface.
  297. * By default it is set to 127.0.0.1.
  298. * At runtime, it can be changed by @ref fnet_netif_set_ip4_addr().
  299. * @showinitializer
  300. ******************************************************************************/
  301. #ifndef FNET_CFG_LOOPBACK_IP4_ADDR
  302. #define FNET_CFG_LOOPBACK_IP4_ADDR (FNET_IP4_ADDR_INIT(127U, 0U, 0U, 1U))
  303. #endif
  304. /**************************************************************************/ /*!
  305. * @def FNET_CFG_IGMP
  306. * @brief Internet Group Management Protocol (IGMP) support:
  307. * - @c 1 = is enabled. It sets @ref FNET_CFG_MULTICAST to 1 automatically.
  308. * - @b @c 0 = is disabled (Default value).@n
  309. * @see FNET_CFG_IGMP_VERSION
  310. * @showinitializer
  311. ******************************************************************************/
  312. #ifndef FNET_CFG_IGMP
  313. #define FNET_CFG_IGMP (0)
  314. #endif
  315. #if FNET_CFG_IGMP
  316. /* IGMP requires IPv4 multicast support.*/
  317. #undef FNET_CFG_MULTICAST
  318. #define FNET_CFG_MULTICAST (1)
  319. #endif
  320. /**************************************************************************/ /*!
  321. * @def FNET_CFG_IGMP_VERSION
  322. * @brief Internet Group Management Protocol (IGMP) version:
  323. * - @c 1 = IGMPv1 - RFC1112.
  324. * - @b @c 2 = IGMPv2 - RFC2236 (Default value).@n
  325. * @see FNET_CFG_IGMP
  326. * @showinitializer
  327. ******************************************************************************/
  328. #ifndef FNET_CFG_IGMP_VERSION
  329. #define FNET_CFG_IGMP_VERSION (2)
  330. #endif
  331. #if (FNET_CFG_IGMP_VERSION < 1) || (FNET_CFG_IGMP_VERSION > 2)
  332. #error "FNET_CFG_IGMP_VERSION must be set to 1 or to 2"
  333. #endif
  334. /*! @} */
  335. /*! @addtogroup fnet_stack_config */
  336. /*! @{ */
  337. /*****************************************************************************
  338. * TCP/IP stack general parameters.
  339. ******************************************************************************/
  340. /**************************************************************************/ /*!
  341. * @def FNET_CFG_TCP
  342. * @brief TCP protocol support:
  343. * - @b @c 1 = is enabled (Default value).
  344. * - @c 0 = is disabled.@n
  345. * @n
  346. * You can disable it to save a substantial amount of code, if
  347. * your application needs the UDP only. By default, it is enabled.
  348. * @showinitializer
  349. ******************************************************************************/
  350. #ifndef FNET_CFG_TCP
  351. #define FNET_CFG_TCP (1)
  352. #endif
  353. /**************************************************************************/ /*!
  354. * @def FNET_CFG_LOOPBACK
  355. * @brief Loopback interface:
  356. * - @c 1 = is enabled.
  357. * - @b @c 0 = is disabled (Default value).
  358. * @showinitializer
  359. ******************************************************************************/
  360. #ifndef FNET_CFG_LOOPBACK
  361. #define FNET_CFG_LOOPBACK (0)
  362. #endif
  363. /**************************************************************************/ /*!
  364. * @def FNET_CFG_LOOPBACK_MULTICAST
  365. * @brief Local loopback of multicast datagrams:
  366. * - @c 1 = is enabled.@n
  367. * It means that the sending system should receive a
  368. * copy of the multicast datagrams that are transmitted.@n
  369. * It is valid only if @ref FNET_CFG_LOOPBACK is ser to @c 1.
  370. * - @b @c 0 = is disabled (Default value).@n
  371. * @see FNET_CFG_LOOPBACK
  372. * @showinitializer
  373. ******************************************************************************/
  374. #ifndef FNET_CFG_LOOPBACK_MULTICAST
  375. #define FNET_CFG_LOOPBACK_MULTICAST (0)
  376. #endif
  377. /**************************************************************************/ /*!
  378. * @def FNET_CFG_LOOPBACK_BROADCAST
  379. * @brief Local loopback of broadcast datagrams:
  380. * - @c 1 = is enabled.@n
  381. * It means that the sending system should receive a
  382. * copy of the broadcast datagrams that are transmitted.@n
  383. * It is valid only if @ref FNET_CFG_LOOPBACK is ser to @c 1.
  384. * - @b @c 0 = is disabled (Default value).@n
  385. * @see FNET_CFG_LOOPBACK
  386. * @showinitializer
  387. ******************************************************************************/
  388. #ifndef FNET_CFG_LOOPBACK_BROADCAST
  389. #define FNET_CFG_LOOPBACK_BROADCAST (0)
  390. #endif
  391. /**************************************************************************/ /*!
  392. * @def FNET_CFG_LOOPBACK_MTU
  393. * @brief Defines the Maximum Transmission Unit for the Loopback interface.
  394. * By default, it is set to 1576.
  395. * @showinitializer
  396. ******************************************************************************/
  397. #ifndef FNET_CFG_LOOPBACK_MTU
  398. #define FNET_CFG_LOOPBACK_MTU (1576U)
  399. #endif
  400. /**************************************************************************/ /*!
  401. * @def FNET_CFG_DEFAULT_IF
  402. * @brief Descriptor of a default network interface set during stack initialisation.@n
  403. * For example, it can be set to FNET_ETH0_IF, FNET_ETH1_IF or FNET_LOOP_IF. @n
  404. * During run time it can be changed by ref@ fnet_netif_set_default().
  405. * @see fnet_netif_get_default(), net_netif_set_default()
  406. ******************************************************************************/
  407. #ifndef FNET_CFG_DEFAULT_IF
  408. #if FNET_CFG_CPU_ETH0
  409. #define FNET_CFG_DEFAULT_IF (FNET_ETH0_IF)
  410. #elif FNET_CFG_CPU_ETH1
  411. #define FNET_CFG_DEFAULT_IF (FNET_ETH1_IF)
  412. #elif FNET_CFG_LOOPBACK
  413. #define FNET_CFG_DEFAULT_IF (FNET_LOOP_IF)
  414. #else
  415. #define FNET_CFG_DEFAULT_IF ((fnet_netif_desc_t)FNET_NULL)
  416. #endif
  417. #endif
  418. /**************************************************************************/ /*!
  419. * @def FNET_CFG_MULTICAST
  420. * @brief Multicast group support:
  421. * - @c 1 = is enabled. @n
  422. * It is set automatically to @c 1, if @c FNET_CFG_IP6 is set to @c 1.
  423. * - @c 0 = is disabled (default value, if only IPv4 is enabled).@n
  424. * @see FNET_CFG_MULTICAST_MAX, FNET_CFG_MULTICAST_SOCKET_MAX, FNET_CFG_IGMP
  425. * @showinitializer
  426. ******************************************************************************/
  427. #ifndef FNET_CFG_MULTICAST
  428. #define FNET_CFG_MULTICAST (0)
  429. #endif
  430. #if FNET_CFG_IP6 /* Multicast must be enabled for IPv6. */
  431. #undef FNET_CFG_MULTICAST
  432. #define FNET_CFG_MULTICAST (1)
  433. #endif
  434. /**************************************************************************/ /*!
  435. * @def FNET_CFG_MULTICAST_MAX
  436. * @brief Maximum number of unique multicast memberships may exist at
  437. * the same time in the whole system.@n
  438. * You may join the same host group address on multiple interfaces.
  439. * @see FNET_CFG_MULTICAST, FNET_CFG_MULTICAST_SOCKET_MAX
  440. * @showinitializer
  441. ******************************************************************************/
  442. #ifndef FNET_CFG_MULTICAST_MAX
  443. #define FNET_CFG_MULTICAST_MAX (5U)
  444. #endif
  445. /**************************************************************************/ /*!
  446. * @def FNET_CFG_MULTICAST_SOCKET_MAX
  447. * @brief Maximum number of multicast memberships may exist at
  448. * the same time per one socket.
  449. * @see FNET_CFG_MULTICAST, FNET_CFG_MULTICAST_MAX
  450. * @showinitializer
  451. ******************************************************************************/
  452. #ifndef FNET_CFG_MULTICAST_SOCKET_MAX
  453. #define FNET_CFG_MULTICAST_SOCKET_MAX (1)
  454. #endif
  455. /**************************************************************************/ /*!
  456. * @def FNET_CFG_DNS
  457. * @brief DNS IPv4 address support, by network interface:
  458. * - @c 1 = is enabled.
  459. * - @b @c 0 = is disabled (Default value).@n
  460. * @showinitializer
  461. ******************************************************************************/
  462. #ifndef FNET_CFG_DNS
  463. #define FNET_CFG_DNS (0)
  464. #endif
  465. /**************************************************************************/ /*!
  466. * @def FNET_CFG_ARP_TABLE_SIZE
  467. * @brief Maximum number of entries in the ARP table, by network interface.
  468. * @showinitializer
  469. ******************************************************************************/
  470. #ifndef FNET_CFG_ARP_TABLE_SIZE
  471. #define FNET_CFG_ARP_TABLE_SIZE (10U)
  472. #endif
  473. /**************************************************************************/ /*!
  474. * @def FNET_CFG_ARP_EXPIRE_TIMEOUT
  475. * @brief Period of time after which ARP cache entries are automatically expired (in seconds).@n
  476. * If set to @c 0, the expiration is disabled (not recommended).
  477. * Default value is 1200 seconds (20 minutes).
  478. * @showinitializer
  479. ******************************************************************************/
  480. #ifndef FNET_CFG_ARP_EXPIRE_TIMEOUT
  481. #define FNET_CFG_ARP_EXPIRE_TIMEOUT (1200U)
  482. #endif
  483. /**************************************************************************/ /*!
  484. * @def FNET_CFG_TCP_DISCARD_OUT_OF_ORDER
  485. * @brief Discarding of TCP segments that are received out of order:
  486. * - @c 1 = is enabled.
  487. * - @b @c 0 = is disabled (Default value).@n
  488. * @n
  489. * But you may enable it, to save RAM.
  490. * @showinitializer
  491. ******************************************************************************/
  492. #ifndef FNET_CFG_TCP_DISCARD_OUT_OF_ORDER
  493. #define FNET_CFG_TCP_DISCARD_OUT_OF_ORDER (0)
  494. #endif
  495. /**************************************************************************/ /*!
  496. * @def FNET_CFG_TCP_URGENT
  497. * @brief TCP "urgent" (out-of-band) data processing:
  498. * - @c 1 = is enabled.
  499. * - @b @c 0 = is disabled (Default value).
  500. * @see SO_OOBINLINE, TCP_URGRCVD, TCP_BSD, MSG_OOB
  501. * @showinitializer
  502. ******************************************************************************/
  503. #ifndef FNET_CFG_TCP_URGENT
  504. #define FNET_CFG_TCP_URGENT (0)
  505. #endif
  506. /**************************************************************************/ /*!
  507. * @def FNET_CFG_UDP
  508. * @brief UDP protocol support:
  509. * - @b @c 1 = is enabled (Default value).
  510. * - @c 0 = is disabled.@n
  511. * @n
  512. * You can disable it to save some amount of code, if your
  513. * application needs the TCP only. By default, it is enabled.
  514. * @showinitializer
  515. ******************************************************************************/
  516. #ifndef FNET_CFG_UDP
  517. #define FNET_CFG_UDP (1)
  518. #endif
  519. /**************************************************************************/ /*!
  520. * @def FNET_CFG_UDP_CHECKSUM
  521. * @brief UDP checksum:
  522. * - @b @c 1 = The UDP checksum will be generated for transmitted
  523. * datagrams and verified on received UDP datagrams (Default value).
  524. * - @c 0 = The UDP checksum will not be generated for transmitted
  525. * datagrams and won't be verified on received UDP datagrams.
  526. * @n@n
  527. * You can disable it to speed the UDP applications up.
  528. * By default, it is enabled.
  529. * @showinitializer
  530. ******************************************************************************/
  531. #ifndef FNET_CFG_UDP_CHECKSUM
  532. #define FNET_CFG_UDP_CHECKSUM (1)
  533. #endif
  534. /**************************************************************************/ /*!
  535. * @def FNET_CFG_RAW
  536. * @brief RAW socket support:
  537. * - @c 1 = is enabled.
  538. * - @b @c 0 = is disabled (Default value).@n
  539. * @showinitializer
  540. ******************************************************************************/
  541. #ifndef FNET_CFG_RAW
  542. #define FNET_CFG_RAW (0)
  543. #endif
  544. /*****************************************************************************
  545. * TCP/IP stack parameters.
  546. ******************************************************************************/
  547. /**************************************************************************/ /*!
  548. * @def FNET_CFG_HEAP_SIZE
  549. * @brief Size of the internal static heap buffer.
  550. * It is used only if @ref fnet_init_static() was
  551. * called for FNET initialization.
  552. * @hideinitializer
  553. ******************************************************************************/
  554. #ifndef FNET_CFG_HEAP_SIZE
  555. #define FNET_CFG_HEAP_SIZE (50U * 1024U)
  556. #endif
  557. /**************************************************************************/ /*!
  558. * @def FNET_CFG_SOCKET_MAX
  559. * @brief Maximum number of sockets that can exist at the same time.
  560. * @showinitializer
  561. ******************************************************************************/
  562. #ifndef FNET_CFG_SOCKET_MAX
  563. #define FNET_CFG_SOCKET_MAX (10U)
  564. #endif
  565. /**************************************************************************/ /*!
  566. * @def FNET_CFG_SOCKET_TCP_MSS
  567. * @brief The default value of the @ref TCP_MSS option
  568. * (TCP Maximum Segment Size).
  569. * The TCP Maximum Segment Size (MSS) defines the maximum amount
  570. * of data that a host is willing to accept in a single TCP segment.@n
  571. * This Maximum Segment Size (MSS) announcement is sent from the
  572. * data receiver to the data sender and says "I can accept TCP segments
  573. * up to size X". The size (X) may be larger or smaller than the
  574. * default.@n
  575. * The MSS counts only data octets in the segment, it does not count the
  576. * TCP header or the IP header.@n
  577. * This option can be set to:
  578. * - @b @c 0 = This is the default value. The selection of the MSS is
  579. * automatic and is based on the MTU of the outgoing
  580. * interface minus 40 (does not include
  581. * the 20 byte IP header and the 20 byte TCP header).@n
  582. * It is done to assist in avoiding of IP fragmentation
  583. * at the endpoints of the TCP connection.
  584. * - Non-zero value (up to 64K) = The TCP segment could be as large as 64K
  585. * (the maximum IP datagram size), but it could be fragmented
  586. * at the IP layer in order to be transmitted
  587. * across the network to the receiving host.
  588. * @showinitializer
  589. ******************************************************************************/
  590. #ifndef FNET_CFG_SOCKET_TCP_MSS
  591. #define FNET_CFG_SOCKET_TCP_MSS (0)
  592. #endif
  593. /**************************************************************************/ /*!
  594. * @def FNET_CFG_SOCKET_TCP_TX_BUF_SIZE
  595. * @brief Default maximum size for the TCP send-socket buffer.
  596. * At runtime, it can be changed by @ref setsockopt()
  597. * using the @ref SO_SNDBUF socket option.
  598. * @showinitializer
  599. ******************************************************************************/
  600. #ifndef FNET_CFG_SOCKET_TCP_TX_BUF_SIZE
  601. #define FNET_CFG_SOCKET_TCP_TX_BUF_SIZE (2U * 1024U)
  602. #endif
  603. /**************************************************************************/ /*!
  604. * @def FNET_CFG_SOCKET_TCP_RX_BUF_SIZE
  605. * @brief Default maximum size for the TCP receive-socket buffer.
  606. * At runtime, it can be changed by @ref setsockopt()
  607. * using the @ref SO_RCVBUF socket option.
  608. * @showinitializer
  609. ******************************************************************************/
  610. #ifndef FNET_CFG_SOCKET_TCP_RX_BUF_SIZE
  611. #define FNET_CFG_SOCKET_TCP_RX_BUF_SIZE (2U * 1024U)
  612. #endif
  613. /**************************************************************************/ /*!
  614. * @def FNET_CFG_SOCKET_UDP_TX_BUF_SIZE
  615. * @brief Default maximum size for the UDP send-socket buffer.
  616. * At runtime, it can be changed by @ref setsockopt()
  617. * using the @ref SO_SNDBUF socket option.
  618. * @showinitializer
  619. ******************************************************************************/
  620. #ifndef FNET_CFG_SOCKET_UDP_TX_BUF_SIZE
  621. #define FNET_CFG_SOCKET_UDP_TX_BUF_SIZE (2U * 1024U)
  622. #endif
  623. /**************************************************************************/ /*!
  624. * @def FNET_CFG_SOCKET_UDP_RX_BUF_SIZE
  625. * @brief Default maximum size for the UDP receive-socket buffer.
  626. * At runtime, it can be changed by @ref setsockopt()
  627. * using the @ref SO_RCVBUF socket option.
  628. * @showinitializer
  629. ******************************************************************************/
  630. #ifndef FNET_CFG_SOCKET_UDP_RX_BUF_SIZE
  631. #define FNET_CFG_SOCKET_UDP_RX_BUF_SIZE (2U * 1024U)
  632. #endif
  633. /**************************************************************************/ /*!
  634. * @def FNET_CFG_SOCKET_RAW_TX_BUF_SIZE
  635. * @brief Default maximum size for the RAW send-socket buffer.
  636. * At runtime, it can be changed by @ref setsockopt()
  637. * using the @ref SO_SNDBUF socket option.
  638. * @showinitializer
  639. ******************************************************************************/
  640. #ifndef FNET_CFG_SOCKET_RAW_TX_BUF_SIZE
  641. #define FNET_CFG_SOCKET_RAW_TX_BUF_SIZE (2U * 1024U)
  642. #endif
  643. /**************************************************************************/ /*!
  644. * @def FNET_CFG_SOCKET_RAW_RX_BUF_SIZE
  645. * @brief Default maximum size for the RAW receive-socket buffer.
  646. * At runtime, it can be changed by @ref setsockopt()
  647. * using the @ref SO_RCVBUF socket option.
  648. * @showinitializer
  649. ******************************************************************************/
  650. #ifndef FNET_CFG_SOCKET_RAW_RX_BUF_SIZE
  651. #define FNET_CFG_SOCKET_RAW_RX_BUF_SIZE (2U * 1024U)
  652. #endif
  653. /**************************************************************************/ /*!
  654. * @def FNET_CFG_IP_MAX_PACKET
  655. * @brief Maximum size for the IPv4 and IPv6 datagram,
  656. * the largest value is 65535. @n
  657. * Default value is 10 KB.
  658. * @showinitializer
  659. ******************************************************************************/
  660. #ifndef FNET_CFG_IP_MAX_PACKET
  661. #define FNET_CFG_IP_MAX_PACKET (10U*1024U)
  662. #endif
  663. /*****************************************************************************
  664. * Function Overload
  665. *****************************************************************************/
  666. #ifndef FNET_CFG_OVERLOAD_CHECKSUM_LOW
  667. #define FNET_CFG_OVERLOAD_CHECKSUM_LOW (0)
  668. #endif
  669. #ifndef FNET_CFG_OVERLOAD_MEMCPY
  670. #define FNET_CFG_OVERLOAD_MEMCPY (0)
  671. #endif
  672. /* IPv4 and/or IPv6 must enaqbled.*/
  673. #if !FNET_CFG_IP4 && !FNET_CFG_IP6
  674. #error "Please enable IPv4 or/and IPv6, by FNET_CFG_IP4 or/and FNET_CFG_IP6."
  675. #endif
  676. /*****************************************************************************
  677. * DEBUGING INFO OUTPUT
  678. *****************************************************************************/
  679. /**************************************************************************/ /*!
  680. * @internal
  681. * @brief Debugging output:
  682. * - @c 1 = is enabled.
  683. * - @c 0 = is disabled.
  684. * @internal
  685. ******************************************************************************/
  686. #ifndef FNET_CFG_DEBUG
  687. #define FNET_CFG_DEBUG (0)
  688. #endif
  689. #ifndef FNET_CFG_DEBUG_TIMER /* It will be printed to the UART '!' sign every second. */
  690. #define FNET_CFG_DEBUG_TIMER (0)
  691. #endif
  692. #ifndef FNET_CFG_DEBUG_HTTP
  693. #define FNET_CFG_DEBUG_HTTP (0)
  694. #endif
  695. #ifndef FNET_CFG_DEBUG_DHCP
  696. #define FNET_CFG_DEBUG_DHCP (0)
  697. #endif
  698. #ifndef FNET_CFG_DEBUG_ARP
  699. #define FNET_CFG_DEBUG_ARP (0)
  700. #endif
  701. #ifndef FNET_CFG_DEBUG_MEMPOOL
  702. #define FNET_CFG_DEBUG_MEMPOOL (0)
  703. #endif
  704. #ifndef FNET_CFG_DEBUG_TFTP_CLN
  705. #define FNET_CFG_DEBUG_TFTP_CLN (0)
  706. #endif
  707. #ifndef FNET_CFG_DEBUG_TFTP_SRV
  708. #define FNET_CFG_DEBUG_TFTP_SRV (0)
  709. #endif
  710. #ifndef FNET_CFG_DEBUG_STACK
  711. #define FNET_CFG_DEBUG_STACK (0)
  712. #endif
  713. #ifndef FNET_CFG_DEBUG_TELNET
  714. #define FNET_CFG_DEBUG_TELNET (0)
  715. #endif
  716. #ifndef FNET_CFG_DEBUG_SHELL
  717. #define FNET_CFG_DEBUG_SHELL (0)
  718. #endif
  719. #ifndef FNET_CFG_DEBUG_DNS
  720. #define FNET_CFG_DEBUG_DNS (0)
  721. #endif
  722. #ifndef FNET_CFG_DEBUG_BENCH
  723. #define FNET_CFG_DEBUG_BENCH (0)
  724. #endif
  725. #ifndef FNET_CFG_DEBUG_STARTUP_MS
  726. #define FNET_CFG_DEBUG_STARTUP_MS (0)
  727. #endif
  728. #ifndef FNET_CFG_DEBUG_IP6
  729. #define FNET_CFG_DEBUG_IP6 (0)
  730. #endif
  731. #ifndef FNET_CFG_DEBUG_LLMNR
  732. #define FNET_CFG_DEBUG_LLMNR (0)
  733. #endif
  734. #ifndef FNET_CFG_DEBUG_TRACE
  735. #define FNET_CFG_DEBUG_TRACE (0)
  736. #endif
  737. #ifndef FNET_CFG_DEBUG_TRACE_IP
  738. #define FNET_CFG_DEBUG_TRACE_IP (0)
  739. #endif
  740. #ifndef FNET_CFG_DEBUG_TRACE_ICMP
  741. #define FNET_CFG_DEBUG_TRACE_ICMP (0)
  742. #endif
  743. #ifndef FNET_CFG_DEBUG_TRACE_IGMP
  744. #define FNET_CFG_DEBUG_TRACE_IGMP (0)
  745. #endif
  746. #ifndef FNET_CFG_DEBUG_TRACE_ETH
  747. #define FNET_CFG_DEBUG_TRACE_ETH (0)
  748. #endif
  749. #ifndef FNET_CFG_DEBUG_TRACE_ARP
  750. #define FNET_CFG_DEBUG_TRACE_ARP (0)
  751. #endif
  752. #ifndef FNET_CFG_DEBUG_TRACE_UDP
  753. #define FNET_CFG_DEBUG_TRACE_UDP (0)
  754. #endif
  755. #ifndef FNET_CFG_DEBUG_TRACE_TCP
  756. #define FNET_CFG_DEBUG_TRACE_TCP (0)
  757. #endif
  758. #if !FNET_CFG_DEBUG /* Clear all debuging flags. */
  759. #undef FNET_CFG_DEBUG_TIMER
  760. #define FNET_CFG_DEBUG_TIMER (0)
  761. #undef FNET_CFG_DEBUG_HTTP
  762. #define FNET_CFG_DEBUG_HTTP (0)
  763. #undef FNET_CFG_DEBUG_DHCP
  764. #define FNET_CFG_DEBUG_DHCP (0)
  765. #undef FNET_CFG_DEBUG_TELNET
  766. #define FNET_CFG_DEBUG_TELNET (0)
  767. #undef FNET_CFG_DEBUG_ARP
  768. #define FNET_CFG_DEBUG_ARP (0)
  769. #undef FNET_CFG_DEBUG_MEMPOOL
  770. #define FNET_CFG_DEBUG_MEMPOOL (0)
  771. #undef FNET_CFG_DEBUG_TFTP_CLN
  772. #define FNET_CFG_DEBUG_TFTP_CLN (0)
  773. #undef FNET_CFG_DEBUG_TFTP_SRV
  774. #define FNET_CFG_DEBUG_TFTP_SRV (0)
  775. #undef FNET_CFG_DEBUG_STACK
  776. #define FNET_CFG_DEBUG_STACK (0)
  777. #undef FNET_CFG_DEBUG_SHELL
  778. #define FNET_CFG_DEBUG_SHELL (0)
  779. #undef FNET_CFG_DEBUG_DNS
  780. #define FNET_CFG_DEBUG_DNS (0)
  781. #undef FNET_CFG_DEBUG_BENCH
  782. #define FNET_CFG_DEBUG_BENCH (0)
  783. #undef FNET_CFG_DEBUG_STARTUP_MS
  784. #define FNET_CFG_DEBUG_STARTUP_MS (0)
  785. #undef FNET_CFG_DEBUG_TRACE
  786. #define FNET_CFG_DEBUG_TRACE (0)
  787. #undef FNET_CFG_DEBUG_IP6
  788. #define FNET_CFG_DEBUG_IP6 (0)
  789. #undef FNET_CFG_DEBUG_LLMNR
  790. #define FNET_CFG_DEBUG_LLMNR (0)
  791. #endif
  792. #if !FNET_CFG_DEBUG_TRACE /* Clear all trace flags. */
  793. #undef FNET_CFG_DEBUG_TRACE_IP
  794. #define FNET_CFG_DEBUG_TRACE_IP (0)
  795. #undef FNET_CFG_DEBUG_TRACE_ICMP
  796. #define FNET_CFG_DEBUG_TRACE_ICMP (0)
  797. #undef FNET_CFG_DEBUG_TRACE_IGMP
  798. #define FNET_CFG_DEBUG_TRACE_IGMP (0)
  799. #undef FNET_CFG_DEBUG_TRACE_ETH
  800. #define FNET_CFG_DEBUG_TRACE_ETH (0)
  801. #undef FNET_CFG_DEBUG_TRACE_ARP
  802. #define FNET_CFG_DEBUG_TRACE_ARP (0)
  803. #undef FNET_CFG_DEBUG_TRACE_UDP
  804. #define FNET_CFG_DEBUG_TRACE_UDP (0)
  805. #undef FNET_CFG_DEBUG_TRACE_TCP
  806. #define FNET_CFG_DEBUG_TRACE_TCP (0)
  807. #endif
  808. /******************************************************************************
  809. * Obsolete configuration parameters
  810. ******************************************************************************/
  811. #ifdef FNET_CFG_ETH_IP4_ADDR
  812. #error "FNET_CFG_ETH_IP4_ADDR parameter is obsolete, use FNET_CFG_ETH0_IP4_ADDR."
  813. #endif
  814. #ifdef FNET_CFG_ETH_IP4_MASK
  815. #error "FNET_CFG_ETH_IP4_MASK parameter is obsolete, use FNET_CFG_ETH0_IP4_MASK."
  816. #endif
  817. #ifdef FNET_CFG_ETH_IP4_GW
  818. #error "FNET_CFG_ETH_IP4_GW parameter is obsolete, use FNET_CFG_ETH0_IP4_GW."
  819. #endif
  820. #ifdef FNET_CFG_ETH_IP4_DNS
  821. #error "FNET_CFG_ETH_IP4_DNS parameter is obsolete, use FNET_CFG_ETH0_IP4_DNS."
  822. #endif
  823. #ifdef FNET_CFG_ETH
  824. #error "FNET_CFG_ETH parameter is obsolete, use FNET_CFG_CPU_ETH0."
  825. #endif
  826. #ifdef FNET_CFG_ETH_MAC_ADDR
  827. #error "FNET_CFG_ETH_MAC_ADDR parameter is obsolete, use FNET_CFG_CPU_ETH0_MAC_ADDR."
  828. #endif
  829. #ifdef FNET_CFG_ETH_MTU
  830. #error "FNET_CFG_ETH_MTU parameter is obsolete, use FNET_CFG_CPU_ETH0_MTU ."
  831. #endif
  832. /**************************************************************************/ /*!
  833. * @internal
  834. ******************************************************************************/
  835. #ifndef FNET_OS
  836. #define FNET_OS (0)
  837. #endif
  838. /*! @} */
  839. #endif