blob: 56b2f7912c4ff4f5e104495212544b2983b737b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
struct session_timer;
struct session_timer *session_timer_new(uint64_t now);
void session_timer_free(struct session_timer *timer);
void session_timer_update(struct session_timer *timer, struct session *sess, uint64_t expires);
void session_timer_add(struct session_timer *timer, struct session *sess, uint64_t expires);
void session_timer_del(struct session_timer *timer, struct session *sess);
/*
* return one session which timeout, or NULL if no session timeout.
* if return session, the session will be removed from timer.
*/
struct session *session_timer_expire(struct session_timer *timer, uint64_t abs_current_ts);
// return 0: have already timeout session
// return >0: next expire interval
uint64_t session_timer_next_expire_interval(struct session_timer *timer);
#ifdef __cplusplus
}
#endif
|