/* * conn_manager.h * * Created on: Sep 15, 2017 * Author: root */ #ifndef CONN_MANAGER_H_ #define CONN_MANAGER_H_ #include "common.h" #include "log.h" extern int disable_conv_clear; struct conn_manager_t //TODO change map to unordered map { //typedef hash_map map; unordered_map u64_to_fd; //conv and u64 are both supposed to be uniq unordered_map fd_to_u64; unordered_map fd_last_active_time; unordered_map::iterator clear_it; unordered_map::iterator it; unordered_map::iterator old_it; //void (*clear_function)(uint64_t u64) ; long long last_clear_time; list clear_list; conn_manager_t(); ~conn_manager_t(); int get_size(); void rehash(); void clear(); int exist_fd(u32_t fd); int exist_u64(u64_t u64); u32_t find_fd_by_u64(u64_t u64); u64_t find_u64_by_fd(u32_t fd); int update_active_time(u32_t fd); int insert_fd(u32_t fd,u64_t u64); int erase_fd(u32_t fd); void check_clear_list(); int clear_inactive(); int clear_inactive0(); }; #endif /* CONN_MANAGER_H_ */