Add session table & session
This commit is contained in:
33
src/session/session_table.h
Normal file
33
src/session/session_table.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef _SESSION_TABLE_H
|
||||
#define _SESSION_TABLE_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "session.h"
|
||||
|
||||
struct session_table;
|
||||
struct session_table *session_table_create();
|
||||
void session_table_destroy(struct session_table *table);
|
||||
uint64_t session_table_get_count(struct session_table *table);
|
||||
|
||||
typedef void (*session_free_cb)(struct session *sess, void *arg);
|
||||
void session_table_set_freecb(struct session_table *table, session_free_cb free_cb, void *arg);
|
||||
/*
|
||||
* Before add session:
|
||||
* user must set session id and session address.
|
||||
* must not add session with same id or same address.
|
||||
*/
|
||||
void session_table_add_session(struct session_table *table, struct session *sess);
|
||||
void session_table_delete_session_with_id(struct session_table *table, uint64_t id);
|
||||
void session_table_delete_session_with_addr(struct session_table *table, struct session_address *addr);
|
||||
struct session *session_table_search_session_with_id(struct session_table *table, uint64_t id);
|
||||
struct session *session_table_search_session_with_addr(struct session_table *table, struct session_address *addr);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user