rudolph1.h

Go to the documentation of this file.
00001 /**
00002  * \addtogroup rime
00003  * @{
00004  */
00005 
00006 /**
00007  * \defgroup rudolph1 Multi-hop reliable bulk data transfer
00008  * @{
00009  *
00010  * The rudolph1 module implements a multi-hop reliable bulk data
00011  * transfer mechanism.
00012  *
00013  * \section channels Channels
00014  *
00015  * The rudolph1 module uses 2 channels; one for data transmissions and
00016  * one for NACKs and repair packets.
00017  *
00018  */
00019 
00020 /*
00021  * Copyright (c) 2007, Swedish Institute of Computer Science.
00022  * All rights reserved.
00023  *
00024  * Redistribution and use in source and binary forms, with or without
00025  * modification, are permitted provided that the following conditions
00026  * are met:
00027  * 1. Redistributions of source code must retain the above copyright
00028  *    notice, this list of conditions and the following disclaimer.
00029  * 2. Redistributions in binary form must reproduce the above copyright
00030  *    notice, this list of conditions and the following disclaimer in the
00031  *    documentation and/or other materials provided with the distribution.
00032  * 3. Neither the name of the Institute nor the names of its contributors
00033  *    may be used to endorse or promote products derived from this software
00034  *    without specific prior written permission.
00035  *
00036  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00037  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00038  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00039  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00040  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00041  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00042  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00043  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00044  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00045  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00046  * SUCH DAMAGE.
00047  *
00048  * This file is part of the Contiki operating system.
00049  *
00050  * $Id: rudolph1.h,v 1.9 2010/06/18 08:28:56 nifi Exp $
00051  */
00052 
00053 /**
00054  * \file
00055  *         Header file for the multi-hop reliable bulk data transfer mechanism
00056  * \author
00057  *         Adam Dunkels <adam@sics.se>
00058  */
00059 
00060 #ifndef __RUDOLPH1_H__
00061 #define __RUDOLPH1_H__
00062 
00063 #include "net/rime/trickle.h"
00064 #include "net/rime/ipolite.h"
00065 #include "sys/ctimer.h"
00066 
00067 struct rudolph1_conn;
00068 
00069 enum {
00070   RUDOLPH1_FLAG_NONE,
00071   RUDOLPH1_FLAG_NEWFILE,
00072   RUDOLPH1_FLAG_LASTCHUNK,
00073 };
00074 
00075 struct rudolph1_callbacks {
00076   void (* write_chunk)(struct rudolph1_conn *c, int offset, int flag,
00077                        uint8_t *data, int len);
00078   int (* read_chunk)(struct rudolph1_conn *c, int offset, uint8_t *to,
00079                      int maxsize);
00080 };
00081 
00082 struct rudolph1_conn {
00083   struct trickle_conn trickle;
00084   struct ipolite_conn ipolite;
00085   const struct rudolph1_callbacks *cb;
00086   struct ctimer t;
00087   clock_time_t send_interval;
00088   uint16_t chunk, highest_chunk_heard;
00089   uint8_t version;
00090   /*  uint8_t trickle_interval;*/
00091   uint8_t nacks;
00092 };
00093 
00094 void rudolph1_open(struct rudolph1_conn *c, uint16_t channel,
00095                    const struct rudolph1_callbacks *cb);
00096 void rudolph1_close(struct rudolph1_conn *c);
00097 void rudolph1_send(struct rudolph1_conn *c, clock_time_t send_interval);
00098 void rudolph1_stop(struct rudolph1_conn *c);
00099 
00100 #endif /* __RUDOLPH1_H__ */
00101 /** @} */
00102 /** @} */

Generated on Mon Apr 11 14:23:31 2011 for Contiki 2.5 by  doxygen 1.6.1