Contiki 2.6

route.h

Go to the documentation of this file.
00001 /**
00002  * \addtogroup rime
00003  * @{
00004  */
00005 /**
00006  * \defgroup rimeroute Rime route table
00007  * @{
00008  *
00009  * The route module handles the route table in Rime.
00010  */
00011 
00012 /*
00013  * Copyright (c) 2005, Swedish Institute of Computer Science.
00014  * All rights reserved.
00015  *
00016  * Redistribution and use in source and binary forms, with or without
00017  * modification, are permitted provided that the following conditions
00018  * are met:
00019  * 1. Redistributions of source code must retain the above copyright
00020  *    notice, this list of conditions and the following disclaimer.
00021  * 2. Redistributions in binary form must reproduce the above copyright
00022  *    notice, this list of conditions and the following disclaimer in the
00023  *    documentation and/or other materials provided with the distribution.
00024  * 3. Neither the name of the Institute nor the names of its contributors
00025  *    may be used to endorse or promote products derived from this software
00026  *    without specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00029  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00032  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00034  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00035  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00036  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00037  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00038  * SUCH DAMAGE.
00039  *
00040  * This file is part of the Contiki operating system.
00041  *
00042  * $Id: route.h,v 1.12 2009/08/20 20:27:17 oliverschmidt Exp $
00043  */
00044 
00045 /**
00046  * \file
00047  *         Header file for the Rime route table
00048  * \author
00049  *         Adam Dunkels <adam@sics.se>
00050  */
00051 
00052 #ifndef __ROUTE_H__
00053 #define __ROUTE_H__
00054 
00055 #include "net/rime/rimeaddr.h"
00056 
00057 struct route_entry {
00058   struct route_entry *next;
00059   rimeaddr_t dest;
00060   rimeaddr_t nexthop;
00061   uint8_t seqno;
00062   uint8_t cost;
00063   uint8_t time;
00064 
00065   uint8_t decay;
00066   uint8_t time_last_decay;
00067 };
00068 
00069 void route_init(void);
00070 int route_add(const rimeaddr_t *dest, const rimeaddr_t *nexthop,
00071               uint8_t cost, uint8_t seqno);
00072 struct route_entry *route_lookup(const rimeaddr_t *dest);
00073 void route_refresh(struct route_entry *e);
00074 void route_decay(struct route_entry *e);
00075 void route_remove(struct route_entry *e);
00076 void route_flush_all(void);
00077 void route_set_lifetime(int seconds);
00078 
00079 int route_num(void);
00080 struct route_entry *route_get(int num);
00081 
00082 #endif /* __ROUTE_H__ */
00083 /** @} */
00084 /** @} */