uip.h

Go to the documentation of this file.
00001 
00019 /*
00020  * Copyright (c) 2001-2003, Adam Dunkels.
00021  * All rights reserved.
00022  *
00023  * Redistribution and use in source and binary forms, with or without
00024  * modification, are permitted provided that the following conditions
00025  * are met:
00026  * 1. Redistributions of source code must retain the above copyright
00027  *    notice, this list of conditions and the following disclaimer.
00028  * 2. Redistributions in binary form must reproduce the above copyright
00029  *    notice, this list of conditions and the following disclaimer in the
00030  *    documentation and/or other materials provided with the distribution.
00031  * 3. The name of the author may not be used to endorse or promote
00032  *    products derived from this software without specific prior
00033  *    written permission.
00034  *
00035  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
00036  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00037  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00038  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00039  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00040  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00041  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00042  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00043  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00044  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00045  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00046  *
00047  * This file is part of the uIP TCP/IP stack.
00048  *
00049  * $Id: uip.h,v 1.40 2006/06/08 07:12:07 adam Exp $
00050  *
00051  */
00052 
00053 #ifndef __UIP_H__
00054 #define __UIP_H__
00055 
00056 #include "uipopt.h"
00057 
00058 #include "../proj/cli/debug.h"
00059 #include <stdio.h>
00060 
00065 typedef u16_t uip_ip4addr_t[2];
00066 typedef u16_t uip_ip6addr_t[8];
00067 #if UIP_CONF_IPV6
00068 typedef uip_ip6addr_t uip_ipaddr_t;
00069 #else /* UIP_CONF_IPV6 */
00070 typedef uip_ip4addr_t uip_ipaddr_t;
00071 #endif /* UIP_CONF_IPV6 */
00072 
00073 /*---------------------------------------------------------------------------*/
00074 /* First, the functions that should be called from the
00075  * system. Initialization, the periodic timer and incoming packets are
00076  * handled by the following three functions.
00077  */
00078 
00109 #define uip_sethostaddr(addr) uip_ipaddr_copy(uip_hostaddr, (addr))
00110 
00129 #define uip_gethostaddr(addr) uip_ipaddr_copy((addr), uip_hostaddr)
00130 
00141 #define uip_setdraddr(addr) uip_ipaddr_copy(uip_draddr, (addr))
00142 
00153 #define uip_setnetmask(addr) uip_ipaddr_copy(uip_netmask, (addr))
00154 
00155 
00164 #define uip_getdraddr(addr) uip_ipaddr_copy((addr), uip_draddr)
00165 
00174 #define uip_getnetmask(addr) uip_ipaddr_copy((addr), uip_netmask)
00175 
00191 void uip_init(void);
00192 
00198 void uip_setipid(u16_t id);
00199 
00260 #define uip_input()        uip_process(UIP_DATA)
00261 
00304 #define uip_periodic(conn) do { uip_conn = &uip_conns[conn]; \
00305                                 uip_process(UIP_TIMER); } while (0)
00306 
00311 #define uip_conn_active(conn) (uip_conns[conn].tcpstateflags != UIP_CLOSED)
00312 
00326 #define uip_periodic_conn(conn) do { uip_conn = conn; \
00327                                      uip_process(UIP_TIMER); } while (0)
00328 
00340 #define uip_poll_conn(conn) do { uip_conn = conn; \
00341                                  uip_process(UIP_POLL_REQUEST); } while (0)
00342 
00343 
00344 #if UIP_UDP
00345 
00376 #define uip_udp_periodic(conn) do { uip_udp_conn = &uip_udp_conns[conn]; \
00377                                 uip_process(UIP_UDP_TIMER); } while (0)
00378 
00393 #define uip_udp_periodic_conn(conn) do { uip_udp_conn = conn; \
00394                                          uip_process(UIP_UDP_TIMER); } while (0)
00395 
00396 
00397 #endif /* UIP_UDP */
00398 
00425 #ifndef UIP_CONF_EXTERNAL_BUFFER
00426         extern u8_t uip_buf[UIP_BUFSIZE+2];
00427 #else
00428         extern unsigned char *uip_buf;
00429 #endif
00430 
00433 /*---------------------------------------------------------------------------*/
00434 /* Functions that are used by the uIP application program. Opening and
00435  * closing connections, sending and receiving data, etc. is all
00436  * handled by the functions below.
00437 */
00457 void uip_listen(u16_t port);
00458 
00471 void uip_unlisten(u16_t port);
00472 
00505 struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port);
00506 
00507 
00508 
00518 #define uip_outstanding(conn) ((conn)->len)
00519 
00545 void uip_send(const void *data, int len);
00546 
00556 /*void uip_datalen(void);*/
00557 #define uip_datalen()       uip_len
00558 
00568 #define uip_urgdatalen()    uip_urglen
00569 
00577 #define uip_close()         (uip_flags = UIP_CLOSE)
00578 
00588 #define uip_abort()         (uip_flags = UIP_ABORT)
00589 
00598 #define uip_stop()          (uip_conn->tcpstateflags |= UIP_STOPPED)
00599 
00606 #define uip_stopped(conn)   ((conn)->tcpstateflags & UIP_STOPPED)
00607 
00617 #define uip_restart()         do { uip_flags |= UIP_NEWDATA; \
00618                                    uip_conn->tcpstateflags &= ~UIP_STOPPED; \
00619                               } while(0)
00620 
00621 
00622 /* uIP tests that can be made to determine in what state the current
00623    connection is, and what the application function should do. */
00624 
00633 #define uip_udpconnection() (uip_conn == NULL)
00634 
00644 #define uip_newdata()   (uip_flags & UIP_NEWDATA)
00645 
00655 #define uip_acked()   (uip_flags & UIP_ACKDATA)
00656 
00667 #define uip_connected() (uip_flags & UIP_CONNECTED)
00668 
00677 #define uip_closed()    (uip_flags & UIP_CLOSE)
00678 
00687 #define uip_aborted()    (uip_flags & UIP_ABORT)
00688 
00697 #define uip_timedout()    (uip_flags & UIP_TIMEDOUT)
00698 
00709 #define uip_rexmit()     (uip_flags & UIP_REXMIT)
00710 
00723 #define uip_poll()       (uip_flags & UIP_POLL)
00724 
00731 #define uip_initialmss()             (uip_conn->initialmss)
00732 
00744 #define uip_mss()             (uip_conn->mss)
00745 
00773 struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport);
00774 
00782 #define uip_udp_remove(conn) (conn)->lport = 0
00783 
00794 #define uip_udp_bind(conn, port) (conn)->lport = port
00795 
00807 #define uip_udp_send(len) uip_send((char *)uip_appdata, len)
00808 
00811 /* uIP convenience and converting functions. */
00812 
00847 #define uip_ipaddr(addr, addr0,addr1,addr2,addr3) do { \
00848                      ((u16_t *)(addr))[0] = HTONS(((addr0) << 8) | (addr1)); \
00849                      ((u16_t *)(addr))[1] = HTONS(((addr2) << 8) | (addr3)); \
00850                   } while(0)
00851 
00859 #define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \
00860                      ((u16_t *)(addr))[0] = HTONS((addr0)); \
00861                      ((u16_t *)(addr))[1] = HTONS((addr1)); \
00862                      ((u16_t *)(addr))[2] = HTONS((addr2)); \
00863                      ((u16_t *)(addr))[3] = HTONS((addr3)); \
00864                      ((u16_t *)(addr))[4] = HTONS((addr4)); \
00865                      ((u16_t *)(addr))[5] = HTONS((addr5)); \
00866                      ((u16_t *)(addr))[6] = HTONS((addr6)); \
00867                      ((u16_t *)(addr))[7] = HTONS((addr7)); \
00868                   } while(0)
00869 
00888 #if !UIP_CONF_IPV6
00889 #define uip_ipaddr_copy(dest, src) do { \
00890                      ((u16_t *)dest)[0] = ((u16_t *)src)[0]; \
00891                      ((u16_t *)dest)[1] = ((u16_t *)src)[1]; \
00892                   } while(0)
00893 #else /* !UIP_CONF_IPV6 */
00894 #define uip_ipaddr_copy(dest, src) memcpy(dest, src, sizeof(uip_ip6addr_t))
00895 #endif /* !UIP_CONF_IPV6 */
00896 
00917 #if !UIP_CONF_IPV6
00918 #define uip_ipaddr_cmp(addr1, addr2) (((u16_t *)addr1)[0] == ((u16_t *)addr2)[0] && \
00919                                       ((u16_t *)addr1)[1] == ((u16_t *)addr2)[1])
00920 #else /* !UIP_CONF_IPV6 */
00921 #define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
00922 #endif /* !UIP_CONF_IPV6 */
00923 
00948 #define uip_ipaddr_maskcmp(addr1, addr2, mask) \
00949                           (((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \
00950                             (((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \
00951                            ((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \
00952                             (((u16_t *)addr2)[1] & ((u16_t *)mask)[1])))
00953 
00954 
00979 #define uip_ipaddr_mask(dest, src, mask) do { \
00980                      ((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \
00981                      ((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \
00982                   } while(0)
00983 
01002 #define uip_ipaddr1(addr) (htons(((u16_t *)(addr))[0]) >> 8)
01003 
01022 #define uip_ipaddr2(addr) (htons(((u16_t *)(addr))[0]) & 0xff)
01023 
01042 #define uip_ipaddr3(addr) (htons(((u16_t *)(addr))[1]) >> 8)
01043 
01062 #define uip_ipaddr4(addr) (htons(((u16_t *)(addr))[1]) & 0xff)
01063 
01073 #ifndef HTONS
01074 #   if UIP_BYTE_ORDER == UIP_BIG_ENDIAN
01075 #      define HTONS(n) (n)
01076 #   else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
01077 #      define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
01078 #   endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
01079 #else
01080 #error "HTONS already defined!"
01081 #endif /* HTONS */
01082 
01090 #ifndef htons
01091 u16_t htons(u16_t val);
01092 #endif /* htons */
01093 #ifndef ntohs
01094 #define ntohs htons
01095 #endif
01096 
01106 extern void *uip_appdata;
01107 
01108 #if UIP_URGDATA > 0
01109 /* u8_t *uip_urgdata:
01110  *
01111  * This pointer points to any urgent data that has been received. Only
01112  * present if compiled with support for urgent data (UIP_URGDATA).
01113  */
01114 extern void *uip_urgdata;
01115 #endif /* UIP_URGDATA > 0 */
01116 
01117 
01141 extern u16_t uip_len;
01142 
01145 #if UIP_URGDATA > 0
01146 extern u16_t uip_urglen, uip_surglen;
01147 #endif /* UIP_URGDATA > 0 */
01148 
01149 
01160 struct uip_conn {
01161   uip_ipaddr_t ripaddr;   
01163   u16_t lport;        
01164   u16_t rport;        
01167   u8_t rcv_nxt[4];    
01169   u8_t snd_nxt[4];    
01171   u16_t len;          
01172   u16_t mss;          
01174   u16_t initialmss;   
01176   u8_t sa;            
01178   u8_t sv;            
01180   u8_t rto;           
01181   u8_t tcpstateflags; 
01182   u8_t timer;         
01183   u8_t nrtx;          
01187   uip_tcp_appstate_t appstate;
01188 };
01189 
01190 
01197 extern struct uip_conn *uip_conn;
01198 /* The array containing all uIP connections. */
01199 extern struct uip_conn uip_conns[UIP_CONNS];
01208 extern u8_t uip_acc32[4];
01209 
01213 #if UIP_UDP
01214 
01217 struct uip_udp_conn {
01218   uip_ipaddr_t ripaddr;   
01219   u16_t lport;        
01220   u16_t rport;        
01221   u8_t  ttl;          
01224   uip_udp_appstate_t appstate;
01225 };
01226 
01230 extern struct uip_udp_conn *uip_udp_conn;
01231 extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
01232 #endif /* UIP_UDP */
01233 
01239 struct uip_stats {
01240   struct {
01241     uip_stats_t drop;     
01243     uip_stats_t recv;     
01245     uip_stats_t sent;     
01247     uip_stats_t vhlerr;   
01249     uip_stats_t hblenerr; 
01251     uip_stats_t lblenerr; 
01253     uip_stats_t fragerr;  
01255     uip_stats_t chkerr;   
01257     uip_stats_t protoerr; 
01259   } ip;                   
01260   struct {
01261     uip_stats_t drop;     
01262     uip_stats_t recv;     
01263     uip_stats_t sent;     
01264     uip_stats_t typeerr;  
01266   } icmp;                 
01267   struct {
01268     uip_stats_t drop;     
01269     uip_stats_t recv;     
01270     uip_stats_t sent;     
01271     uip_stats_t chkerr;   
01273     uip_stats_t ackerr;   
01275     uip_stats_t rst;      
01276     uip_stats_t rexmit;   
01277     uip_stats_t syndrop;  
01279     uip_stats_t synrst;   
01281   } tcp;                  
01282 #if UIP_UDP
01283   struct {
01284     uip_stats_t drop;     
01285     uip_stats_t recv;     
01286     uip_stats_t sent;     
01287     uip_stats_t chkerr;   
01289   } udp;                  
01290 #endif /* UIP_UDP */
01291 };
01292 
01298 extern struct uip_stats uip_stat;
01299 
01300 
01301 /*---------------------------------------------------------------------------*/
01302 /* All the stuff below this point is internal to uIP and should not be
01303  * used directly by an application or by a device driver.
01304  */
01305 /*---------------------------------------------------------------------------*/
01306 /* u8_t uip_flags:
01307  *
01308  * When the application is called, uip_flags will contain the flags
01309  * that are defined in this file. Please read below for more
01310  * infomation.
01311  */
01312 extern u8_t uip_flags;
01313 
01314 /* The following flags may be set in the global variable uip_flags
01315    before calling the application callback. The UIP_ACKDATA,
01316    UIP_NEWDATA, and UIP_CLOSE flags may both be set at the same time,
01317    whereas the others are mutualy exclusive. Note that these flags
01318    should *NOT* be accessed directly, but only through the uIP
01319    functions/macros. */
01320 
01321 #define UIP_ACKDATA   1     /* Signifies that the outstanding data was
01322                                acked and the application should send
01323                                out new data instead of retransmitting
01324                                the last data. */
01325 #define UIP_NEWDATA   2     /* Flags the fact that the peer has sent
01326                                us new data. */
01327 #define UIP_REXMIT    4     /* Tells the application to retransmit the
01328                                data that was last sent. */
01329 #define UIP_POLL      8     /* Used for polling the application, to
01330                                check if the application has data that
01331                                it wants to send. */
01332 #define UIP_CLOSE     16    /* The remote host has closed the
01333                                connection, thus the connection has
01334                                gone away. Or the application signals
01335                                that it wants to close the
01336                                connection. */
01337 #define UIP_ABORT     32    /* The remote host has aborted the
01338                                connection, thus the connection has
01339                                gone away. Or the application signals
01340                                that it wants to abort the
01341                                connection. */
01342 #define UIP_CONNECTED 64    /* We have got a connection from a remote
01343                                host and have set up a new connection
01344                                for it, or an active connection has
01345                                been successfully established. */
01346 
01347 #define UIP_TIMEDOUT  128   /* The connection has been aborted due to
01348                                too many retransmissions. */
01349 
01350 /* uip_process(flag):
01351  *
01352  * The actual uIP function which does all the work.
01353  */
01354 void uip_process(u8_t flag);
01355 
01356 /* The following flags are passed as an argument to the uip_process()
01357    function. They are used to distinguish between the two cases where
01358    uip_process() is called. It can be called either because we have
01359    incoming data that should be processed, or because the periodic
01360    timer has fired. These values are never used directly, but only in
01361    the macrose defined in this file. */
01362 
01363 #define UIP_DATA          1     /* Tells uIP that there is incoming
01364                                    data in the uip_buf buffer. The
01365                                    length of the data is stored in the
01366                                    global variable uip_len. */
01367 #define UIP_TIMER         2     /* Tells uIP that the periodic timer
01368                                    has fired. */
01369 #define UIP_POLL_REQUEST  3     /* Tells uIP that a connection should
01370                                    be polled. */
01371 #define UIP_UDP_SEND_CONN 4     /* Tells uIP that a UDP datagram
01372                                    should be constructed in the
01373                                    uip_buf buffer. */
01374 #if UIP_UDP
01375 #define UIP_UDP_TIMER     5
01376 #endif /* UIP_UDP */
01377 
01378 /* The TCP states used in the uip_conn->tcpstateflags. */
01379 #define UIP_CLOSED      0
01380 #define UIP_SYN_RCVD    1
01381 #define UIP_SYN_SENT    2
01382 #define UIP_ESTABLISHED 3
01383 #define UIP_FIN_WAIT_1  4
01384 #define UIP_FIN_WAIT_2  5
01385 #define UIP_CLOSING     6
01386 #define UIP_TIME_WAIT   7
01387 #define UIP_LAST_ACK    8
01388 #define UIP_TS_MASK     15
01389 
01390 #define UIP_STOPPED      16
01391 
01392 /* The TCP and IP headers. */
01393 
01394 #ifdef __ICCARM__
01395         #pragma pack(1)
01396 #endif
01397 
01398 struct uip_tcpip_hdr {
01399 #if UIP_CONF_IPV6
01400   /* IPv6 header. */
01401   u8_t vtc,
01402     tcflow;
01403   u16_t flow;
01404   u8_t len[2];
01405   u8_t proto, ttl;
01406   uip_ip6addr_t srcipaddr, destipaddr;
01407 #else /* UIP_CONF_IPV6 */
01408   /* IPv4 header. */
01409   u8_t vhl,
01410     tos,
01411     len[2],
01412     ipid[2],
01413     ipoffset[2],
01414     ttl,
01415     proto;
01416   u16_t ipchksum;
01417   u16_t srcipaddr[2],
01418     destipaddr[2];
01419 #endif /* UIP_CONF_IPV6 */
01420 
01421   /* TCP header. */
01422   u16_t srcport,
01423     destport;
01424   u8_t seqno[4],
01425     ackno[4],
01426     tcpoffset,
01427     flags,
01428     wnd[2];
01429   u16_t tcpchksum;
01430   u8_t urgp[2];
01431   u8_t optdata[4];
01432 } PACK_STRUCT_END;
01433 
01434 #ifdef __ICCARM__
01435         #pragma pack()
01436 #endif
01437 
01438 /* The ICMP and IP headers. */
01439 #ifdef __ICCARM__
01440         #pragma pack(1)
01441 #endif
01442 
01443 struct uip_icmpip_hdr {
01444 #if UIP_CONF_IPV6
01445   /* IPv6 header. */
01446   u8_t vtc,
01447     tcf;
01448   u16_t flow;
01449   u8_t len[2];
01450   u8_t proto, ttl;
01451   uip_ip6addr_t srcipaddr, destipaddr;
01452 #else /* UIP_CONF_IPV6 */
01453   /* IPv4 header. */
01454   u8_t vhl,
01455     tos,
01456     len[2],
01457     ipid[2],
01458     ipoffset[2],
01459     ttl,
01460     proto;
01461   u16_t ipchksum;
01462   u16_t srcipaddr[2],
01463     destipaddr[2];
01464 #endif /* UIP_CONF_IPV6 */
01465 
01466   /* ICMP (echo) header. */
01467   u8_t type, icode;
01468   u16_t icmpchksum;
01469 #if !UIP_CONF_IPV6
01470   u16_t id, seqno;
01471 #else /* !UIP_CONF_IPV6 */
01472   u8_t flags, reserved1, reserved2, reserved3;
01473   u8_t icmp6data[16];
01474   u8_t options[1];
01475 #endif /* !UIP_CONF_IPV6 */
01476 } PACK_STRUCT_END;
01477 
01478 #ifdef __ICCARM__
01479         #pragma pack()
01480 #endif
01481 
01482 
01483 /* The UDP and IP headers. */
01484 #ifdef __ICCARM__
01485         #pragma pack(1)
01486 #endif
01487 
01488 struct uip_udpip_hdr {
01489 #if UIP_CONF_IPV6
01490   /* IPv6 header. */
01491   u8_t vtc,
01492     tcf;
01493   u16_t flow;
01494   u8_t len[2];
01495   u8_t proto, ttl;
01496   uip_ip6addr_t srcipaddr, destipaddr;
01497 #else /* UIP_CONF_IPV6 */
01498   /* IP header. */
01499   u8_t vhl,
01500     tos,
01501     len[2],
01502     ipid[2],
01503     ipoffset[2],
01504     ttl,
01505     proto;
01506   u16_t ipchksum;
01507   u16_t srcipaddr[2],
01508     destipaddr[2];
01509 #endif /* UIP_CONF_IPV6 */
01510 
01511   /* UDP header. */
01512   u16_t srcport,
01513     destport;
01514   u16_t udplen;
01515   u16_t udpchksum;
01516 } PACK_STRUCT_END;
01517 
01518 #ifdef __ICCARM__
01519         #pragma pack()
01520 #endif
01521 
01522 
01523 
01538 #define UIP_APPDATA_SIZE (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
01539 
01540 
01541 #define UIP_PROTO_ICMP  1
01542 #define UIP_PROTO_TCP   6
01543 #define UIP_PROTO_UDP   17
01544 #define UIP_PROTO_ICMP6 58
01545 
01546 /* Header sizes. */
01547 #if UIP_CONF_IPV6
01548 #define UIP_IPH_LEN    40
01549 #else /* UIP_CONF_IPV6 */
01550 #define UIP_IPH_LEN    20    /* Size of IP header */
01551 #endif /* UIP_CONF_IPV6 */
01552 #define UIP_UDPH_LEN    8    /* Size of UDP header */
01553 #define UIP_TCPH_LEN   20    /* Size of TCP header */
01554 #define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN)    /* Size of IP +
01555                                                           UDP
01556                                                           header */
01557 #define UIP_IPTCPH_LEN (UIP_TCPH_LEN + UIP_IPH_LEN)    /* Size of IP +
01558                                                           TCP
01559                                                           header */
01560 #define UIP_TCPIP_HLEN UIP_IPTCPH_LEN
01561 
01562 
01563 #if UIP_FIXEDADDR
01564 extern const uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;
01565 #else /* UIP_FIXEDADDR */
01566 extern uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;
01567 #endif /* UIP_FIXEDADDR */
01568 
01569 
01570 
01574 #ifdef __ICCARM__
01575         #pragma pack(1)
01576 #endif
01577 
01578 struct uip_eth_addr {
01579   u8_t addr[6];
01580 } PACK_STRUCT_END;
01581 
01582 #ifdef __ICCARM__
01583         #pragma pack()
01584 #endif
01585 
01602 u16_t uip_chksum(u16_t *buf, u16_t len);
01603 
01613 u16_t uip_ipchksum(void);
01614 
01624 u16_t uip_tcpchksum(void);
01625 
01635 u16_t uip_udpchksum(void);
01636 
01637 
01638 #endif /* __UIP_H__ */
01639 
01640