FD.io VPP
v20.09-64-g4f7b92f0a
Vector Packet Processing
wireguard_timer.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 Doc.ai and/or its affiliates.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
16
#ifndef __included_wg_timer_h__
17
#define __included_wg_timer_h__
18
19
#include <
vlib/vlib.h
>
20
#include <
vppinfra/clib.h
>
21
#include <
vppinfra/tw_timer_16t_2w_512sl.h
>
22
23
/** WG timers */
24
#define foreach_wg_timer \
25
_(RETRANSMIT_HANDSHAKE, "RETRANSMIT HANDSHAKE") \
26
_(PERSISTENT_KEEPALIVE, "PERSISTENT KEEPALIVE") \
27
_(SEND_KEEPALIVE, "SEND KEEPALIVE") \
28
_(NEW_HANDSHAKE, "NEW HANDSHAKE") \
29
_(KEY_ZEROING, "KEY ZEROING") \
30
31
typedef
enum
_wg_timers
32
{
33
#define _(sym, str) WG_TIMER_##sym,
34
foreach_wg_timer
35
#undef _
36
WG_N_TIMERS
37
}
wg_timers_e
;
38
39
typedef
struct
wg_peer
wg_peer_t
;
40
41
void
wg_timer_wheel_init
();
42
void
wg_timers_stop
(
wg_peer_t
*
peer
);
43
void
wg_timers_data_sent
(
wg_peer_t
*
peer
);
44
void
wg_timers_data_received
(
wg_peer_t
*
peer
);
45
void
wg_timers_any_authenticated_packet_sent
(
wg_peer_t
*
peer
);
46
void
wg_timers_any_authenticated_packet_received
(
wg_peer_t
*
peer
);
47
void
wg_timers_handshake_initiated
(
wg_peer_t
*
peer
);
48
void
wg_timers_handshake_complete
(
wg_peer_t
*
peer
);
49
void
wg_timers_session_derived
(
wg_peer_t
*
peer
);
50
void
wg_timers_any_authenticated_packet_traversal
(
wg_peer_t
*
peer
);
51
52
53
static
inline
bool
54
wg_birthdate_has_expired
(
f64
birthday_seconds,
f64
expiration_seconds)
55
{
56
f64
now_seconds =
vlib_time_now
(
vlib_get_main
());
57
return
(birthday_seconds + expiration_seconds) < now_seconds;
58
}
59
60
61
#endif
/* __included_wg_timer_h__ */
62
63
/*
64
* fd.io coding-style-patch-verification: ON
65
*
66
* Local Variables:
67
* eval: (c-set-style "gnu")
68
* End:
69
*/
wg_timers_handshake_complete
void wg_timers_handshake_complete(wg_peer_t *peer)
Definition:
wireguard_timer.c:264
wg_timers_handshake_initiated
void wg_timers_handshake_initiated(wg_peer_t *peer)
Definition:
wireguard_timer.c:216
wg_timers_any_authenticated_packet_sent
void wg_timers_any_authenticated_packet_sent(wg_peer_t *peer)
Definition:
wireguard_timer.c:210
wg_timers_e
enum _wg_timers wg_timers_e
vlib_time_now
static f64 vlib_time_now(vlib_main_t *vm)
Definition:
main.h:333
WG_N_TIMERS
Definition:
wireguard_timer.h:36
f64
double f64
Definition:
types.h:142
wg_timers_stop
void wg_timers_stop(wg_peer_t *peer)
Definition:
wireguard_timer.c:358
wg_timers_data_sent
void wg_timers_data_sent(wg_peer_t *peer)
Definition:
wireguard_timer.c:237
wg_timers_any_authenticated_packet_traversal
void wg_timers_any_authenticated_packet_traversal(wg_peer_t *peer)
Definition:
wireguard_timer.c:199
wg_timers_data_received
void wg_timers_data_received(wg_peer_t *peer)
Definition:
wireguard_timer.c:249
foreach_wg_timer
#define foreach_wg_timer
WG timers.
Definition:
wireguard_timer.h:24
tw_timer_16t_2w_512sl.h
peer
vl_api_address_t peer
Definition:
teib.api:28
wg_birthdate_has_expired
static bool wg_birthdate_has_expired(f64 birthday_seconds, f64 expiration_seconds)
Definition:
wireguard_timer.h:54
clib.h
wg_peer
Definition:
wireguard_peer.h:47
vlib.h
wg_timer_wheel_init
void wg_timer_wheel_init()
Definition:
wireguard_timer.c:330
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition:
global_funcs.h:23
wg_timers_session_derived
void wg_timers_session_derived(wg_peer_t *peer)
Definition:
wireguard_timer.c:227
wg_timers_any_authenticated_packet_received
void wg_timers_any_authenticated_packet_received(wg_peer_t *peer)
Definition:
wireguard_timer.c:271
src
plugins
wireguard
wireguard_timer.h
Generated on Thu Jun 3 2021 16:05:09 for FD.io VPP by
1.8.13