Contiki 2.5
route-discovery.h
Go to the documentation of this file.
1 /**
2  * \addtogroup rime
3  * @{
4  */
5 
6 /**
7  * \defgroup routediscovery Rime route discovery protocol
8  * @{
9  *
10  * The route-discovery module does route discovery for Rime.
11  *
12  * \section channels Channels
13  *
14  * The ibc module uses 2 channels; one for the flooded route request
15  * packets and one for the unicast route replies.
16  *
17  */
18 /*
19  * Copyright (c) 2007, Swedish Institute of Computer Science.
20  * All rights reserved.
21  *
22  * Redistribution and use in source and binary forms, with or without
23  * modification, are permitted provided that the following conditions
24  * are met:
25  * 1. Redistributions of source code must retain the above copyright
26  * notice, this list of conditions and the following disclaimer.
27  * 2. Redistributions in binary form must reproduce the above copyright
28  * notice, this list of conditions and the following disclaimer in the
29  * documentation and/or other materials provided with the distribution.
30  * 3. Neither the name of the Institute nor the names of its contributors
31  * may be used to endorse or promote products derived from this software
32  * without specific prior written permission.
33  *
34  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
35  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
38  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
40  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
41  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
43  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
44  * SUCH DAMAGE.
45  *
46  * This file is part of the Contiki operating system.
47  *
48  * $Id: route-discovery.h,v 1.11 2010/06/18 08:28:56 nifi Exp $
49  */
50 
51 /**
52  * \file
53  * Header file for the Rime mesh routing protocol
54  * \author
55  * Adam Dunkels <adam@sics.se>
56  */
57 
58 #ifndef __ROUTE_DISCOVERY_H__
59 #define __ROUTE_DISCOVERY_H__
60 
61 #include "net/rime/unicast.h"
62 #include "net/rime/netflood.h"
63 #include "sys/ctimer.h"
64 
65 struct route_discovery_conn;
66 
67 struct route_discovery_callbacks {
68  void (* new_route)(struct route_discovery_conn *c, const rimeaddr_t *to);
69  void (* timedout)(struct route_discovery_conn *c);
70 };
71 
72 #define ROUTE_DISCOVERY_ENTRIES 8
73 
74 struct route_discovery_conn {
75  struct netflood_conn rreqconn;
76  struct unicast_conn rrepconn;
77  struct ctimer t;
78  rimeaddr_t last_rreq_originator;
79  uint16_t last_rreq_id;
80  uint16_t rreq_id;
81  const struct route_discovery_callbacks *cb;
82 };
83 
84 void route_discovery_open(struct route_discovery_conn *c, clock_time_t time,
85  uint16_t channels,
86  const struct route_discovery_callbacks *callbacks);
87 int route_discovery_discover(struct route_discovery_conn *c, const rimeaddr_t *dest,
88  clock_time_t timeout);
89 
90 void route_discovery_close(struct route_discovery_conn *c);
91 
92 #endif /* __ROUTE_DISCOVERY_H__ */
93 /** @} */
94 /** @} */