Contiki-Inga 3.x
collect-link-estimate.h
Go to the documentation of this file.
1 /**
2  * \addtogroup rime
3  * @{
4  */
5 /**
6  * \defgroup rimelinkestimate Link estimate management
7  *
8  * The link estimate module is used for computing estimations of link
9  * quality. It computes a quality index for links, based on
10  * information about how many times a packet has been transmitted, as
11  * well as information about incoming packets. The link estimate
12  * module exposes an interface that provides functions that are called
13  * for incoming and outgoing packets.
14  */
15 /*
16  * Copyright (c) 2010, Swedish Institute of Computer Science.
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions
21  * are met:
22  * 1. Redistributions of source code must retain the above copyright
23  * notice, this list of conditions and the following disclaimer.
24  * 2. Redistributions in binary form must reproduce the above copyright
25  * notice, this list of conditions and the following disclaimer in the
26  * documentation and/or other materials provided with the distribution.
27  * 3. Neither the name of the Institute nor the names of its contributors
28  * may be used to endorse or promote products derived from this software
29  * without specific prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
32  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
35  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41  * SUCH DAMAGE.
42  *
43  * This file is part of the Contiki operating system.
44  *
45  */
46 
47 /**
48  * \file
49  * Header file for the Collect link estimate
50  * \author
51  * Adam Dunkels <adam@sics.se>
52  */
53 
54 #ifndef COLLECT_LINK_ESTIMATE_H
55 #define COLLECT_LINK_ESTIMATE_H
56 
57 #define COLLECT_LINK_ESTIMATE_UNIT 8
58 
59 
60 
61 struct collect_link_estimate {
62  uint32_t etx_accumulator;
63  uint8_t num_estimates;
64 };
65 
66 /**
67  * \brief Initialize a new link estimate
68  * \param le A pointer to a link estimate structure
69  *
70  * This function initializes a link estimate.
71  */
73 
74 /**
75  * \brief Update a link estimate when a packet has been sent.
76  * \param le A pointer to a link estimate structure
77  * \param num_tx The number of times the packet was transmitted before it was ACKed
78  *
79  * This function updates a link estimate. This function is
80  * called when a packet has been sent. The function may
81  * use information from the packet buffer and the packet
82  * buffer attributes when computing the link estimate.
83  */
85  uint8_t num_tx);
86 
87 /**
88  * \brief Update a link estimate when a packet has failed to be sent.
89  * \param le A pointer to a link estimate structure
90  * \param num_tx The number of times the packet was transmitted before it was given up on.
91  *
92  * This function updates a link estimate. This function is
93  * called when a packet has been sent. The function may
94  * use information from the packet buffer and the packet
95  * buffer attributes when computing the link estimate.
96  */
98  uint8_t num_tx);
99 
100 /**
101  * \brief Update a link estimate when a packet has been received.
102  * \param le A pointer to a link estimate structure
103  *
104  * This function updates a link estimate. This function is
105  * called when a packet has been received. The function
106  * uses information from the packet buffer and its
107  * attributes.
108  */
110 
111 
112 /**
113  * \brief Compute the link estimate metric for a link estimate
114  * \param le A pointer to a link estimate structure
115  * \return The current link estimate metric
116  *
117  */
118 uint16_t collect_link_estimate(struct collect_link_estimate *le);
119 
120 int collect_link_estimate_num_estimates(struct collect_link_estimate *le);
121 
122 #endif /* COLLECT_LINK_ESTIMATE_H */
123 
124 /** @} */