This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/src/session/session_manager.h

43 lines
1.4 KiB
C
Raw Normal View History

2023-12-13 19:20:34 +08:00
#ifndef _SESSION_MANAGER_H
#define _SESSION_MANAGER_H
#ifdef __cpluscplus
extern "C"
{
#endif
#include "session.h"
2024-01-09 18:03:24 +08:00
// #define SESSION_LOG_ERROR(format, ...) void(0)
#ifndef SESSION_LOG_ERROR
#define SESSION_LOG_ERROR(format, ...) \
fprintf(stderr, "ERROR (session), " format "\n", ##__VA_ARGS__);
2023-12-19 10:47:26 +08:00
#endif
2024-01-09 18:03:24 +08:00
// #define SESSION_LOG_DEBUG(format, ...) void(0)
#ifndef SESSION_LOG_DEBUG
#define SESSION_LOG_DEBUG(format, ...) \
fprintf(stderr, "DEBUG (session), " format "\n", ##__VA_ARGS__);
2023-12-19 10:47:26 +08:00
#endif
2023-12-13 19:20:34 +08:00
struct session_manager;
struct session_manager *session_manager_create(uint64_t max_session_num);
void session_manager_destroy(struct session_manager *mgr);
void session_manager_set_timeout_toclosing(struct session_manager *mgr, uint64_t timeout_ms);
void session_manager_set_timeout_toclosed(struct session_manager *mgr, uint64_t timeout_ms);
2023-12-19 10:47:26 +08:00
struct session *session_manager_lookup(struct session_manager *mgr, const struct packet *pkt);
2024-01-09 18:03:24 +08:00
// return null: invalid tuple6 or tcp first packet is not syn
struct session *session_manager_update(struct session_manager *mgr, const struct packet *pkt);
struct session *session_manager_expire(struct session_manager *mgr);
2024-01-15 11:21:11 +08:00
struct session *session_manager_evicte(struct session_manager *mgr);
2023-12-13 19:20:34 +08:00
2023-12-19 10:47:26 +08:00
// for debug
2024-01-09 18:03:24 +08:00
uint64_t session_manager_get_sessions(struct session_manager *mgr, enum session_type type, enum session_state state);
2023-12-19 10:47:26 +08:00
2023-12-13 19:20:34 +08:00
#ifdef __cpluscplus
}
#endif
#endif