My fork of the HTTPServer (working)

Dependents:   DGWWebServer LAN2

Committer:
screamer
Date:
Mon Aug 06 09:23:14 2012 +0000
Revision:
0:7a64fbb4069d
[mbed] converted /DGWWebServer/HTTPServer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:7a64fbb4069d 1 /*
screamer 0:7a64fbb4069d 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
screamer 0:7a64fbb4069d 3 * All rights reserved.
screamer 0:7a64fbb4069d 4 *
screamer 0:7a64fbb4069d 5 * Redistribution and use in source and binary forms, with or without modification,
screamer 0:7a64fbb4069d 6 * are permitted provided that the following conditions are met:
screamer 0:7a64fbb4069d 7 *
screamer 0:7a64fbb4069d 8 * 1. Redistributions of source code must retain the above copyright notice,
screamer 0:7a64fbb4069d 9 * this list of conditions and the following disclaimer.
screamer 0:7a64fbb4069d 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
screamer 0:7a64fbb4069d 11 * this list of conditions and the following disclaimer in the documentation
screamer 0:7a64fbb4069d 12 * and/or other materials provided with the distribution.
screamer 0:7a64fbb4069d 13 * 3. The name of the author may not be used to endorse or promote products
screamer 0:7a64fbb4069d 14 * derived from this software without specific prior written permission.
screamer 0:7a64fbb4069d 15 *
screamer 0:7a64fbb4069d 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
screamer 0:7a64fbb4069d 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
screamer 0:7a64fbb4069d 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
screamer 0:7a64fbb4069d 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
screamer 0:7a64fbb4069d 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
screamer 0:7a64fbb4069d 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
screamer 0:7a64fbb4069d 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
screamer 0:7a64fbb4069d 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
screamer 0:7a64fbb4069d 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
screamer 0:7a64fbb4069d 25 * OF SUCH DAMAGE.
screamer 0:7a64fbb4069d 26 *
screamer 0:7a64fbb4069d 27 * This file is part of the lwIP TCP/IP stack.
screamer 0:7a64fbb4069d 28 *
screamer 0:7a64fbb4069d 29 * Author: Adam Dunkels <adam@sics.se>
screamer 0:7a64fbb4069d 30 *
screamer 0:7a64fbb4069d 31 */
screamer 0:7a64fbb4069d 32 #ifndef __LWIP_MEM_H__
screamer 0:7a64fbb4069d 33 #define __LWIP_MEM_H__
screamer 0:7a64fbb4069d 34
screamer 0:7a64fbb4069d 35 #include "lwip/opt.h"
screamer 0:7a64fbb4069d 36
screamer 0:7a64fbb4069d 37 #ifdef __cplusplus
screamer 0:7a64fbb4069d 38 extern "C" {
screamer 0:7a64fbb4069d 39 #endif
screamer 0:7a64fbb4069d 40
screamer 0:7a64fbb4069d 41 #if MEM_LIBC_MALLOC
screamer 0:7a64fbb4069d 42
screamer 0:7a64fbb4069d 43 #include <stddef.h> /* for size_t */
screamer 0:7a64fbb4069d 44
screamer 0:7a64fbb4069d 45 typedef size_t mem_size_t;
screamer 0:7a64fbb4069d 46
screamer 0:7a64fbb4069d 47 /* aliases for C library malloc() */
screamer 0:7a64fbb4069d 48 #define mem_init()
screamer 0:7a64fbb4069d 49 /* in case C library malloc() needs extra protection,
screamer 0:7a64fbb4069d 50 * allow these defines to be overridden.
screamer 0:7a64fbb4069d 51 */
screamer 0:7a64fbb4069d 52 #ifndef mem_free
screamer 0:7a64fbb4069d 53 #define mem_free free
screamer 0:7a64fbb4069d 54 #endif
screamer 0:7a64fbb4069d 55 #ifndef mem_malloc
screamer 0:7a64fbb4069d 56 #define mem_malloc malloc
screamer 0:7a64fbb4069d 57 #endif
screamer 0:7a64fbb4069d 58 #ifndef mem_calloc
screamer 0:7a64fbb4069d 59 #define mem_calloc calloc
screamer 0:7a64fbb4069d 60 #endif
screamer 0:7a64fbb4069d 61 #ifndef mem_realloc
screamer 0:7a64fbb4069d 62 #define mem_realloc realloc
screamer 0:7a64fbb4069d 63 #endif
screamer 0:7a64fbb4069d 64 #else /* MEM_LIBC_MALLOC */
screamer 0:7a64fbb4069d 65
screamer 0:7a64fbb4069d 66 /* MEM_SIZE would have to be aligned, but using 64000 here instead of
screamer 0:7a64fbb4069d 67 * 65535 leaves some room for alignment...
screamer 0:7a64fbb4069d 68 */
screamer 0:7a64fbb4069d 69 #if MEM_SIZE > 64000l
screamer 0:7a64fbb4069d 70 typedef u32_t mem_size_t;
screamer 0:7a64fbb4069d 71 #else
screamer 0:7a64fbb4069d 72 typedef u16_t mem_size_t;
screamer 0:7a64fbb4069d 73 #endif /* MEM_SIZE > 64000 */
screamer 0:7a64fbb4069d 74
screamer 0:7a64fbb4069d 75 #if MEM_USE_POOLS
screamer 0:7a64fbb4069d 76 /** mem_init is not used when using pools instead of a heap */
screamer 0:7a64fbb4069d 77 #define mem_init()
screamer 0:7a64fbb4069d 78 /** mem_realloc is not used when using pools instead of a heap:
screamer 0:7a64fbb4069d 79 we can't free part of a pool element and don't want to copy the rest */
screamer 0:7a64fbb4069d 80 #define mem_realloc(mem, size) (mem)
screamer 0:7a64fbb4069d 81 #else /* MEM_USE_POOLS */
screamer 0:7a64fbb4069d 82 /* lwIP alternative malloc */
screamer 0:7a64fbb4069d 83 void mem_init(void);
screamer 0:7a64fbb4069d 84 void *mem_realloc(void *mem, mem_size_t size);
screamer 0:7a64fbb4069d 85 #endif /* MEM_USE_POOLS */
screamer 0:7a64fbb4069d 86 void *mem_malloc(mem_size_t size);
screamer 0:7a64fbb4069d 87 void *mem_calloc(mem_size_t count, mem_size_t size);
screamer 0:7a64fbb4069d 88 void mem_free(void *mem);
screamer 0:7a64fbb4069d 89 #endif /* MEM_LIBC_MALLOC */
screamer 0:7a64fbb4069d 90
screamer 0:7a64fbb4069d 91 #ifndef LWIP_MEM_ALIGN_SIZE
screamer 0:7a64fbb4069d 92 #define LWIP_MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1))
screamer 0:7a64fbb4069d 93 #endif
screamer 0:7a64fbb4069d 94
screamer 0:7a64fbb4069d 95 #ifndef LWIP_MEM_ALIGN // v-- XXX: was void *
screamer 0:7a64fbb4069d 96 #define LWIP_MEM_ALIGN(addr) ((u8_t *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1)))
screamer 0:7a64fbb4069d 97 #endif
screamer 0:7a64fbb4069d 98
screamer 0:7a64fbb4069d 99 #ifdef __cplusplus
screamer 0:7a64fbb4069d 100 }
screamer 0:7a64fbb4069d 101 #endif
screamer 0:7a64fbb4069d 102
screamer 0:7a64fbb4069d 103 #endif /* __LWIP_MEM_H__ */