|
||||
Warning, cross-references for /kernel/include/lwip/pbuf.h need to be fixed.
0001 /* 0002 * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 0003 * All rights reserved. 0004 * 0005 * Redistribution and use in source and binary forms, with or without modification, 0006 * are permitted provided that the following conditions are met: 0007 * 0008 * 1. Redistributions of source code must retain the above copyright notice, 0009 * this list of conditions and the following disclaimer. 0010 * 2. Redistributions in binary form must reproduce the above copyright notice, 0011 * this list of conditions and the following disclaimer in the documentation 0012 * and/or other materials provided with the distribution. 0013 * 3. The name of the author may not be used to endorse or promote products 0014 * derived from this software without specific prior written permission. 0015 * 0016 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 0017 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 0018 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 0019 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 0020 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 0021 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0023 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 0024 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 0025 * OF SUCH DAMAGE. 0026 * 0027 * This file is part of the lwIP TCP/IP stack. 0028 * 0029 * Author: Adam Dunkels <adam@sics.se> 0030 * 0031 */ 0032 0033 #ifndef __LWIP_PBUF_H__ 0034 #define __LWIP_PBUF_H__ 0035 0036 #include "lwip/opt.h" 0037 #include "lwip/err.h" 0038 0039 #ifdef __cplusplus 0040 extern "C" { 0041 #endif 0042 0043 #define PBUF_TRANSPORT_HLEN 20 0044 #define PBUF_IP_HLEN 20 0045 0046 typedef enum { 0047 PBUF_TRANSPORT, 0048 PBUF_IP, 0049 PBUF_LINK, 0050 PBUF_RAW 0051 } pbuf_layer; 0052 0053 typedef enum { 0054 PBUF_RAM, /* pbuf data is stored in RAM */ 0055 PBUF_ROM, /* pbuf data is stored in ROM */ 0056 PBUF_REF, /* pbuf comes from the pbuf pool */ 0057 PBUF_POOL /* pbuf payload refers to RAM */ 0058 } pbuf_type; 0059 0060 0061 /** indicates this packet's data should be immediately passed to the application */ 0062 #define PBUF_FLAG_PUSH 0x01U 0063 0064 struct pbuf { 0065 /** next pbuf in singly linked pbuf chain */ 0066 struct pbuf *next; 0067 0068 /** pointer to the actual data in the buffer */ 0069 void *payload; 0070 0071 /** 0072 * total length of this buffer and all next buffers in chain 0073 * belonging to the same packet. 0074 * 0075 * For non-queue packet chains this is the invariant: 0076 * p->tot_len == p->len + (p->next? p->next->tot_len: 0) 0077 */ 0078 u16_t tot_len; 0079 0080 /** length of this buffer */ 0081 u16_t len; 0082 0083 /** pbuf_type as u8_t instead of enum to save space */ 0084 u8_t /*pbuf_type*/ type; 0085 0086 /** misc flags */ 0087 u8_t flags; 0088 0089 /** 0090 * the reference count always equals the number of pointers 0091 * that refer to this pbuf. This can be pointers from an application, 0092 * the stack itself, or pbuf->next pointers from a chain. 0093 */ 0094 u16_t ref; 0095 0096 }; 0097 0098 /* Initializes the pbuf module. This call is empty for now, but may not be in future. */ 0099 #define pbuf_init() 0100 0101 struct pbuf *pbuf_alloc(pbuf_layer l, u16_t size, pbuf_type type); 0102 void pbuf_realloc(struct pbuf *p, u16_t size); 0103 u8_t pbuf_header(struct pbuf *p, s16_t header_size); 0104 void pbuf_ref(struct pbuf *p); 0105 void pbuf_ref_chain(struct pbuf *p); 0106 u8_t pbuf_free(struct pbuf *p); 0107 u8_t pbuf_clen(struct pbuf *p); 0108 void pbuf_cat(struct pbuf *head, struct pbuf *tail); 0109 void pbuf_chain(struct pbuf *head, struct pbuf *tail); 0110 struct pbuf *pbuf_dechain(struct pbuf *p); 0111 err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from); 0112 u16_t pbuf_copy_partial(struct pbuf *p, void *dataptr, u16_t len, u16_t offset); 0113 err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len); 0114 struct pbuf *pbuf_coalesce(struct pbuf *p, pbuf_layer layer); 0115 0116 #ifdef __cplusplus 0117 } 0118 #endif 0119 0120 #endif /* __LWIP_PBUF_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 1.2.0 LXR engine. |