Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
Loading...
Searching...
No Matches
net_timeout.h
Go to the documentation of this file.
1
6
7
/*
8
* Copyright (c) 2018 Intel Corporation
9
* Copyright (c) 2020 Nordic Semiconductor ASA
10
*
11
* SPDX-License-Identifier: Apache-2.0
12
*/
13
14
#ifndef ZEPHYR_INCLUDE_NET_NET_TIMEOUT_H_
15
#define ZEPHYR_INCLUDE_NET_NET_TIMEOUT_H_
16
25
26
#include <
string.h
>
27
#include <
stdbool.h
>
28
#include <
limits.h
>
29
#include <
zephyr/types.h
>
30
#include <
zephyr/sys/slist.h
>
31
32
#ifdef __cplusplus
33
extern
"C"
{
34
#endif
35
50
#define NET_TIMEOUT_MAX_VALUE ((uint32_t)INT32_MAX)
51
57
struct
net_timeout
{
64
sys_snode_t
node
;
65
70
uint32_t
timer_start
;
71
78
uint32_t
timer_timeout
;
79
86
uint32_t
wrap_counter
;
87
};
88
98
void
net_timeout_set
(
struct
net_timeout
*timeout,
99
uint32_t
lifetime,
100
uint32_t
now);
101
115
int64_t
net_timeout_deadline
(
const
struct
net_timeout
*timeout,
116
int64_t
now);
117
135
uint32_t
net_timeout_remaining
(
const
struct
net_timeout
*timeout,
136
uint32_t
now);
137
156
uint32_t
net_timeout_evaluate
(
struct
net_timeout
*timeout,
157
uint32_t
now);
158
159
#ifdef __cplusplus
160
}
161
#endif
162
166
167
168
#endif
/* ZEPHYR_INCLUDE_NET_NET_TIMEOUT_H_ */
net_timeout_evaluate
uint32_t net_timeout_evaluate(struct net_timeout *timeout, uint32_t now)
Update state to reflect elapsed time and get new delay.
net_timeout_remaining
uint32_t net_timeout_remaining(const struct net_timeout *timeout, uint32_t now)
Calculate the remaining time to the timeout in whole seconds.
net_timeout_deadline
int64_t net_timeout_deadline(const struct net_timeout *timeout, int64_t now)
Return the 64-bit system time at which the timeout will complete.
net_timeout_set
void net_timeout_set(struct net_timeout *timeout, uint32_t lifetime, uint32_t now)
Configure a network timeout structure.
sys_snode_t
struct _snode sys_snode_t
Single-linked list node structure.
Definition
slist.h:42
types.h
limits.h
slist.h
Header file for the single-linked list API.
stdbool.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
int64_t
__INT64_TYPE__ int64_t
Definition
stdint.h:75
string.h
net_timeout
Generic struct for handling network timeouts.
Definition
net_timeout.h:57
net_timeout::timer_timeout
uint32_t timer_timeout
Portion of remaining timeout that does not exceed NET_TIMEOUT_MAX_VALUE.
Definition
net_timeout.h:78
net_timeout::wrap_counter
uint32_t wrap_counter
Timer wrap count.
Definition
net_timeout.h:86
net_timeout::node
sys_snode_t node
Used to link multiple timeouts that share a common timer infrastructure.
Definition
net_timeout.h:64
net_timeout::timer_start
uint32_t timer_start
Time at which the timer was last set.
Definition
net_timeout.h:70
zephyr
net
net_timeout.h
Generated on
for Zephyr API by
1.17.0