Example self-announcing webserver which controls a servo through a smallHTML userinterface.

Dependencies:   mbed

Committer:
dirkx
Date:
Sat Aug 14 15:56:01 2010 +0000
Revision:
0:a259777c45a3

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dirkx 0:a259777c45a3 1 /*
dirkx 0:a259777c45a3 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
dirkx 0:a259777c45a3 3 * All rights reserved.
dirkx 0:a259777c45a3 4 *
dirkx 0:a259777c45a3 5 * Redistribution and use in source and binary forms, with or without modification,
dirkx 0:a259777c45a3 6 * are permitted provided that the following conditions are met:
dirkx 0:a259777c45a3 7 *
dirkx 0:a259777c45a3 8 * 1. Redistributions of source code must retain the above copyright notice,
dirkx 0:a259777c45a3 9 * this list of conditions and the following disclaimer.
dirkx 0:a259777c45a3 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
dirkx 0:a259777c45a3 11 * this list of conditions and the following disclaimer in the documentation
dirkx 0:a259777c45a3 12 * and/or other materials provided with the distribution.
dirkx 0:a259777c45a3 13 * 3. The name of the author may not be used to endorse or promote products
dirkx 0:a259777c45a3 14 * derived from this software without specific prior written permission.
dirkx 0:a259777c45a3 15 *
dirkx 0:a259777c45a3 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
dirkx 0:a259777c45a3 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
dirkx 0:a259777c45a3 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
dirkx 0:a259777c45a3 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
dirkx 0:a259777c45a3 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
dirkx 0:a259777c45a3 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
dirkx 0:a259777c45a3 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
dirkx 0:a259777c45a3 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
dirkx 0:a259777c45a3 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
dirkx 0:a259777c45a3 25 * OF SUCH DAMAGE.
dirkx 0:a259777c45a3 26 *
dirkx 0:a259777c45a3 27 * This file is part of the lwIP TCP/IP stack.
dirkx 0:a259777c45a3 28 *
dirkx 0:a259777c45a3 29 * Author: Adam Dunkels <adam@sics.se>
dirkx 0:a259777c45a3 30 *
dirkx 0:a259777c45a3 31 */
dirkx 0:a259777c45a3 32 #ifndef __LWIP_INET_CHKSUM_H__
dirkx 0:a259777c45a3 33 #define __LWIP_INET_CHKSUM_H__
dirkx 0:a259777c45a3 34
dirkx 0:a259777c45a3 35 #include "lwip/opt.h"
dirkx 0:a259777c45a3 36
dirkx 0:a259777c45a3 37 #include "lwip/pbuf.h"
dirkx 0:a259777c45a3 38 #include "lwip/ip_addr.h"
dirkx 0:a259777c45a3 39
dirkx 0:a259777c45a3 40 /** Swap the bytes in an u16_t: much like htons() for little-endian */
dirkx 0:a259777c45a3 41 #ifndef SWAP_BYTES_IN_WORD
dirkx 0:a259777c45a3 42 #if LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)
dirkx 0:a259777c45a3 43 /* little endian and PLATFORM_BYTESWAP defined */
dirkx 0:a259777c45a3 44 #define SWAP_BYTES_IN_WORD(w) LWIP_PLATFORM_HTONS(w)
dirkx 0:a259777c45a3 45 #else /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) */
dirkx 0:a259777c45a3 46 /* can't use htons on big endian (or PLATFORM_BYTESWAP not defined)... */
dirkx 0:a259777c45a3 47 #define SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8)
dirkx 0:a259777c45a3 48 #endif /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)*/
dirkx 0:a259777c45a3 49 #endif /* SWAP_BYTES_IN_WORD */
dirkx 0:a259777c45a3 50
dirkx 0:a259777c45a3 51 /** Split an u32_t in two u16_ts and add them up */
dirkx 0:a259777c45a3 52 #ifndef FOLD_U32T
dirkx 0:a259777c45a3 53 #define FOLD_U32T(u) (((u) >> 16) + ((u) & 0x0000ffffUL))
dirkx 0:a259777c45a3 54 #endif
dirkx 0:a259777c45a3 55
dirkx 0:a259777c45a3 56 #if LWIP_CHECKSUM_ON_COPY
dirkx 0:a259777c45a3 57 /** Function-like macro: same as MEMCPY but returns the checksum of copied data
dirkx 0:a259777c45a3 58 as u16_t */
dirkx 0:a259777c45a3 59 #ifndef LWIP_CHKSUM_COPY
dirkx 0:a259777c45a3 60 #define LWIP_CHKSUM_COPY(dst, src, len) lwip_chksum_copy(dst, src, len)
dirkx 0:a259777c45a3 61 #ifndef LWIP_CHKSUM_COPY_ALGORITHM
dirkx 0:a259777c45a3 62 #define LWIP_CHKSUM_COPY_ALGORITHM 1
dirkx 0:a259777c45a3 63 #endif /* LWIP_CHKSUM_COPY_ALGORITHM */
dirkx 0:a259777c45a3 64 #endif /* LWIP_CHKSUM_COPY */
dirkx 0:a259777c45a3 65 #else /* LWIP_CHECKSUM_ON_COPY */
dirkx 0:a259777c45a3 66 #define LWIP_CHKSUM_COPY_ALGORITHM 0
dirkx 0:a259777c45a3 67 #endif /* LWIP_CHECKSUM_ON_COPY */
dirkx 0:a259777c45a3 68
dirkx 0:a259777c45a3 69 #ifdef __cplusplus
dirkx 0:a259777c45a3 70 extern "C" {
dirkx 0:a259777c45a3 71 #endif
dirkx 0:a259777c45a3 72
dirkx 0:a259777c45a3 73 u16_t inet_chksum(void *dataptr, u16_t len);
dirkx 0:a259777c45a3 74 u16_t inet_chksum_pbuf(struct pbuf *p);
dirkx 0:a259777c45a3 75 u16_t inet_chksum_pseudo(struct pbuf *p,
dirkx 0:a259777c45a3 76 ip_addr_t *src, ip_addr_t *dest,
dirkx 0:a259777c45a3 77 u8_t proto, u16_t proto_len);
dirkx 0:a259777c45a3 78 u16_t inet_chksum_pseudo_partial(struct pbuf *p,
dirkx 0:a259777c45a3 79 ip_addr_t *src, ip_addr_t *dest,
dirkx 0:a259777c45a3 80 u8_t proto, u16_t proto_len, u16_t chksum_len);
dirkx 0:a259777c45a3 81 #if LWIP_CHKSUM_COPY_ALGORITHM
dirkx 0:a259777c45a3 82 u16_t lwip_chksum_copy(void *dst, const void *src, u16_t len);
dirkx 0:a259777c45a3 83 #endif /* LWIP_CHKSUM_COPY_ALGORITHM */
dirkx 0:a259777c45a3 84
dirkx 0:a259777c45a3 85 #ifdef __cplusplus
dirkx 0:a259777c45a3 86 }
dirkx 0:a259777c45a3 87 #endif
dirkx 0:a259777c45a3 88
dirkx 0:a259777c45a3 89 #endif /* __LWIP_INET_H__ */
dirkx 0:a259777c45a3 90