My fork of the HTTPServer (working)
Core/lwIP/include/lwip/netbuf.h@0:7a64fbb4069d, 2012-08-06 (annotated)
- Committer:
- screamer
- Date:
- Mon Aug 06 09:23:14 2012 +0000
- Revision:
- 0:7a64fbb4069d
[mbed] converted /DGWWebServer/HTTPServer
Who changed what in which revision?
User | Revision | Line number | New 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_NETBUF_H__ |
screamer | 0:7a64fbb4069d | 33 | #define __LWIP_NETBUF_H__ |
screamer | 0:7a64fbb4069d | 34 | |
screamer | 0:7a64fbb4069d | 35 | #include "lwip/opt.h" |
screamer | 0:7a64fbb4069d | 36 | #include "lwip/pbuf.h" |
screamer | 0:7a64fbb4069d | 37 | |
screamer | 0:7a64fbb4069d | 38 | #ifdef __cplusplus |
screamer | 0:7a64fbb4069d | 39 | extern "C" { |
screamer | 0:7a64fbb4069d | 40 | #endif |
screamer | 0:7a64fbb4069d | 41 | |
screamer | 0:7a64fbb4069d | 42 | struct netbuf { |
screamer | 0:7a64fbb4069d | 43 | struct pbuf *p, *ptr; |
screamer | 0:7a64fbb4069d | 44 | struct ip_addr *addr; |
screamer | 0:7a64fbb4069d | 45 | u16_t port; |
screamer | 0:7a64fbb4069d | 46 | }; |
screamer | 0:7a64fbb4069d | 47 | |
screamer | 0:7a64fbb4069d | 48 | /* Network buffer functions: */ |
screamer | 0:7a64fbb4069d | 49 | struct netbuf * netbuf_new (void); |
screamer | 0:7a64fbb4069d | 50 | void netbuf_delete (struct netbuf *buf); |
screamer | 0:7a64fbb4069d | 51 | void * netbuf_alloc (struct netbuf *buf, u16_t size); |
screamer | 0:7a64fbb4069d | 52 | void netbuf_free (struct netbuf *buf); |
screamer | 0:7a64fbb4069d | 53 | err_t netbuf_ref (struct netbuf *buf, |
screamer | 0:7a64fbb4069d | 54 | const void *dataptr, u16_t size); |
screamer | 0:7a64fbb4069d | 55 | void netbuf_chain (struct netbuf *head, |
screamer | 0:7a64fbb4069d | 56 | struct netbuf *tail); |
screamer | 0:7a64fbb4069d | 57 | |
screamer | 0:7a64fbb4069d | 58 | u16_t netbuf_len (struct netbuf *buf); |
screamer | 0:7a64fbb4069d | 59 | err_t netbuf_data (struct netbuf *buf, |
screamer | 0:7a64fbb4069d | 60 | void **dataptr, u16_t *len); |
screamer | 0:7a64fbb4069d | 61 | s8_t netbuf_next (struct netbuf *buf); |
screamer | 0:7a64fbb4069d | 62 | void netbuf_first (struct netbuf *buf); |
screamer | 0:7a64fbb4069d | 63 | |
screamer | 0:7a64fbb4069d | 64 | |
screamer | 0:7a64fbb4069d | 65 | #define netbuf_copy_partial(buf, dataptr, len, offset) \ |
screamer | 0:7a64fbb4069d | 66 | pbuf_copy_partial((buf)->p, (dataptr), (len), (offset)) |
screamer | 0:7a64fbb4069d | 67 | #define netbuf_copy(buf,dataptr,len) netbuf_copy_partial(buf, dataptr, len, 0) |
screamer | 0:7a64fbb4069d | 68 | #define netbuf_len(buf) ((buf)->p->tot_len) |
screamer | 0:7a64fbb4069d | 69 | #define netbuf_fromaddr(buf) ((buf)->addr) |
screamer | 0:7a64fbb4069d | 70 | #define netbuf_fromport(buf) ((buf)->port) |
screamer | 0:7a64fbb4069d | 71 | |
screamer | 0:7a64fbb4069d | 72 | #ifdef __cplusplus |
screamer | 0:7a64fbb4069d | 73 | } |
screamer | 0:7a64fbb4069d | 74 | #endif |
screamer | 0:7a64fbb4069d | 75 | |
screamer | 0:7a64fbb4069d | 76 | #endif /* __LWIP_NETBUF_H__ */ |