Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

uipopt.h 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. /**
  2. * \addtogroup uip
  3. * @{
  4. */
  5. /**
  6. * \defgroup uipopt Configuration options for uIP
  7. * @{
  8. *
  9. * uIP is configured using the per-project configuration file
  10. * "uipopt.h". This file contains all compile-time options for uIP and
  11. * should be tweaked to match each specific project. The uIP
  12. * distribution contains a documented example "uipopt.h" that can be
  13. * copied and modified for each project.
  14. */
  15. /**
  16. * \file
  17. * Configuration options for uIP.
  18. * \author Adam Dunkels <[email protected]>
  19. *
  20. * This file is used for tweaking various configuration options for
  21. * uIP. You should make a copy of this file into one of your project's
  22. * directories instead of editing this example "uipopt.h" file that
  23. * comes with the uIP distribution.
  24. */
  25. /*
  26. * Copyright (c) 2001-2003, Adam Dunkels.
  27. * All rights reserved.
  28. *
  29. * Redistribution and use in source and binary forms, with or without
  30. * modification, are permitted provided that the following conditions
  31. * are met:
  32. * 1. Redistributions of source code must retain the above copyright
  33. * notice, this list of conditions and the following disclaimer.
  34. * 2. Redistributions in binary form must reproduce the above copyright
  35. * notice, this list of conditions and the following disclaimer in the
  36. * documentation and/or other materials provided with the distribution.
  37. * 3. The name of the author may not be used to endorse or promote
  38. * products derived from this software without specific prior
  39. * written permission.
  40. *
  41. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
  42. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  43. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  44. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  45. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  46. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  47. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  48. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  49. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  50. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  51. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  52. *
  53. * This file is part of the uIP TCP/IP stack.
  54. *
  55. * $Id: uipopt.h,v 1.11 2009/04/10 00:37:48 adamdunkels Exp $
  56. *
  57. */
  58. #ifndef __UIPOPT_H__
  59. #define __UIPOPT_H__
  60. #include "Config/AppConfig.h"
  61. #ifndef UIP_LITTLE_ENDIAN
  62. #define UIP_LITTLE_ENDIAN 3412
  63. #endif /* UIP_LITTLE_ENDIAN */
  64. #ifndef UIP_BIG_ENDIAN
  65. #define UIP_BIG_ENDIAN 1234
  66. #endif /* UIP_BIG_ENDIAN */
  67. /*------------------------------------------------------------------------------*/
  68. /**
  69. * \defgroup uipoptstaticconf Static configuration options
  70. * @{
  71. *
  72. * These configuration options can be used for setting the IP address
  73. * settings statically, but only if UIP_FIXEDADDR is set to 1. The
  74. * configuration options for a specific node includes IP address,
  75. * netmask and default router as well as the Ethernet address. The
  76. * netmask, default router and Ethernet address are applicable only
  77. * if uIP should be run over Ethernet.
  78. *
  79. * This options are meaningful only for the IPv4 code.
  80. *
  81. * All of these should be changed to suit your project.
  82. */
  83. /**
  84. * Determines if uIP should use a fixed IP address or not.
  85. *
  86. * If uIP should use a fixed IP address, the settings are set in the
  87. * uipopt.h file. If not, the macros uip_sethostaddr(),
  88. * uip_setdraddr() and uip_setnetmask() should be used instead.
  89. *
  90. * \hideinitializer
  91. */
  92. #define UIP_FIXEDADDR 0
  93. /**
  94. * Ping IP address assignment.
  95. *
  96. * uIP uses a "ping" packets for setting its own IP address if this
  97. * option is set. If so, uIP will start with an empty IP address and
  98. * the destination IP address of the first incoming "ping" (ICMP echo)
  99. * packet will be used for setting the hosts IP address.
  100. *
  101. * \note This works only if UIP_FIXEDADDR is 0.
  102. *
  103. * \hideinitializer
  104. */
  105. #ifdef UIP_CONF_PINGADDRCONF
  106. #define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF
  107. #else /* UIP_CONF_PINGADDRCONF */
  108. #define UIP_PINGADDRCONF 0
  109. #endif /* UIP_CONF_PINGADDRCONF */
  110. /**
  111. * Specifies if the uIP ARP module should be compiled with a fixed
  112. * Ethernet MAC address or not.
  113. *
  114. * If this configuration option is 0, the macro uip_setethaddr() can
  115. * be used to specify the Ethernet address at run-time.
  116. *
  117. * \hideinitializer
  118. */
  119. #define UIP_FIXEDETHADDR 0
  120. /** @} */
  121. /*------------------------------------------------------------------------------*/
  122. /**
  123. * \defgroup uipoptip IP configuration options
  124. * @{
  125. *
  126. */
  127. /**
  128. * The IP TTL (time to live) of IP packets sent by uIP.
  129. *
  130. * This should normally not be changed.
  131. */
  132. #define UIP_TTL 64
  133. /**
  134. * The maximum time an IP fragment should wait in the reassembly
  135. * buffer before it is dropped.
  136. *
  137. */
  138. #define UIP_REASS_MAXAGE 60 /*60s*/
  139. /**
  140. * Turn on support for IP packet reassembly.
  141. *
  142. * uIP supports reassembly of fragmented IP packets. This features
  143. * requires an additional amount of RAM to hold the reassembly buffer
  144. * and the reassembly code size is approximately 700 bytes. The
  145. * reassembly buffer is of the same size as the uip_buf buffer
  146. * (configured by UIP_BUFSIZE).
  147. *
  148. * \note IP packet reassembly is not heavily tested.
  149. *
  150. * \hideinitializer
  151. */
  152. #ifdef UIP_CONF_REASSEMBLY
  153. #define UIP_REASSEMBLY UIP_CONF_REASSEMBLY
  154. #else /* UIP_CONF_REASSEMBLY */
  155. #define UIP_REASSEMBLY 0
  156. #endif /* UIP_CONF_REASSEMBLY */
  157. /** @} */
  158. /*------------------------------------------------------------------------------*/
  159. /**
  160. * \defgroup uipoptipv6 IPv6 configuration options
  161. * @{
  162. *
  163. */
  164. /** The maximum transmission unit at the IP Layer*/
  165. #define UIP_LINK_MTU 1280
  166. #ifndef UIP_CONF_IPV6
  167. /** Do we use IPv6 or not (default: no) */
  168. #define UIP_CONF_IPV6 0
  169. #endif
  170. #ifndef UIP_CONF_IPV6_QUEUE_PKT
  171. /** Do we do per %neighbor queuing during address resolution (default: no) */
  172. #define UIP_CONF_IPV6_QUEUE_PKT 0
  173. #endif
  174. #ifndef UIP_CONF_IPV6_CHECKS
  175. /** Do we do IPv6 consistency checks (highly recommended, default: yes) */
  176. #define UIP_CONF_IPV6_CHECKS 1
  177. #endif
  178. #ifndef UIP_CONF_IPV6_REASSEMBLY
  179. /** Do we do IPv6 fragmentation (default: no) */
  180. #define UIP_CONF_IPV6_REASSEMBLY 0
  181. #endif
  182. #ifndef UIP_CONF_NETIF_MAX_ADDRESSES
  183. /** Default number of IPv6 addresses associated to the node's interface */
  184. #define UIP_CONF_NETIF_MAX_ADDRESSES 3
  185. #endif
  186. #ifndef UIP_CONF_ND6_MAX_PREFIXES
  187. /** Default number of IPv6 prefixes associated to the node's interface */
  188. #define UIP_CONF_ND6_MAX_PREFIXES 3
  189. #endif
  190. #ifndef UIP_CONF_ND6_MAX_NEIGHBORS
  191. /** Default number of neighbors that can be stored in the %neighbor cache */
  192. #define UIP_CONF_ND6_MAX_NEIGHBORS 4
  193. #endif
  194. #ifndef UIP_CONF_ND6_MAX_DEFROUTERS
  195. /** Minimum number of default routers */
  196. #define UIP_CONF_ND6_MAX_DEFROUTERS 2
  197. #endif
  198. /** @} */
  199. /*------------------------------------------------------------------------------*/
  200. /**
  201. * \defgroup uipoptudp UDP configuration options
  202. * @{
  203. *
  204. * \note The UDP support in uIP is still not entirely complete; there
  205. * is no support for sending or receiving broadcast or multicast
  206. * packets, but it works well enough to support a number of vital
  207. * applications such as DNS queries, though
  208. */
  209. /**
  210. * Toggles whether UDP support should be compiled in or not.
  211. *
  212. * \hideinitializer
  213. */
  214. #ifdef UIP_CONF_UDP
  215. #define UIP_UDP UIP_CONF_UDP
  216. #else /* UIP_CONF_UDP */
  217. #define UIP_UDP 1
  218. #endif /* UIP_CONF_UDP */
  219. /**
  220. * Toggles if UDP checksums should be used or not.
  221. *
  222. * \note Support for UDP checksums is currently not included in uIP,
  223. * so this option has no function.
  224. *
  225. * \hideinitializer
  226. */
  227. #ifdef UIP_CONF_UDP_CHECKSUMS
  228. #define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS
  229. #else
  230. #define UIP_UDP_CHECKSUMS 0
  231. #endif
  232. /**
  233. * The maximum amount of concurrent UDP connections.
  234. *
  235. * \hideinitializer
  236. */
  237. #ifdef UIP_CONF_UDP_CONNS
  238. #define UIP_UDP_CONNS UIP_CONF_UDP_CONNS
  239. #else /* UIP_CONF_UDP_CONNS */
  240. #define UIP_UDP_CONNS 10
  241. #endif /* UIP_CONF_UDP_CONNS */
  242. /**
  243. * The name of the function that should be called when UDP datagrams arrive.
  244. *
  245. * \hideinitializer
  246. */
  247. /** @} */
  248. /*------------------------------------------------------------------------------*/
  249. /**
  250. * \defgroup uipopttcp TCP configuration options
  251. * @{
  252. */
  253. /**
  254. * Toggles whether TCP support should be compiled in or not.
  255. *
  256. * \hideinitializer
  257. */
  258. #ifdef UIP_CONF_TCP
  259. #define UIP_TCP UIP_CONF_TCP
  260. #else /* UIP_CONF_TCP */
  261. #define UIP_TCP 1
  262. #endif /* UIP_CONF_TCP */
  263. /**
  264. * Determines if support for opening connections from uIP should be
  265. * compiled in.
  266. *
  267. * If the applications that are running on top of uIP for this project
  268. * do not need to open outgoing TCP connections, this configuration
  269. * option can be turned off to reduce the code size of uIP.
  270. *
  271. * \hideinitializer
  272. */
  273. #ifndef UIP_CONF_ACTIVE_OPEN
  274. #define UIP_ACTIVE_OPEN 1
  275. #else /* UIP_CONF_ACTIVE_OPEN */
  276. #define UIP_ACTIVE_OPEN UIP_CONF_ACTIVE_OPEN
  277. #endif /* UIP_CONF_ACTIVE_OPEN */
  278. /**
  279. * The maximum number of simultaneously open TCP connections.
  280. *
  281. * Since the TCP connections are statically allocated, turning this
  282. * configuration knob down results in less RAM used. Each TCP
  283. * connection requires approximately 30 bytes of memory.
  284. *
  285. * \hideinitializer
  286. */
  287. #ifndef UIP_CONF_MAX_CONNECTIONS
  288. #define UIP_CONNS 10
  289. #else /* UIP_CONF_MAX_CONNECTIONS */
  290. #define UIP_CONNS UIP_CONF_MAX_CONNECTIONS
  291. #endif /* UIP_CONF_MAX_CONNECTIONS */
  292. /**
  293. * The maximum number of simultaneously listening TCP ports.
  294. *
  295. * Each listening TCP port requires 2 bytes of memory.
  296. *
  297. * \hideinitializer
  298. */
  299. #ifndef UIP_CONF_MAX_LISTENPORTS
  300. #define UIP_LISTENPORTS 20
  301. #else /* UIP_CONF_MAX_LISTENPORTS */
  302. #define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS
  303. #endif /* UIP_CONF_MAX_LISTENPORTS */
  304. /**
  305. * Determines if support for TCP urgent data notification should be
  306. * compiled in.
  307. *
  308. * Urgent data (out-of-band data) is a rarely used TCP feature that
  309. * very seldom would be required.
  310. *
  311. * \hideinitializer
  312. */
  313. #if !defined(UIP_URGDATA)
  314. #define UIP_URGDATA 0
  315. #endif
  316. /**
  317. * The initial retransmission timeout counted in timer pulses.
  318. *
  319. * This should not be changed.
  320. */
  321. #if !defined(UIP_RTO)
  322. #define UIP_RTO 3
  323. #endif
  324. /**
  325. * The maximum number of times a segment should be retransmitted
  326. * before the connection should be aborted.
  327. *
  328. * This should not be changed.
  329. */
  330. #if !defined(UIP_MAXRTX)
  331. #define UIP_MAXRTX 8
  332. #endif
  333. /**
  334. * The maximum number of times a SYN segment should be retransmitted
  335. * before a connection request should be deemed to have been
  336. * unsuccessful.
  337. *
  338. * This should not need to be changed.
  339. */
  340. #if !defined(UIP_MAXSYNRTX)
  341. #define UIP_MAXSYNRTX 5
  342. #endif
  343. /**
  344. * The TCP maximum segment size.
  345. *
  346. * This is should not be to set to more than
  347. * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
  348. */
  349. #ifdef UIP_CONF_TCP_MSS
  350. #define UIP_TCP_MSS UIP_CONF_TCP_MSS
  351. #else
  352. #define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
  353. #endif
  354. /**
  355. * The size of the advertised receiver's window.
  356. *
  357. * Should be set low (i.e., to the size of the uip_buf buffer) if the
  358. * application is slow to process incoming data, or high (32768 bytes)
  359. * if the application processes data quickly.
  360. *
  361. * \hideinitializer
  362. */
  363. #ifndef UIP_CONF_RECEIVE_WINDOW
  364. #define UIP_RECEIVE_WINDOW UIP_TCP_MSS
  365. #else
  366. #define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW
  367. #endif
  368. /**
  369. * How long a connection should stay in the TIME_WAIT state.
  370. *
  371. * This configuration option has no real implication, and it should be
  372. * left untouched.
  373. */
  374. #define UIP_TIME_WAIT_TIMEOUT 120
  375. /** @} */
  376. /*------------------------------------------------------------------------------*/
  377. /**
  378. * \defgroup uipoptarp ARP configuration options
  379. * @{
  380. */
  381. /**
  382. * The size of the ARP table.
  383. *
  384. * This option should be set to a larger value if this uIP node will
  385. * have many connections from the local network.
  386. *
  387. * \hideinitializer
  388. */
  389. #ifdef UIP_CONF_ARPTAB_SIZE
  390. #define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE
  391. #else
  392. #define UIP_ARPTAB_SIZE 8
  393. #endif
  394. /**
  395. * The maximum age of ARP table entries measured in 10ths of seconds.
  396. *
  397. * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
  398. * default).
  399. */
  400. #define UIP_ARP_MAXAGE 120
  401. /** @} */
  402. /*------------------------------------------------------------------------------*/
  403. /**
  404. * \defgroup uipoptmac layer 2 options (for ipv6)
  405. * @{
  406. */
  407. #define UIP_DEFAULT_PREFIX_LEN 64
  408. /** @} */
  409. /*------------------------------------------------------------------------------*/
  410. /**
  411. * \defgroup uipoptsics 6lowpan options (for ipv6)
  412. * @{
  413. */
  414. /**
  415. * Timeout for packet reassembly at the 6lowpan layer
  416. * (should be < 60s)
  417. */
  418. #ifdef SICSLOWPAN_CONF_MAXAGE
  419. #define SICSLOWPAN_REASS_MAXAGE SICSLOWPAN_CONF_MAXAGE
  420. #else
  421. #define SICSLOWPAN_REASS_MAXAGE 20
  422. #endif
  423. /**
  424. * Do we compress the IP header or not (default: no)
  425. */
  426. #ifndef SICSLOWPAN_CONF_COMPRESSION
  427. #define SICSLOWPAN_CONF_COMPRESSION 0
  428. #endif
  429. /**
  430. * If we use IPHC compression, how many address contexts do we support
  431. */
  432. #ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS
  433. #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
  434. #endif
  435. /**
  436. * Do we support 6lowpan fragmentation
  437. */
  438. #ifndef SICSLOWPAN_CONF_FRAG
  439. #define SICSLOWPAN_CONF_FRAG 0
  440. #endif
  441. /** @} */
  442. /*------------------------------------------------------------------------------*/
  443. /**
  444. * \defgroup uipoptgeneral General configuration options
  445. * @{
  446. */
  447. /**
  448. * The size of the uIP packet buffer.
  449. *
  450. * The uIP packet buffer should not be smaller than 60 bytes, and does
  451. * not need to be larger than 1514 bytes. Lower size results in lower
  452. * TCP throughput, larger size results in higher TCP throughput.
  453. *
  454. * \hideinitializer
  455. */
  456. #ifndef UIP_CONF_BUFFER_SIZE
  457. #define UIP_BUFSIZE UIP_LINK_MTU + UIP_LLH_LEN
  458. #else /* UIP_CONF_BUFFER_SIZE */
  459. #define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE
  460. #endif /* UIP_CONF_BUFFER_SIZE */
  461. /**
  462. * Determines if statistics support should be compiled in.
  463. *
  464. * The statistics is useful for debugging and to show the user.
  465. *
  466. * \hideinitializer
  467. */
  468. #ifndef UIP_CONF_STATISTICS
  469. #define UIP_STATISTICS 0
  470. #else /* UIP_CONF_STATISTICS */
  471. #define UIP_STATISTICS UIP_CONF_STATISTICS
  472. #endif /* UIP_CONF_STATISTICS */
  473. /**
  474. * Determines if logging of certain events should be compiled in.
  475. *
  476. * This is useful mostly for debugging. The function uip_log()
  477. * must be implemented to suit the architecture of the project, if
  478. * logging is turned on.
  479. *
  480. * \hideinitializer
  481. */
  482. #ifndef UIP_CONF_LOGGING
  483. #define UIP_LOGGING 0
  484. #else /* UIP_CONF_LOGGING */
  485. #define UIP_LOGGING UIP_CONF_LOGGING
  486. #endif /* UIP_CONF_LOGGING */
  487. /**
  488. * Broadcast support.
  489. *
  490. * This flag configures IP broadcast support. This is useful only
  491. * together with UDP.
  492. *
  493. * \hideinitializer
  494. *
  495. */
  496. #ifndef UIP_CONF_BROADCAST
  497. #define UIP_BROADCAST 0
  498. #else /* UIP_CONF_BROADCAST */
  499. #define UIP_BROADCAST UIP_CONF_BROADCAST
  500. #endif /* UIP_CONF_BROADCAST */
  501. /**
  502. * Print out a uIP log message.
  503. *
  504. * This function must be implemented by the module that uses uIP, and
  505. * is called by uIP whenever a log message is generated.
  506. */
  507. void uip_log(char *msg);
  508. /**
  509. * The link level header length.
  510. *
  511. * This is the offset into the uip_buf where the IP header can be
  512. * found. For Ethernet, this should be set to 14. For SLIP, this
  513. * should be set to 0.
  514. *
  515. * \note we probably won't use this constant for other link layers than
  516. * ethernet as they have variable header length (this is due to variable
  517. * number and type of address fields and to optional security features)
  518. * E.g.: 802.15.4 -> 2 + (1/2*4/8) + 0/5/6/10/14
  519. * 802.11 -> 4 + (6*3/4) + 2
  520. * \hideinitializer
  521. */
  522. #ifdef UIP_CONF_LLH_LEN
  523. #define UIP_LLH_LEN UIP_CONF_LLH_LEN
  524. #else /* UIP_LLH_LEN */
  525. #define UIP_LLH_LEN 14
  526. #endif /* UIP_CONF_LLH_LEN */
  527. /** @} */
  528. /*------------------------------------------------------------------------------*/
  529. /**
  530. * \defgroup uipoptcpu CPU architecture configuration
  531. * @{
  532. *
  533. * The CPU architecture configuration is where the endianess of the
  534. * CPU on which uIP is to be run is specified. Most CPUs today are
  535. * little endian, and the most notable exception are the Motorolas
  536. * which are big endian. The BYTE_ORDER macro should be changed to
  537. * reflect the CPU architecture on which uIP is to be run.
  538. */
  539. /**
  540. * The byte order of the CPU architecture on which uIP is to be run.
  541. *
  542. * This option can be either UIP_BIG_ENDIAN (Motorola byte order) or
  543. * UIP_LITTLE_ENDIAN (Intel byte order).
  544. *
  545. * \hideinitializer
  546. */
  547. #ifdef UIP_CONF_BYTE_ORDER
  548. #define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER
  549. #else /* UIP_CONF_BYTE_ORDER */
  550. #define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN
  551. #endif /* UIP_CONF_BYTE_ORDER */
  552. /** @} */
  553. /*------------------------------------------------------------------------------*/
  554. #include <ff.h>
  555. #include <stdbool.h>
  556. #include <stdint.h>
  557. #include "timer.h"
  558. typedef uint8_t u8_t;
  559. typedef uint16_t u16_t;
  560. typedef uint32_t u32_t;
  561. typedef uint32_t uip_stats_t;
  562. /**
  563. * \defgroup uipoptapp Application specific configurations
  564. * @{
  565. *
  566. * An uIP application is implemented using a single application
  567. * function that is called by uIP whenever a TCP/IP event occurs. The
  568. * name of this function must be registered with uIP at compile time
  569. * using the UIP_APPCALL definition.
  570. *
  571. * uIP applications can store the application state within the
  572. * uip_conn structure by specifying the type of the application
  573. * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t.
  574. *
  575. * The file containing the definitions must be included in the
  576. * uipopt.h file.
  577. *
  578. * The following example illustrates how this can look.
  579. \code
  580. void httpd_appcall(void);
  581. #define UIP_APPCALL httpd_appcall
  582. struct httpd_state {
  583. u8_t state;
  584. u16_t count;
  585. char *dataptr;
  586. char *script;
  587. };
  588. typedef struct httpd_state uip_tcp_appstate_t
  589. \endcode
  590. */
  591. #define UIP_UDP_APPCALL uIPManagement_UDPCallback
  592. void UIP_UDP_APPCALL(void);
  593. /**
  594. * \var #define UIP_APPCALL
  595. *
  596. * The name of the application function that uIP should call in
  597. * response to TCP/IP events.
  598. *
  599. */
  600. #define UIP_APPCALL uIPManagement_TCPCallback
  601. void UIP_APPCALL(void);
  602. /**
  603. * \var typedef uip_tcp_appstate_t
  604. *
  605. * The type of the application state that is to be stored in the
  606. * uip_conn structure. This usually is typedef:ed to a struct holding
  607. * application state information.
  608. */
  609. typedef union
  610. {
  611. struct
  612. {
  613. uint8_t CurrentState;
  614. uint8_t NextState;
  615. char FileName[MAX_URI_LENGTH];
  616. FIL FileHandle;
  617. bool FileOpen;
  618. uint32_t ACKedFilePos;
  619. uint16_t SentChunkSize;
  620. } HTTPServer;
  621. struct
  622. {
  623. uint8_t CurrentState;
  624. uint8_t NextState;
  625. uint8_t IssuedCommand;
  626. } TELNETServer;
  627. } uip_tcp_appstate_t;
  628. /**
  629. * \var typedef uip_udp_appstate_t
  630. *
  631. * The type of the application state that is to be stored in the
  632. * uip_conn structure. This usually is typedef:ed to a struct holding
  633. * application state information.
  634. */
  635. typedef union
  636. {
  637. struct
  638. {
  639. uint8_t CurrentState;
  640. struct timer Timeout;
  641. struct
  642. {
  643. uint8_t AllocatedIP[4];
  644. uint8_t Netmask[4];
  645. uint8_t GatewayIP[4];
  646. uint8_t ServerIP[4];
  647. } DHCPOffer_Data;
  648. } DHCPClient;
  649. } uip_udp_appstate_t;
  650. /** @} */
  651. #endif /* __UIPOPT_H__ */
  652. /** @} */
  653. /** @} */