Modified version of NetServices. Fixes an issue where connections failed should the HTTP response status line be received in a packet on its own prior to any further headers. Changes are made to the HTTPClient.cpp file's readHeaders method.
lwip/include/lwip/memp.h@0:ec559500a63f, 2011-04-08 (annotated)
- Committer:
- andrewbonney
- Date:
- Fri Apr 08 14:39:41 2011 +0000
- Revision:
- 0:ec559500a63f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewbonney | 0:ec559500a63f | 1 | /* |
andrewbonney | 0:ec559500a63f | 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
andrewbonney | 0:ec559500a63f | 3 | * All rights reserved. |
andrewbonney | 0:ec559500a63f | 4 | * |
andrewbonney | 0:ec559500a63f | 5 | * Redistribution and use in source and binary forms, with or without modification, |
andrewbonney | 0:ec559500a63f | 6 | * are permitted provided that the following conditions are met: |
andrewbonney | 0:ec559500a63f | 7 | * |
andrewbonney | 0:ec559500a63f | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
andrewbonney | 0:ec559500a63f | 9 | * this list of conditions and the following disclaimer. |
andrewbonney | 0:ec559500a63f | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
andrewbonney | 0:ec559500a63f | 11 | * this list of conditions and the following disclaimer in the documentation |
andrewbonney | 0:ec559500a63f | 12 | * and/or other materials provided with the distribution. |
andrewbonney | 0:ec559500a63f | 13 | * 3. The name of the author may not be used to endorse or promote products |
andrewbonney | 0:ec559500a63f | 14 | * derived from this software without specific prior written permission. |
andrewbonney | 0:ec559500a63f | 15 | * |
andrewbonney | 0:ec559500a63f | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
andrewbonney | 0:ec559500a63f | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
andrewbonney | 0:ec559500a63f | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
andrewbonney | 0:ec559500a63f | 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
andrewbonney | 0:ec559500a63f | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
andrewbonney | 0:ec559500a63f | 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
andrewbonney | 0:ec559500a63f | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
andrewbonney | 0:ec559500a63f | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
andrewbonney | 0:ec559500a63f | 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
andrewbonney | 0:ec559500a63f | 25 | * OF SUCH DAMAGE. |
andrewbonney | 0:ec559500a63f | 26 | * |
andrewbonney | 0:ec559500a63f | 27 | * This file is part of the lwIP TCP/IP stack. |
andrewbonney | 0:ec559500a63f | 28 | * |
andrewbonney | 0:ec559500a63f | 29 | * Author: Adam Dunkels <adam@sics.se> |
andrewbonney | 0:ec559500a63f | 30 | * |
andrewbonney | 0:ec559500a63f | 31 | */ |
andrewbonney | 0:ec559500a63f | 32 | |
andrewbonney | 0:ec559500a63f | 33 | #ifndef __LWIP_MEMP_H__ |
andrewbonney | 0:ec559500a63f | 34 | #define __LWIP_MEMP_H__ |
andrewbonney | 0:ec559500a63f | 35 | |
andrewbonney | 0:ec559500a63f | 36 | #include "lwip/opt.h" |
andrewbonney | 0:ec559500a63f | 37 | |
andrewbonney | 0:ec559500a63f | 38 | #ifdef __cplusplus |
andrewbonney | 0:ec559500a63f | 39 | extern "C" { |
andrewbonney | 0:ec559500a63f | 40 | #endif |
andrewbonney | 0:ec559500a63f | 41 | |
andrewbonney | 0:ec559500a63f | 42 | /* Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end */ |
andrewbonney | 0:ec559500a63f | 43 | typedef enum { |
andrewbonney | 0:ec559500a63f | 44 | #define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name, |
andrewbonney | 0:ec559500a63f | 45 | #include "lwip/memp_std.h" |
andrewbonney | 0:ec559500a63f | 46 | MEMP_MAX |
andrewbonney | 0:ec559500a63f | 47 | } memp_t; |
andrewbonney | 0:ec559500a63f | 48 | |
andrewbonney | 0:ec559500a63f | 49 | #if MEM_USE_POOLS |
andrewbonney | 0:ec559500a63f | 50 | /* Use a helper type to get the start and end of the user "memory pools" for mem_malloc */ |
andrewbonney | 0:ec559500a63f | 51 | typedef enum { |
andrewbonney | 0:ec559500a63f | 52 | /* Get the first (via: |
andrewbonney | 0:ec559500a63f | 53 | MEMP_POOL_HELPER_START = ((u8_t) 1*MEMP_POOL_A + 0*MEMP_POOL_B + 0*MEMP_POOL_C + 0)*/ |
andrewbonney | 0:ec559500a63f | 54 | MEMP_POOL_HELPER_FIRST = ((u8_t) |
andrewbonney | 0:ec559500a63f | 55 | #define LWIP_MEMPOOL(name,num,size,desc) |
andrewbonney | 0:ec559500a63f | 56 | #define LWIP_MALLOC_MEMPOOL_START 1 |
andrewbonney | 0:ec559500a63f | 57 | #define LWIP_MALLOC_MEMPOOL(num, size) * MEMP_POOL_##size + 0 |
andrewbonney | 0:ec559500a63f | 58 | #define LWIP_MALLOC_MEMPOOL_END |
andrewbonney | 0:ec559500a63f | 59 | #include "lwip/memp_std.h" |
andrewbonney | 0:ec559500a63f | 60 | ) , |
andrewbonney | 0:ec559500a63f | 61 | /* Get the last (via: |
andrewbonney | 0:ec559500a63f | 62 | MEMP_POOL_HELPER_END = ((u8_t) 0 + MEMP_POOL_A*0 + MEMP_POOL_B*0 + MEMP_POOL_C*1) */ |
andrewbonney | 0:ec559500a63f | 63 | MEMP_POOL_HELPER_LAST = ((u8_t) |
andrewbonney | 0:ec559500a63f | 64 | #define LWIP_MEMPOOL(name,num,size,desc) |
andrewbonney | 0:ec559500a63f | 65 | #define LWIP_MALLOC_MEMPOOL_START |
andrewbonney | 0:ec559500a63f | 66 | #define LWIP_MALLOC_MEMPOOL(num, size) 0 + MEMP_POOL_##size * |
andrewbonney | 0:ec559500a63f | 67 | #define LWIP_MALLOC_MEMPOOL_END 1 |
andrewbonney | 0:ec559500a63f | 68 | #include "lwip/memp_std.h" |
andrewbonney | 0:ec559500a63f | 69 | ) |
andrewbonney | 0:ec559500a63f | 70 | } memp_pool_helper_t; |
andrewbonney | 0:ec559500a63f | 71 | |
andrewbonney | 0:ec559500a63f | 72 | /* The actual start and stop values are here (cast them over) |
andrewbonney | 0:ec559500a63f | 73 | We use this helper type and these defines so we can avoid using const memp_t values */ |
andrewbonney | 0:ec559500a63f | 74 | #define MEMP_POOL_FIRST ((memp_t) MEMP_POOL_HELPER_FIRST) |
andrewbonney | 0:ec559500a63f | 75 | #define MEMP_POOL_LAST ((memp_t) MEMP_POOL_HELPER_LAST) |
andrewbonney | 0:ec559500a63f | 76 | #endif /* MEM_USE_POOLS */ |
andrewbonney | 0:ec559500a63f | 77 | |
andrewbonney | 0:ec559500a63f | 78 | #if MEMP_MEM_MALLOC || MEM_USE_POOLS |
andrewbonney | 0:ec559500a63f | 79 | extern const u16_t memp_sizes[MEMP_MAX]; |
andrewbonney | 0:ec559500a63f | 80 | #endif /* MEMP_MEM_MALLOC || MEM_USE_POOLS */ |
andrewbonney | 0:ec559500a63f | 81 | |
andrewbonney | 0:ec559500a63f | 82 | #if MEMP_MEM_MALLOC |
andrewbonney | 0:ec559500a63f | 83 | |
andrewbonney | 0:ec559500a63f | 84 | #include "mem.h" |
andrewbonney | 0:ec559500a63f | 85 | |
andrewbonney | 0:ec559500a63f | 86 | #define memp_init() |
andrewbonney | 0:ec559500a63f | 87 | #define memp_malloc(type) mem_malloc(memp_sizes[type]) |
andrewbonney | 0:ec559500a63f | 88 | #define memp_free(type, mem) mem_free(mem) |
andrewbonney | 0:ec559500a63f | 89 | |
andrewbonney | 0:ec559500a63f | 90 | #else /* MEMP_MEM_MALLOC */ |
andrewbonney | 0:ec559500a63f | 91 | |
andrewbonney | 0:ec559500a63f | 92 | #if MEM_USE_POOLS |
andrewbonney | 0:ec559500a63f | 93 | /** This structure is used to save the pool one element came from. */ |
andrewbonney | 0:ec559500a63f | 94 | struct memp_malloc_helper |
andrewbonney | 0:ec559500a63f | 95 | { |
andrewbonney | 0:ec559500a63f | 96 | memp_t poolnr; |
andrewbonney | 0:ec559500a63f | 97 | }; |
andrewbonney | 0:ec559500a63f | 98 | #endif /* MEM_USE_POOLS */ |
andrewbonney | 0:ec559500a63f | 99 | |
andrewbonney | 0:ec559500a63f | 100 | void memp_init(void); |
andrewbonney | 0:ec559500a63f | 101 | |
andrewbonney | 0:ec559500a63f | 102 | #if MEMP_OVERFLOW_CHECK |
andrewbonney | 0:ec559500a63f | 103 | void *memp_malloc_fn(memp_t type, const char* file, const int line); |
andrewbonney | 0:ec559500a63f | 104 | #define memp_malloc(t) memp_malloc_fn((t), __FILE__, __LINE__) |
andrewbonney | 0:ec559500a63f | 105 | #else |
andrewbonney | 0:ec559500a63f | 106 | void *memp_malloc(memp_t type); |
andrewbonney | 0:ec559500a63f | 107 | #endif |
andrewbonney | 0:ec559500a63f | 108 | void memp_free(memp_t type, void *mem); |
andrewbonney | 0:ec559500a63f | 109 | |
andrewbonney | 0:ec559500a63f | 110 | #endif /* MEMP_MEM_MALLOC */ |
andrewbonney | 0:ec559500a63f | 111 | |
andrewbonney | 0:ec559500a63f | 112 | #ifdef __cplusplus |
andrewbonney | 0:ec559500a63f | 113 | } |
andrewbonney | 0:ec559500a63f | 114 | #endif |
andrewbonney | 0:ec559500a63f | 115 | |
andrewbonney | 0:ec559500a63f | 116 | #endif /* __LWIP_MEMP_H__ */ |