Contiki 2.5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
core
net
rime
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
* $Id: collect-link-estimate.h,v 1.4 2011/01/09 21:14:22 adamdunkels Exp $
46
*/
47
48
/**
49
* \file
50
* Header file for the Collect link estimate
51
* \author
52
* Adam Dunkels <adam@sics.se>
53
*/
54
55
#ifndef COLLECT_LINK_ESTIMATE_H
56
#define COLLECT_LINK_ESTIMATE_H
57
58
#define COLLECT_LINK_ESTIMATE_UNIT 8
59
60
61
62
struct
collect_link_estimate
{
63
uint32_t etx_accumulator;
64
uint8_t num_estimates;
65
};
66
67
/**
68
* \brief Initialize a new link estimate
69
* \param le A pointer to a link estimate structure
70
*
71
* This function initializes a link estimate.
72
*/
73
void
collect_link_estimate_new
(
struct
collect_link_estimate
*le);
74
75
/**
76
* \brief Update a link estimate when a packet has been sent.
77
* \param le A pointer to a link estimate structure
78
* \param num_tx The number of times the packet was transmitted before it was ACKed
79
*
80
* This function updates a link estimate. This function is
81
* called when a packet has been sent. The function may
82
* use information from the packet buffer and the packet
83
* buffer attributes when computing the link estimate.
84
*/
85
void
collect_link_estimate_update_tx
(
struct
collect_link_estimate
*le,
86
uint8_t num_tx);
87
88
/**
89
* \brief Update a link estimate when a packet has failed to be sent.
90
* \param le A pointer to a link estimate structure
91
* \param num_tx The number of times the packet was transmitted before it was given up on.
92
*
93
* This function updates a link estimate. This function is
94
* called when a packet has been sent. The function may
95
* use information from the packet buffer and the packet
96
* buffer attributes when computing the link estimate.
97
*/
98
void
collect_link_estimate_update_tx_fail
(
struct
collect_link_estimate
*le,
99
uint8_t num_tx);
100
101
/**
102
* \brief Update a link estimate when a packet has been received.
103
* \param le A pointer to a link estimate structure
104
*
105
* This function updates a link estimate. This function is
106
* called when a packet has been received. The function
107
* uses information from the packet buffer and its
108
* attributes.
109
*/
110
void
collect_link_estimate_update_rx
(
struct
collect_link_estimate
*le);
111
112
113
/**
114
* \brief Compute the link estimate metric for a link estimate
115
* \param le A pointer to a link estimate structure
116
* \return The current link estimate metric
117
*
118
*/
119
uint16_t
collect_link_estimate
(
struct
collect_link_estimate
*le);
120
121
int
collect_link_estimate_num_estimates(
struct
collect_link_estimate
*le);
122
123
#endif
/* COLLECT_LINK_ESTIMATE_H */
124
125
/** @} */
Generated on Fri Aug 30 2013 12:34:05 for Contiki 2.5 by
1.8.3.1