00001 /** 00002 * \addtogroup rime 00003 * @{ 00004 */ 00005 00006 /** 00007 * \defgroup trickle Reliable single-source multi-hop flooding 00008 * @{ 00009 * 00010 * The trickle module sends a single packet to all nodes on the network. 00011 * 00012 * \section channels Channels 00013 * 00014 * The trickle module uses 1 channel. 00015 * 00016 */ 00017 00018 /* 00019 * Copyright (c) 2007, Swedish Institute of Computer Science. 00020 * All rights reserved. 00021 * 00022 * Redistribution and use in source and binary forms, with or without 00023 * modification, are permitted provided that the following conditions 00024 * are met: 00025 * 1. Redistributions of source code must retain the above copyright 00026 * notice, this list of conditions and the following disclaimer. 00027 * 2. Redistributions in binary form must reproduce the above copyright 00028 * notice, this list of conditions and the following disclaimer in the 00029 * documentation and/or other materials provided with the distribution. 00030 * 3. Neither the name of the Institute nor the names of its contributors 00031 * may be used to endorse or promote products derived from this software 00032 * without specific prior written permission. 00033 * 00034 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 00035 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00036 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00037 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 00038 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00039 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00040 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00041 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00042 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00043 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00044 * SUCH DAMAGE. 00045 * 00046 * This file is part of the Contiki operating system. 00047 * 00048 * $Id: trickle.h,v 1.13 2010/06/14 19:19:17 adamdunkels Exp $ 00049 */ 00050 00051 /** 00052 * \file 00053 * Header file for Trickle (reliable single source flooding) for Rime 00054 * \author 00055 * Adam Dunkels <adam@sics.se> 00056 */ 00057 00058 #ifndef __TRICKLE_H__ 00059 #define __TRICKLE_H__ 00060 00061 #include "sys/ctimer.h" 00062 00063 #include "net/rime/broadcast.h" 00064 #include "net/queuebuf.h" 00065 00066 #define TRICKLE_ATTRIBUTES { PACKETBUF_ATTR_EPACKET_ID, PACKETBUF_ATTR_BIT * 8 },\ 00067 BROADCAST_ATTRIBUTES 00068 00069 struct trickle_conn; 00070 00071 struct trickle_callbacks { 00072 void (* recv)(struct trickle_conn *c); 00073 }; 00074 00075 struct trickle_conn { 00076 struct broadcast_conn c; 00077 const struct trickle_callbacks *cb; 00078 struct ctimer t, interval_timer, first_transmission_timer; 00079 struct pt pt; 00080 struct queuebuf *q; 00081 clock_time_t interval; 00082 uint8_t seqno; 00083 uint8_t interval_scaling; 00084 uint8_t duplicates; 00085 }; 00086 00087 void trickle_open(struct trickle_conn *c, clock_time_t interval, 00088 uint16_t channel, const struct trickle_callbacks *cb); 00089 void trickle_close(struct trickle_conn *c); 00090 00091 void trickle_send(struct trickle_conn *c); 00092 00093 #endif /* __TRICKLE_H__ */ 00094 /** @} */ 00095 /** @} */