37 lines
1.0 KiB
C
37 lines
1.0 KiB
C
|
|
#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
|