These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers uipopt.h Source File

uipopt.h

Go to the documentation of this file.
00001 /** @addtogroup EMAC_uIP
00002  * @{
00003  */
00004 
00005 /**
00006  * \defgroup uipopt Configuration options for uIP
00007  * @{
00008  *
00009  * uIP is configured using the per-project configuration file
00010  * uipopt.h. This file contains all compile-time options for uIP and
00011  * should be tweaked to match each specific project. The uIP
00012  * distribution contains a documented example "uipopt.h" that can be
00013  * copied and modified for each project.
00014  *
00015  * \note Most of the configuration options in the uipopt.h should not
00016  * be changed, but rather the per-project uip-conf.h file.
00017  */
00018 
00019 /**
00020  * \file
00021  * Configuration options for uIP.
00022  * \author Adam Dunkels <adam@dunkels.com>
00023  *
00024  * This file is used for tweaking various configuration options for
00025  * uIP. You should make a copy of this file into one of your project's
00026  * directories instead of editing this example "uipopt.h" file that
00027  * comes with the uIP distribution.
00028  */
00029 
00030 /*
00031  * Copyright (c) 2001-2003, Adam Dunkels.
00032  * All rights reserved.
00033  *
00034  * Redistribution and use in source and binary forms, with or without
00035  * modification, are permitted provided that the following conditions
00036  * are met:
00037  * 1. Redistributions of source code must retain the above copyright
00038  *    notice, this list of conditions and the following disclaimer.
00039  * 2. Redistributions in binary form must reproduce the above copyright
00040  *    notice, this list of conditions and the following disclaimer in the
00041  *    documentation and/or other materials provided with the distribution.
00042  * 3. The name of the author may not be used to endorse or promote
00043  *    products derived from this software without specific prior
00044  *    written permission.
00045  *
00046  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
00047  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00048  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00049  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00050  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00051  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00052  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00053  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00054  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00055  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00056  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00057  *
00058  * This file is part of the uIP TCP/IP stack.
00059  *
00060  * $Id: uipopt.h,v 1.4 2006/06/12 08:00:31 adam Exp $
00061  *
00062  */
00063 
00064 #ifndef __UIPOPT_H__
00065 #define __UIPOPT_H__
00066 
00067 #ifndef UIP_LITTLE_ENDIAN
00068 #define UIP_LITTLE_ENDIAN  3412
00069 #endif /* UIP_LITTLE_ENDIAN */
00070 #ifndef UIP_BIG_ENDIAN
00071 #define UIP_BIG_ENDIAN     1234
00072 #endif /* UIP_BIG_ENDIAN */
00073 
00074 #include "uip-conf.h"
00075 
00076 /*------------------------------------------------------------------------------*/
00077 
00078 /**
00079  * \name Static configuration options
00080  * @{
00081  *
00082  * These configuration options can be used for setting the IP address
00083  * settings statically, but only if UIP_FIXEDADDR is set to 1. The
00084  * configuration options for a specific node includes IP address,
00085  * netmask and default router as well as the Ethernet address. The
00086  * netmask, default router and Ethernet address are appliciable only
00087  * if uIP should be run over Ethernet.
00088  *
00089  * All of these should be changed to suit your project.
00090 */
00091 
00092 /**
00093  * Determines if uIP should use a fixed IP address or not.
00094  *
00095  * If uIP should use a fixed IP address, the settings are set in the
00096  * uipopt.h file. If not, the macros uip_sethostaddr(),
00097  * uip_setdraddr() and uip_setnetmask() should be used instead.
00098  *
00099  * \hideinitializer
00100  */
00101 #define UIP_FIXEDADDR    0
00102 
00103 /**
00104  * Ping IP address asignment.
00105  *
00106  * uIP uses a "ping" packets for setting its own IP address if this
00107  * option is set. If so, uIP will start with an empty IP address and
00108  * the destination IP address of the first incoming "ping" (ICMP echo)
00109  * packet will be used for setting the hosts IP address.
00110  *
00111  * \note This works only if UIP_FIXEDADDR is 0.
00112  *
00113  * \hideinitializer
00114  */
00115 #ifdef UIP_CONF_PINGADDRCONF
00116 #define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF
00117 #else /* UIP_CONF_PINGADDRCONF */
00118 #define UIP_PINGADDRCONF 0
00119 #endif /* UIP_CONF_PINGADDRCONF */
00120 
00121 
00122 /**
00123  * Specifies if the uIP ARP module should be compiled with a fixed
00124  * Ethernet MAC address or not.
00125  *
00126  * If this configuration option is 0, the macro uip_setethaddr() can
00127  * be used to specify the Ethernet address at run-time.
00128  *
00129  * \hideinitializer
00130  */
00131 #define UIP_FIXEDETHADDR 0
00132 
00133 /** @} */
00134 /*------------------------------------------------------------------------------*/
00135 /**
00136  * \name IP configuration options
00137  * @{
00138  *
00139  */
00140 /**
00141  * The IP TTL (time to live) of IP packets sent by uIP.
00142  *
00143  * This should normally not be changed.
00144  */
00145 #define UIP_TTL         64
00146 
00147 /**
00148  * Turn on support for IP packet reassembly.
00149  *
00150  * uIP supports reassembly of fragmented IP packets. This features
00151  * requires an additonal amount of RAM to hold the reassembly buffer
00152  * and the reassembly code size is approximately 700 bytes.  The
00153  * reassembly buffer is of the same size as the uip_buf buffer
00154  * (configured by UIP_BUFSIZE).
00155  *
00156  * \note IP packet reassembly is not heavily tested.
00157  *
00158  * \hideinitializer
00159  */
00160 #define UIP_REASSEMBLY 0
00161 
00162 /**
00163  * The maximum time an IP fragment should wait in the reassembly
00164  * buffer before it is dropped.
00165  *
00166  */
00167 #define UIP_REASS_MAXAGE 40
00168 
00169 /** @} */
00170 
00171 /*------------------------------------------------------------------------------*/
00172 /**
00173  * \name UDP configuration options
00174  * @{
00175  */
00176 
00177 /**
00178  * Toggles wether UDP support should be compiled in or not.
00179  *
00180  * \hideinitializer
00181  */
00182 #ifdef UIP_CONF_UDP
00183 #define UIP_UDP UIP_CONF_UDP
00184 #else /* UIP_CONF_UDP */
00185 #define UIP_UDP           0
00186 #endif /* UIP_CONF_UDP */
00187 
00188 /**
00189  * Toggles if UDP checksums should be used or not.
00190  *
00191  * \note Support for UDP checksums is currently not included in uIP,
00192  * so this option has no function.
00193  *
00194  * \hideinitializer
00195  */
00196 #ifdef UIP_CONF_UDP_CHECKSUMS
00197 #define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS
00198 #else
00199 #define UIP_UDP_CHECKSUMS 0
00200 #endif
00201 
00202 /**
00203  * The maximum amount of concurrent UDP connections.
00204  *
00205  * \hideinitializer
00206  */
00207 #ifdef UIP_CONF_UDP_CONNS
00208 #define UIP_UDP_CONNS UIP_CONF_UDP_CONNS
00209 #else /* UIP_CONF_UDP_CONNS */
00210 #define UIP_UDP_CONNS    10
00211 #endif /* UIP_CONF_UDP_CONNS */
00212 
00213 /**
00214  * The name of the function that should be called when UDP datagrams arrive.
00215  *
00216  * \hideinitializer
00217  */
00218 
00219 
00220 /** @} */
00221 /*------------------------------------------------------------------------------*/
00222 /**
00223  * \name TCP configuration options
00224  * @{
00225  */
00226 
00227 /**
00228  * Determines if support for opening connections from uIP should be
00229  * compiled in.
00230  *
00231  * If the applications that are running on top of uIP for this project
00232  * do not need to open outgoing TCP connections, this configration
00233  * option can be turned off to reduce the code size of uIP.
00234  *
00235  * \hideinitializer
00236  */
00237 #define UIP_ACTIVE_OPEN 1
00238 
00239 /**
00240  * The maximum number of simultaneously open TCP connections.
00241  *
00242  * Since the TCP connections are statically allocated, turning this
00243  * configuration knob down results in less RAM used. Each TCP
00244  * connection requires approximatly 30 bytes of memory.
00245  *
00246  * \hideinitializer
00247  */
00248 #ifndef UIP_CONF_MAX_CONNECTIONS
00249 #define UIP_CONNS       10
00250 #else /* UIP_CONF_MAX_CONNECTIONS */
00251 #define UIP_CONNS UIP_CONF_MAX_CONNECTIONS
00252 #endif /* UIP_CONF_MAX_CONNECTIONS */
00253 
00254 
00255 /**
00256  * The maximum number of simultaneously listening TCP ports.
00257  *
00258  * Each listening TCP port requires 2 bytes of memory.
00259  *
00260  * \hideinitializer
00261  */
00262 #ifndef UIP_CONF_MAX_LISTENPORTS
00263 #define UIP_LISTENPORTS 20
00264 #else /* UIP_CONF_MAX_LISTENPORTS */
00265 #define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS
00266 #endif /* UIP_CONF_MAX_LISTENPORTS */
00267 
00268 /**
00269  * Determines if support for TCP urgent data notification should be
00270  * compiled in.
00271  *
00272  * Urgent data (out-of-band data) is a rarely used TCP feature that
00273  * very seldom would be required.
00274  *
00275  * \hideinitializer
00276  */
00277 #define UIP_URGDATA      0
00278 
00279 /**
00280  * The initial retransmission timeout counted in timer pulses.
00281  *
00282  * This should not be changed.
00283  */
00284 #define UIP_RTO         3
00285 
00286 /**
00287  * The maximum number of times a segment should be retransmitted
00288  * before the connection should be aborted.
00289  *
00290  * This should not be changed.
00291  */
00292 #define UIP_MAXRTX      8
00293 
00294 /**
00295  * The maximum number of times a SYN segment should be retransmitted
00296  * before a connection request should be deemed to have been
00297  * unsuccessful.
00298  *
00299  * This should not need to be changed.
00300  */
00301 #define UIP_MAXSYNRTX      5
00302 
00303 /**
00304  * The TCP maximum segment size.
00305  *
00306  * This is should not be to set to more than
00307  * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
00308  */
00309 #define UIP_TCP_MSS     (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
00310 
00311 /**
00312  * The size of the advertised receiver's window.
00313  *
00314  * Should be set low (i.e., to the size of the uip_buf buffer) is the
00315  * application is slow to process incoming data, or high (32768 bytes)
00316  * if the application processes data quickly.
00317  *
00318  * \hideinitializer
00319  */
00320 #ifndef UIP_CONF_RECEIVE_WINDOW
00321 #define UIP_RECEIVE_WINDOW UIP_TCP_MSS
00322 #else
00323 #define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW
00324 #endif
00325 
00326 /**
00327  * How long a connection should stay in the TIME_WAIT state.
00328  *
00329  * This configiration option has no real implication, and it should be
00330  * left untouched.
00331  */
00332 #define UIP_TIME_WAIT_TIMEOUT 120
00333 
00334 
00335 /** @} */
00336 /*------------------------------------------------------------------------------*/
00337 /**
00338  * \name ARP configuration options
00339  * @{
00340  */
00341 
00342 /**
00343  * The size of the ARP table.
00344  *
00345  * This option should be set to a larger value if this uIP node will
00346  * have many connections from the local network.
00347  *
00348  * \hideinitializer
00349  */
00350 #ifdef UIP_CONF_ARPTAB_SIZE
00351 #define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE
00352 #else
00353 #define UIP_ARPTAB_SIZE 8
00354 #endif
00355 
00356 /**
00357  * The maxium age of ARP table entries measured in 10ths of seconds.
00358  *
00359  * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
00360  * default).
00361  */
00362 #define UIP_ARP_MAXAGE 120
00363 
00364 /** @} */
00365 
00366 /*------------------------------------------------------------------------------*/
00367 
00368 /**
00369  * \name General configuration options
00370  * @{
00371  */
00372 
00373 /**
00374  * The size of the uIP packet buffer.
00375  *
00376  * The uIP packet buffer should not be smaller than 60 bytes, and does
00377  * not need to be larger than 1500 bytes. Lower size results in lower
00378  * TCP throughput, larger size results in higher TCP throughput.
00379  *
00380  * \hideinitializer
00381  */
00382 #ifndef UIP_CONF_BUFFER_SIZE
00383 #define UIP_BUFSIZE     1500
00384 #else /* UIP_CONF_BUFFER_SIZE */
00385 #define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE
00386 #endif /* UIP_CONF_BUFFER_SIZE */
00387 
00388 
00389 /**
00390  * Determines if statistics support should be compiled in.
00391  *
00392  * The statistics is useful for debugging and to show the user.
00393  *
00394  * \hideinitializer
00395  */
00396 #ifndef UIP_CONF_STATISTICS
00397 #define UIP_STATISTICS  0
00398 #else /* UIP_CONF_STATISTICS */
00399 #define UIP_STATISTICS UIP_CONF_STATISTICS
00400 #endif /* UIP_CONF_STATISTICS */
00401 
00402 /**
00403  * Determines if logging of certain events should be compiled in.
00404  *
00405  * This is useful mostly for debugging. The function uip_log()
00406  * must be implemented to suit the architecture of the project, if
00407  * logging is turned on.
00408  *
00409  * \hideinitializer
00410  */
00411 #ifndef UIP_CONF_LOGGING
00412 #define UIP_LOGGING     0
00413 #else /* UIP_CONF_LOGGING */
00414 #define UIP_LOGGING     UIP_CONF_LOGGING
00415 #endif /* UIP_CONF_LOGGING */
00416 
00417 /**
00418  * Broadcast support.
00419  *
00420  * This flag configures IP broadcast support. This is useful only
00421  * together with UDP.
00422  *
00423  * \hideinitializer
00424  *
00425  */
00426 #ifndef UIP_CONF_BROADCAST
00427 #define UIP_BROADCAST 0
00428 #else /* UIP_CONF_BROADCAST */
00429 #define UIP_BROADCAST UIP_CONF_BROADCAST
00430 #endif /* UIP_CONF_BROADCAST */
00431 
00432 /**
00433  * Print out a uIP log message.
00434  *
00435  * This function must be implemented by the module that uses uIP, and
00436  * is called by uIP whenever a log message is generated.
00437  */
00438 void uip_log(char *msg);
00439 
00440 /**
00441  * The link level header length.
00442  *
00443  * This is the offset into the uip_buf where the IP header can be
00444  * found. For Ethernet, this should be set to 14. For SLIP, this
00445  * should be set to 0.
00446  *
00447  * \hideinitializer
00448  */
00449 #ifdef UIP_CONF_LLH_LEN
00450 #define UIP_LLH_LEN UIP_CONF_LLH_LEN
00451 #else /* UIP_CONF_LLH_LEN */
00452 #define UIP_LLH_LEN     14
00453 #endif /* UIP_CONF_LLH_LEN */
00454 
00455 /** @} */
00456 /*------------------------------------------------------------------------------*/
00457 /**
00458  * \name CPU architecture configuration
00459  * @{
00460  *
00461  * The CPU architecture configuration is where the endianess of the
00462  * CPU on which uIP is to be run is specified. Most CPUs today are
00463  * little endian, and the most notable exception are the Motorolas
00464  * which are big endian. The BYTE_ORDER macro should be changed to
00465  * reflect the CPU architecture on which uIP is to be run.
00466  */
00467 
00468 /**
00469  * The byte order of the CPU architecture on which uIP is to be run.
00470  *
00471  * This option can be either BIG_ENDIAN (Motorola byte order) or
00472  * LITTLE_ENDIAN (Intel byte order).
00473  *
00474  * \hideinitializer
00475  */
00476 #ifdef UIP_CONF_BYTE_ORDER
00477 #define UIP_BYTE_ORDER     UIP_CONF_BYTE_ORDER
00478 #else /* UIP_CONF_BYTE_ORDER */
00479 #define UIP_BYTE_ORDER     UIP_LITTLE_ENDIAN
00480 #endif /* UIP_CONF_BYTE_ORDER */
00481 
00482 /** @} */
00483 /*------------------------------------------------------------------------------*/
00484 
00485 /**
00486  * \name Appication specific configurations
00487  * @{
00488  *
00489  * An uIP application is implemented using a single application
00490  * function that is called by uIP whenever a TCP/IP event occurs. The
00491  * name of this function must be registered with uIP at compile time
00492  * using the UIP_APPCALL definition.
00493  *
00494  * uIP applications can store the application state within the
00495  * uip_conn structure by specifying the type of the application
00496  * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t.
00497  *
00498  * The file containing the definitions must be included in the
00499  * uipopt.h file.
00500  *
00501  * The following example illustrates how this can look.
00502  \code
00503 
00504 void httpd_appcall(void);
00505 #define UIP_APPCALL     httpd_appcall
00506 
00507 struct httpd_state {
00508   u8_t state;
00509   u16_t count;
00510   char *dataptr;
00511   char *script;
00512 };
00513 typedef struct httpd_state uip_tcp_appstate_t
00514  \endcode
00515  */
00516 
00517 /**
00518  * \var #define UIP_APPCALL
00519  *
00520  * The name of the application function that uIP should call in
00521  * response to TCP/IP events.
00522  *
00523  */
00524 
00525 /**
00526  * \var typedef uip_tcp_appstate_t
00527  *
00528  * The type of the application state that is to be stored in the
00529  * uip_conn structure. This usually is typedef:ed to a struct holding
00530  * application state information.
00531  */
00532 
00533 /**
00534  * \var typedef uip_udp_appstate_t
00535  *
00536  * The type of the application state that is to be stored in the
00537  * uip_conn structure. This usually is typedef:ed to a struct holding
00538  * application state information.
00539  */
00540 /** @} */
00541 /** @} */
00542 
00543 #endif /* __UIPOPT_H__ */