Loading...
Searching...
No Matches
neighbor.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Koen Zandberg <koen@bergzand.net>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include <string.h>
20#include "net/netif.h"
21#include "timex.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
36
37
45#define NETSTATS_NB_EWMA_SCALE 100
46
50#define NETSTATS_NB_EWMA_ALPHA 15
51
55#define NETSTATS_NB_EWMA_ALPHA_RAMP 30
57
65#define NETSTATS_NB_ETX_NOACK_PENALTY 6
69#define NETSTATS_NB_ETX_DIVISOR 128
73#define NETSTATS_NB_ETX_INIT 2
75
83#define NETSTATS_NB_FRESHNESS_HALF 600
87#define NETSTATS_NB_FRESHNESS_TARGET 4
91#define NETSTATS_NB_FRESHNESS_MAX 16
95#define NETSTATS_NB_FRESHNESS_EXPIRATION 1200
105#define NETSTATS_NB_TX_TIMEOUT_MS 100
107
115
126bool netstats_nb_get(netif_t *netif, const uint8_t *l2_addr, uint8_t len, netstats_nb_t *out);
127
139void netstats_nb_record(netif_t *netif, const uint8_t *l2_addr, uint8_t len);
140
157 uint8_t transmissions);
158
170netstats_nb_t *netstats_nb_update_rx(netif_t *netif, const uint8_t *l2_addr,
171 uint8_t l2_addr_len, uint8_t rssi, uint8_t lqi);
172
182
183#ifdef __cplusplus
184}
185#endif
186
bool netstats_nb_isfresh(netif_t *netif, netstats_nb_t *stats)
Check if a record is fresh.
netstats_nb_t * netstats_nb_update_rx(netif_t *netif, const uint8_t *l2_addr, uint8_t l2_addr_len, uint8_t rssi, uint8_t lqi)
Record rx stats for the l2_addr.
void netstats_nb_init(netif_t *netif)
Initialize the neighbor stats.
void netstats_nb_record(netif_t *netif, const uint8_t *l2_addr, uint8_t len)
Store this neighbor as next in the transmission queue.
netstats_nb_result_t
Result of the transmission.
Definition neighbor.h:31
@ NETSTATS_NB_NOACK
Failed due to no ack received.
Definition neighbor.h:33
@ NETSTATS_NB_BUSY
Failed due to medium busy.
Definition neighbor.h:34
@ NETSTATS_NB_SUCCESS
Successful transmission.
Definition neighbor.h:32
bool netstats_nb_get(netif_t *netif, const uint8_t *l2_addr, uint8_t len, netstats_nb_t *out)
Find a neighbor stat by the mac address.
netstats_nb_t * netstats_nb_update_tx(netif_t *netif, netstats_nb_result_t result, uint8_t transmissions)
Update the next recorded neighbor with the provided numbers.
Common network interface API definitions.
Network interface descriptor.
Definition netif.h:68
Stats per peer struct.
Definition netstats.h:72
Utility library for comparing and computing timestamps.