Zephyr API Documentation
4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
trickle.h
Go to the documentation of this file.
1
7
/*
8
* Copyright (c) 2016 Intel Corporation
9
*
10
* SPDX-License-Identifier: Apache-2.0
11
*/
12
13
#ifndef ZEPHYR_INCLUDE_NET_TRICKLE_H_
14
#define ZEPHYR_INCLUDE_NET_TRICKLE_H_
15
16
#include <
stdbool.h
>
17
#include <
zephyr/types.h
>
18
19
#include <
zephyr/kernel.h
>
20
#include <
zephyr/net/net_core.h
>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
35
struct
net_trickle
;
36
47
typedef
void (*
net_trickle_cb_t
)(
struct
net_trickle
*trickle,
48
bool
do_suppress,
void
*
user_data
);
49
55
struct
net_trickle
{
56
uint32_t
I
;
57
uint32_t
Imin
;
58
uint32_t
Istart
;
59
uint32_t
Imax_abs
;
60
uint8_t
Imax
;
62
uint8_t
k
;
63
uint8_t
c
;
65
bool
double_to
;
67
struct
k_work_delayable
timer
;
68
net_trickle_cb_t
cb
;
69
void
*
user_data
;
70
};
71
73
#define NET_TRICKLE_INFINITE_REDUNDANCY 0
86
int
net_trickle_create
(
struct
net_trickle
*trickle,
87
uint32_t
Imin,
88
uint8_t
Imax,
89
uint8_t
k);
90
101
int
net_trickle_start
(
struct
net_trickle
*trickle,
102
net_trickle_cb_t
cb,
103
void
*
user_data
);
104
112
int
net_trickle_stop
(
struct
net_trickle
*trickle);
113
120
void
net_trickle_consistency
(
struct
net_trickle
*trickle);
121
128
void
net_trickle_inconsistency
(
struct
net_trickle
*trickle);
129
137
static
inline
bool
net_trickle_is_running
(
struct
net_trickle
*trickle)
138
{
139
if
(trickle ==
NULL
) {
140
return
false
;
141
}
142
143
return
trickle->
I
!= 0U;
144
}
145
150
#ifdef __cplusplus
151
}
152
#endif
153
154
#endif
/* ZEPHYR_INCLUDE_NET_TRICKLE_H_ */
net_trickle_start
int net_trickle_start(struct net_trickle *trickle, net_trickle_cb_t cb, void *user_data)
Start a Trickle timer.
net_trickle_stop
int net_trickle_stop(struct net_trickle *trickle)
Stop a Trickle timer.
net_trickle_is_running
static bool net_trickle_is_running(struct net_trickle *trickle)
Check if the Trickle timer is running or not.
Definition
trickle.h:137
net_trickle_create
int net_trickle_create(struct net_trickle *trickle, uint32_t Imin, uint8_t Imax, uint8_t k)
Create a Trickle timer.
net_trickle_consistency
void net_trickle_consistency(struct net_trickle *trickle)
To be called by the protocol handler when it hears a consistent network transmission.
net_trickle_inconsistency
void net_trickle_inconsistency(struct net_trickle *trickle)
To be called by the protocol handler when it hears an inconsistent network transmission.
net_trickle_cb_t
void(* net_trickle_cb_t)(struct net_trickle *trickle, bool do_suppress, void *user_data)
Trickle timer callback.
Definition
trickle.h:47
NULL
#define NULL
Definition
iar_missing_defs.h:20
types.h
user_data
static const intptr_t user_data[5]
Definition
main.c:588
kernel.h
Public kernel APIs.
net_core.h
Network core definitions.
stdbool.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
k_work_delayable
A structure used to submit work after a delay.
Definition
kernel.h:4063
net_trickle
The variable names are taken directly from RFC 6206 when applicable.
Definition
trickle.h:55
net_trickle::Imax
uint8_t Imax
Max number of doublings.
Definition
trickle.h:60
net_trickle::double_to
bool double_to
Flag telling if the internval is doubled.
Definition
trickle.h:65
net_trickle::timer
struct k_work_delayable timer
Internal timer struct.
Definition
trickle.h:67
net_trickle::user_data
void * user_data
User specific opaque data.
Definition
trickle.h:69
net_trickle::I
uint32_t I
Current interval size.
Definition
trickle.h:56
net_trickle::cb
net_trickle_cb_t cb
Callback to be called when timer expires.
Definition
trickle.h:68
net_trickle::k
uint8_t k
Redundancy constant.
Definition
trickle.h:62
net_trickle::c
uint8_t c
Consistency counter.
Definition
trickle.h:63
net_trickle::Istart
uint32_t Istart
Start of the interval in ms.
Definition
trickle.h:58
net_trickle::Imin
uint32_t Imin
Min interval size in ms.
Definition
trickle.h:57
net_trickle::Imax_abs
uint32_t Imax_abs
Max interval size in ms (not doublings)
Definition
trickle.h:59
zephyr
net
trickle.h
Generated on Mon Apr 21 2025 11:55:49 for Zephyr API Documentation by
1.12.0