rmh.h

Go to the documentation of this file.
00001 /**
00002  * \addtogroup rime
00003  * @{
00004  */
00005 
00006 /**
00007  * \defgroup rimermh Best-effort multihop forwarding
00008  * @{
00009  *
00010  * The rmh module implements a multihop forwarding mechanism. Routes
00011  * must have already been setup with the route_add() function. Setting
00012  * up routes is done with another Rime module such as the \ref
00013  * routediscovery "route-discovery module".
00014  *
00015  * The hop-by-hop reliable multi-hop unciast primitive is similar to
00016  * the best-effot multi-hop unicast primitive except that it uses the
00017  * reliable single-hop primitive for the communication between two
00018  * single-hop neighbors.
00019  *
00020  * \section channels Channels
00021  *
00022  * The rmh module uses 1 channel.
00023  *
00024  */
00025 
00026 /*
00027  * Copyright (c) 2006, Swedish Institute of Computer Science.
00028  * All rights reserved.
00029  *
00030  * Redistribution and use in source and binary forms, with or without
00031  * modification, are permitted provided that the following conditions
00032  * are met:
00033  * 1. Redistributions of source code must retain the above copyright
00034  *    notice, this list of conditions and the following disclaimer.
00035  * 2. Redistributions in binary form must reproduce the above copyright
00036  *    notice, this list of conditions and the following disclaimer in the
00037  *    documentation and/or other materials provided with the distribution.
00038  * 3. Neither the name of the Institute nor the names of its contributors
00039  *    may be used to endorse or promote products derived from this software
00040  *    without specific prior written permission.
00041  *
00042  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00043  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00044  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00045  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00046  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00047  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00048  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00049  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00050  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00051  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00052  * SUCH DAMAGE.
00053  *
00054  * This file is part of the Contiki operating system.
00055  *
00056  * $Id: rmh.h,v 1.8 2009/11/08 19:40:17 adamdunkels Exp $
00057  */
00058 
00059 /**
00060  * \file
00061  *         Multihop forwarding header file
00062  * \author
00063  *         Adam Dunkels <adam@sics.se>
00064  */
00065 
00066 #ifndef __RMH_H__
00067 #define __RMH_H__
00068 
00069 #include "net/rime/runicast.h"
00070 #include "net/rime/rimeaddr.h"
00071 
00072 struct rmh_conn;
00073 
00074 #define RMH_ATTRIBUTES  { PACKET_ADDR_ESENDER, PACKET_ADDRSIZE }, \
00075                         { PACKET_ADDR_ERECEIVER, PACKET_ADDRSIZE }, \
00076                         { PACKET_ATTR_TTL, PACKET_ATTR_BIT * 5 }, \
00077                         { PACKET_ATTR_MAX_REXMIT, PACKET_ATTR_BIT * 5 }, \
00078                         RUC_ATTRIBUTES
00079 
00080 struct rmh_callbacks {
00081   void (* recv)(struct rmh_conn *ptr, rimeaddr_t *sender, uint8_t hops);
00082   rimeaddr_t *(* forward)(struct rmh_conn *ptr,
00083                           const rimeaddr_t *originator,
00084                           const rimeaddr_t *dest,
00085                           const rimeaddr_t *prevhop,
00086                           uint8_t hops);
00087 };
00088 
00089 struct rmh_conn {
00090   struct runicast_conn c;
00091   const struct rmh_callbacks *cb;
00092   uint8_t num_rexmit;
00093 };
00094 
00095 void rmh_open(struct rmh_conn *c, uint16_t channel,
00096               const struct rmh_callbacks *u);
00097 void rmh_close(struct rmh_conn *c);
00098 int rmh_send(struct rmh_conn *c, rimeaddr_t *to, uint8_t num_rexmit,
00099              uint8_t max_hops);
00100 
00101 #endif /* __RMH_H__ */
00102 /** @} */
00103 /** @} */

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