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
screamer 0:7a64fbb4069d 33 #ifndef __LWIP_PBUF_H__
screamer 0:7a64fbb4069d 34 #define __LWIP_PBUF_H__
screamer 0:7a64fbb4069d 35
screamer 0:7a64fbb4069d 36 #include "lwip/opt.h"
screamer 0:7a64fbb4069d 37 #include "lwip/err.h"
screamer 0:7a64fbb4069d 38
screamer 0:7a64fbb4069d 39 #ifdef __cplusplus
screamer 0:7a64fbb4069d 40 extern "C" {
screamer 0:7a64fbb4069d 41 #endif
screamer 0:7a64fbb4069d 42
screamer 0:7a64fbb4069d 43 #define PBUF_TRANSPORT_HLEN 20
screamer 0:7a64fbb4069d 44 #define PBUF_IP_HLEN 20
screamer 0:7a64fbb4069d 45
screamer 0:7a64fbb4069d 46 typedef enum {
screamer 0:7a64fbb4069d 47 PBUF_TRANSPORT,
screamer 0:7a64fbb4069d 48 PBUF_IP,
screamer 0:7a64fbb4069d 49 PBUF_LINK,
screamer 0:7a64fbb4069d 50 PBUF_RAW
screamer 0:7a64fbb4069d 51 } pbuf_layer;
screamer 0:7a64fbb4069d 52
screamer 0:7a64fbb4069d 53 typedef enum {
screamer 0:7a64fbb4069d 54 PBUF_RAM, /* pbuf data is stored in RAM */
screamer 0:7a64fbb4069d 55 PBUF_ROM, /* pbuf data is stored in ROM */
screamer 0:7a64fbb4069d 56 PBUF_REF, /* pbuf comes from the pbuf pool */
screamer 0:7a64fbb4069d 57 PBUF_POOL /* pbuf payload refers to RAM */
screamer 0:7a64fbb4069d 58 } pbuf_type;
screamer 0:7a64fbb4069d 59
screamer 0:7a64fbb4069d 60
screamer 0:7a64fbb4069d 61 /** indicates this packet's data should be immediately passed to the application */
screamer 0:7a64fbb4069d 62 #define PBUF_FLAG_PUSH 0x01U
screamer 0:7a64fbb4069d 63
screamer 0:7a64fbb4069d 64 struct pbuf {
screamer 0:7a64fbb4069d 65 /** next pbuf in singly linked pbuf chain */
screamer 0:7a64fbb4069d 66 struct pbuf *next;
screamer 0:7a64fbb4069d 67
screamer 0:7a64fbb4069d 68 /** pointer to the actual data in the buffer */
screamer 0:7a64fbb4069d 69 void *payload;
screamer 0:7a64fbb4069d 70
screamer 0:7a64fbb4069d 71 /**
screamer 0:7a64fbb4069d 72 * total length of this buffer and all next buffers in chain
screamer 0:7a64fbb4069d 73 * belonging to the same packet.
screamer 0:7a64fbb4069d 74 *
screamer 0:7a64fbb4069d 75 * For non-queue packet chains this is the invariant:
screamer 0:7a64fbb4069d 76 * p->tot_len == p->len + (p->next? p->next->tot_len: 0)
screamer 0:7a64fbb4069d 77 */
screamer 0:7a64fbb4069d 78 u16_t tot_len;
screamer 0:7a64fbb4069d 79
screamer 0:7a64fbb4069d 80 /** length of this buffer */
screamer 0:7a64fbb4069d 81 u16_t len;
screamer 0:7a64fbb4069d 82
screamer 0:7a64fbb4069d 83 /** pbuf_type as u8_t instead of enum to save space */
screamer 0:7a64fbb4069d 84 u8_t /*pbuf_type*/ type;
screamer 0:7a64fbb4069d 85
screamer 0:7a64fbb4069d 86 /** misc flags */
screamer 0:7a64fbb4069d 87 u8_t flags;
screamer 0:7a64fbb4069d 88
screamer 0:7a64fbb4069d 89 /**
screamer 0:7a64fbb4069d 90 * the reference count always equals the number of pointers
screamer 0:7a64fbb4069d 91 * that refer to this pbuf. This can be pointers from an application,
screamer 0:7a64fbb4069d 92 * the stack itself, or pbuf->next pointers from a chain.
screamer 0:7a64fbb4069d 93 */
screamer 0:7a64fbb4069d 94 u16_t ref;
screamer 0:7a64fbb4069d 95
screamer 0:7a64fbb4069d 96 };
screamer 0:7a64fbb4069d 97
screamer 0:7a64fbb4069d 98 /* Initializes the pbuf module. This call is empty for now, but may not be in future. */
screamer 0:7a64fbb4069d 99 #define pbuf_init()
screamer 0:7a64fbb4069d 100
screamer 0:7a64fbb4069d 101 struct pbuf *pbuf_alloc(pbuf_layer l, u16_t size, pbuf_type type);
screamer 0:7a64fbb4069d 102 void pbuf_realloc(struct pbuf *p, u16_t size);
screamer 0:7a64fbb4069d 103 u8_t pbuf_header(struct pbuf *p, s16_t header_size);
screamer 0:7a64fbb4069d 104 void pbuf_ref(struct pbuf *p);
screamer 0:7a64fbb4069d 105 void pbuf_ref_chain(struct pbuf *p);
screamer 0:7a64fbb4069d 106 u8_t pbuf_free(struct pbuf *p);
screamer 0:7a64fbb4069d 107 u8_t pbuf_clen(struct pbuf *p);
screamer 0:7a64fbb4069d 108 void pbuf_cat(struct pbuf *head, struct pbuf *tail);
screamer 0:7a64fbb4069d 109 void pbuf_chain(struct pbuf *head, struct pbuf *tail);
screamer 0:7a64fbb4069d 110 struct pbuf *pbuf_dechain(struct pbuf *p);
screamer 0:7a64fbb4069d 111 err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from);
screamer 0:7a64fbb4069d 112 u16_t pbuf_copy_partial(struct pbuf *p, void *dataptr, u16_t len, u16_t offset);
screamer 0:7a64fbb4069d 113
screamer 0:7a64fbb4069d 114 #ifdef __cplusplus
screamer 0:7a64fbb4069d 115 }
screamer 0:7a64fbb4069d 116 #endif
screamer 0:7a64fbb4069d 117
screamer 0:7a64fbb4069d 118 #endif /* __LWIP_PBUF_H__ */