00001 /** 00002 * \addtogroup rime 00003 * @{ 00004 */ 00005 00006 /** 00007 * \defgroup rimequeuebuf Rime queue buffer management 00008 * @{ 00009 * 00010 * The queuebuf module handles buffers that are queued. 00011 * 00012 */ 00013 00014 /* 00015 * Copyright (c) 2006, Swedish Institute of Computer Science. 00016 * All rights reserved. 00017 * 00018 * Redistribution and use in source and binary forms, with or without 00019 * modification, are permitted provided that the following conditions 00020 * are met: 00021 * 1. Redistributions of source code must retain the above copyright 00022 * notice, this list of conditions and the following disclaimer. 00023 * 2. Redistributions in binary form must reproduce the above copyright 00024 * notice, this list of conditions and the following disclaimer in the 00025 * documentation and/or other materials provided with the distribution. 00026 * 3. Neither the name of the Institute nor the names of its contributors 00027 * may be used to endorse or promote products derived from this software 00028 * without specific prior written permission. 00029 * 00030 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 00031 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00032 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00033 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 00034 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00035 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00036 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00037 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00038 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00039 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00040 * SUCH DAMAGE. 00041 * 00042 * This file is part of the Contiki operating system. 00043 * 00044 * $Id: queuebuf.h,v 1.4 2010/11/25 08:43:59 adamdunkels Exp $ 00045 */ 00046 00047 /** 00048 * \file 00049 * Header file for the Rime queue buffer management 00050 * \author 00051 * Adam Dunkels <adam@sics.se> 00052 */ 00053 00054 #ifndef __QUEUEBUF_H__ 00055 #define __QUEUEBUF_H__ 00056 00057 #include "net/packetbuf.h" 00058 00059 #ifdef QUEUEBUF_CONF_NUM 00060 #define QUEUEBUF_NUM QUEUEBUF_CONF_NUM 00061 #else 00062 #define QUEUEBUF_NUM 8 00063 #endif 00064 00065 #ifdef QUEUEBUF_CONF_DEBUG 00066 #define QUEUEBUF_DEBUG QUEUEBUF_CONF_DEBUG 00067 #else /* QUEUEBUF_CONF_DEBUG */ 00068 #define QUEUEBUF_DEBUG 0 00069 #endif /* QUEUEBUF_CONF_DEBUG */ 00070 00071 struct queuebuf; 00072 00073 void queuebuf_init(void); 00074 00075 #if QUEUEBUF_DEBUG 00076 struct queuebuf *queuebuf_new_from_packetbuf_debug(const char *file, int line); 00077 #define queuebuf_new_from_packetbuf() queuebuf_new_from_packetbuf_debug(__FILE__, __LINE__) 00078 #else /* QUEUEBUF_DEBUG */ 00079 struct queuebuf *queuebuf_new_from_packetbuf(void); 00080 #endif /* QUEUEBUF_DEBUG */ 00081 00082 void queuebuf_to_packetbuf(struct queuebuf *b); 00083 void queuebuf_free(struct queuebuf *b); 00084 00085 void *queuebuf_dataptr(struct queuebuf *b); 00086 int queuebuf_datalen(struct queuebuf *b); 00087 00088 rimeaddr_t *queuebuf_addr(struct queuebuf *b, uint8_t type); 00089 packetbuf_attr_t queuebuf_attr(struct queuebuf *b, uint8_t type); 00090 00091 void queuebuf_debug_print(void); 00092 00093 #endif /* __QUEUEBUF_H__ */ 00094 00095 /** @} */ 00096 /** @} */