Contiki 2.5
routing.h
Go to the documentation of this file.
1 /**
2  * \addtogroup agent
3  * @{
4  */
5 
6 /**
7  * \defgroup routing Routing modules
8  *
9  * @{
10  */
11 
12 /**
13  * \file
14  * \brief this file defines the interface for routing modules
15  * \author Georg von Zengen <vonzeng@ibr.cs.tu-bs.de>
16  * \author Wolf-Bastian Poettner <poettner@ibr.cs.tu-bs.de>
17  */
18 
19 #ifndef __ROUTING_H__
20 #define __ROUTING_H__
21 
22 #include <stdlib.h>
23 #include <stdio.h>
24 
25 #include "contiki.h"
26 #include "net/rime/rimeaddr.h"
27 #include "lib/memb.h"
28 #include "list.h"
29 
30 #include "bundle.h"
31 #include "convergence_layer.h"
32 
33 /**
34  * Which routing driver are we going to use?
35  */
36 #ifdef CONF_ROUTING
37 #define ROUTING CONF_ROUTING
38 #else
39 #define ROUTING routing_flooding
40 #endif
41 
42 /**
43  * For each bundle, how many neighbours to which
44  * the bundle has been sent before should be stored?
45  */
46 #define ROUTING_NEI_MEM 2
47 
48 /**
49  * Routing bundle Flags
50  */
51 #define ROUTING_FLAG_IN_DELIVERY 0x01
52 #define ROUTING_FLAG_LOCAL 0x02
53 #define ROUTING_FLAG_FORWARD 0x04
54 #define ROUTING_FLAG_IN_TRANSIT 0x08
55 
56 /**
57  * Routing sent status reports
58  */
59 #define ROUTING_STATUS_OK 0x01
60 #define ROUTING_STATUS_FAIL 0x02
61 #define ROUTING_STATUS_NACK 0x04
62 #define ROUTING_STATUS_ERROR 0x08
63 
64 PROCESS_NAME(routing_process);
65 
66 /** the route_t struct is used to inform the network interface which bundle should be transmitted to whicht node*/
67 struct route_t {
68  /** address of the next hop node */
69  rimeaddr_t dest;
70 
71  /** bundle_num of the bundle */
72  uint32_t bundle_num;
73 };
74 
75 /** Interface for routing modules */
77  char *name;
78  /** module init, called by agent at startup*/
79  void (* init)(void);
80  /** informs the module about a new neighbor */
81  void (* new_neighbor)(rimeaddr_t * dest);
82  /** informs the module about a new bundel */
83  int (* new_bundle)(uint32_t * bundle_num);
84  /** delete bundle form routing list */
85  void (* del_bundle)(uint32_t bundle_num);
86  /** callback function is called by convergence layer */
87  void (* sent)(struct transmit_ticket_t * ticket, uint8_t status);
88  /** function to resubmit bundles currently in storage */
89  void (* resubmit_bundles)();
90  /** notify storage, that bundle has been delivered locally */
91  void (* locally_delivered)(struct mmem * bundlemem);
92 };
93 extern const struct routing_driver ROUTING;
94 
95 #endif
96 /** @} */
97 /** @} */