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

37 lines
1.0 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"
/*
* session manager = session pool + session table + session timer
*
* session pool : alloc and free session
* session table : find session by session id or session addr
* session timer : session timeout
* session manager: manage session pool, session table and session timer
*/
struct session_manager;
struct session_manager *session_manager_create(uint64_t max_session_num);
void session_manager_destroy(struct session_manager *mgr);
typedef void (*session_event_cb)(struct session *sess, uint32_t event, void *arg);
void session_manager_set_session_eventcb(struct session_manager *mgr, session_event_cb cb, void *arg);
struct session *session_manager_find_session_by_id(struct session_manager *mgr, uint64_t id);
struct session *session_manager_find_session_by_packet(struct session_manager *mgr, const struct packet *pkt);
void session_manager_dispatch(struct session_manager *mgr);
#ifdef __cpluscplus
}
#endif
#endif