route-discovery.h

Go to the documentation of this file.
00001 /**
00002  * \addtogroup rime
00003  * @{
00004  */
00005 
00006 /**
00007  * \defgroup routediscovery Rime route discovery protocol
00008  * @{
00009  *
00010  * The route-discovery module does route discovery for Rime.
00011  *
00012  * \section channels Channels
00013  *
00014  * The ibc module uses 2 channels; one for the flooded route request
00015  * packets and one for the unicast route replies.
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: route-discovery.h,v 1.11 2010/06/18 08:28:56 nifi Exp $
00049  */
00050 
00051 /**
00052  * \file
00053  *         Header file for the Rime mesh routing protocol
00054  * \author
00055  *         Adam Dunkels <adam@sics.se>
00056  */
00057 
00058 #ifndef __ROUTE_DISCOVERY_H__
00059 #define __ROUTE_DISCOVERY_H__
00060 
00061 #include "net/rime/unicast.h"
00062 #include "net/rime/netflood.h"
00063 #include "sys/ctimer.h"
00064 
00065 struct route_discovery_conn;
00066 
00067 struct route_discovery_callbacks {
00068   void (* new_route)(struct route_discovery_conn *c, const rimeaddr_t *to);
00069   void (* timedout)(struct route_discovery_conn *c);
00070 };
00071 
00072 #define ROUTE_DISCOVERY_ENTRIES 8
00073 
00074 struct route_discovery_conn {
00075   struct netflood_conn rreqconn;
00076   struct unicast_conn rrepconn;
00077   struct ctimer t;
00078   rimeaddr_t last_rreq_originator;
00079   uint16_t last_rreq_id;
00080   uint16_t rreq_id;
00081   const struct route_discovery_callbacks *cb;
00082 };
00083 
00084 void route_discovery_open(struct route_discovery_conn *c, clock_time_t time,
00085                           uint16_t channels,
00086                           const struct route_discovery_callbacks *callbacks);
00087 int route_discovery_discover(struct route_discovery_conn *c, const rimeaddr_t *dest,
00088                              clock_time_t timeout);
00089 
00090 void route_discovery_close(struct route_discovery_conn *c);
00091 
00092 #endif /* __ROUTE_DISCOVERY_H__ */
00093 /** @} */
00094 /** @} */

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