Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
0004  */
0005 
0006 #ifndef _WG_TIMERS_H
0007 #define _WG_TIMERS_H
0008 
0009 #include <linux/ktime.h>
0010 
0011 struct wg_peer;
0012 
0013 void wg_timers_init(struct wg_peer *peer);
0014 void wg_timers_stop(struct wg_peer *peer);
0015 void wg_timers_data_sent(struct wg_peer *peer);
0016 void wg_timers_data_received(struct wg_peer *peer);
0017 void wg_timers_any_authenticated_packet_sent(struct wg_peer *peer);
0018 void wg_timers_any_authenticated_packet_received(struct wg_peer *peer);
0019 void wg_timers_handshake_initiated(struct wg_peer *peer);
0020 void wg_timers_handshake_complete(struct wg_peer *peer);
0021 void wg_timers_session_derived(struct wg_peer *peer);
0022 void wg_timers_any_authenticated_packet_traversal(struct wg_peer *peer);
0023 
0024 static inline bool wg_birthdate_has_expired(u64 birthday_nanoseconds,
0025                         u64 expiration_seconds)
0026 {
0027     return (s64)(birthday_nanoseconds + expiration_seconds * NSEC_PER_SEC)
0028         <= (s64)ktime_get_coarse_boottime_ns();
0029 }
0030 
0031 #endif /* _WG_TIMERS_H */