Contiki 2.5
discovery.h
Go to the documentation of this file.
1 /**
2  * \addtogroup agent
3  * @{
4  */
5 
6 /**
7  * \defgroup discovery Discovery modules
8  *
9  * @{
10  */
11 
12 /**
13  * \file
14  * \brief defines the interface for discovery modules
15  * \author Georg von Zengen <vonzeng@ibr.cs.tu-bs.de>
16  */
17 
18 #ifndef DISCOVERY_H
19 #define DISCOVERY_H
20 
21 #include "contiki.h"
22 #include "rime.h"
23 #include "process.h"
24 
25 /**
26  * Which discovery driver are we going to use?
27  */
28 #ifdef CONF_DISCOVERY
29 #define DISCOVERY CONF_DISCOVERY
30 #else
31 #define DISCOVERY discovery_ipnd
32 #endif
33 
34 PROCESS_NAME(discovery_process);
35 
36 struct discovery_neighbour_list_entry {
37  struct discovery_neighbour_list_entry *next;
38  rimeaddr_t neighbour;
39 };
40 
41 /** interface for discovery modules */
43  char *name;
44 
45  /**
46  * Initialize discovery module
47  */
48  void (* init)();
49 
50  /**
51  * Ask discovery, if this node is currently in range
52  * return 1 if yes,
53  * return 0 otherwise
54  */
55  uint8_t (* is_neighbour)(rimeaddr_t * dest);
56 
57  /**
58  * Enable discovery module
59  */
60  void (* enable)();
61 
62  /**
63  * Disable discovery module
64  */
65  void (* disable)();
66 
67  /**
68  * Pass incoming discovery beacons to the discovery module
69  */
70  void (* receive)(rimeaddr_t * source, uint8_t * payload, uint8_t length);
71 
72  /**
73  * Bundle from node has been received, cache this node as available
74  */
75  void (* alive)(rimeaddr_t * source);
76 
77  /**
78  * Multiple transmission attempts to this neighbour have failed
79  */
80  void (* dead)(rimeaddr_t * destination);
81 
82  /**
83  * Starts to discover a neighbour
84  */
85  uint8_t (* discover)(rimeaddr_t * dest);
86 
87  /**
88  * Returns the list of currently known neighbours
89  */
90  struct discovery_neighbour_list_entry * (* neighbours)();
91 
92  /**
93  * Stops pending discoveries
94  */
95  void (* stop_pending)();
96 };
97 
98 extern const struct discovery_driver DISCOVERY;
99 
100 #endif
101 /** @} */
102 /** @} */