1 /*
2  * The olsr.org Optimized Link-State Routing daemon (olsrd)
3  *
4  * (c) by the OLSR project
5  *
6  * See our Git repository to find out who worked on this file
7  * and thus is a copyright holder on it.
8  *
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * * Redistributions of source code must retain the above copyright
16  *   notice, this list of conditions and the following disclaimer.
17  * * Redistributions in binary form must reproduce the above copyright
18  *   notice, this list of conditions and the following disclaimer in
19  *   the documentation and/or other materials provided with the
20  *   distribution.
21  * * Neither the name of olsr.org, olsrd nor the names of its
22  *   contributors may be used to endorse or promote products derived
23  *   from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  *
38  * Visit http://www.olsr.org for more information.
39  *
40  * If you find this software useful feel free to make a donation
41  * to the project. For more information see the website or contact
42  * the copyright holders.
43  *
44  */
45 
46 #ifdef __linux__
47 #ifdef LINUX_NL80211 /* Optional - not supported on all platforms */
48 
49 #ifndef LQ_ETX_FFETH_NL80211_
50 #define LQ_ETX_FFETH_NL80211_
51 
52 #include "olsr_types.h"
53 #include "lq_plugin.h"
54 
55 #ifdef LINUX_NL80211
56 #include <net/ethernet.h>
57 #include "nl80211_link_info.h"
58 #endif
59 
60 #define LQ_ALGORITHM_ETX_FFETH_NL80211_NAME "etx_ffeth_nl80211"
61 
62 #define LQ_FFETH_WINDOW 32
63 #define LQ_FFETH_QUICKSTART_INIT 4
64 
65 struct lq_ffeth {
66   uint8_t valueLq;
67   uint8_t valueNlq;
68 #ifdef LINUX_NL80211
69   uint8_t valueBandwidth;
70   uint8_t valueRSSI;
71 #endif
72 };
73 
74 struct lq_ffeth_hello {
75   struct lq_ffeth smoothed_lq;
76   struct lq_ffeth lq;
77   uint8_t windowSize, activePtr;
78   uint16_t last_seq_nr;
79   uint16_t missed_hellos;
80   bool perfect_eth;
81   uint16_t received[LQ_FFETH_WINDOW], total[LQ_FFETH_WINDOW];
82 };
83 
84 extern struct lq_handler lq_etx_ffeth_nl80211_handler;
85 
86 #endif /* LQ_ETX_FFETH_NL80211_ */
87 
88 #endif /* LINUX_NL80211 */
89 #endif /* __linux__ */
90 
91 /*
92  * Local Variables:
93  * c-basic-offset: 2
94  * indent-tabs-mode: nil
95  * End:
96  */
97