secgateway/Product/common/user_hashtable.h

33 lines
612 B
C
Raw Normal View History

#ifndef K_HASHTABLE_H
#define K_HASHTABLE_H
#include <stdint.h>
#include "hlist.h"
typedef struct user_info{
struct hlist_node hnode;
int id;
uint32_t ip;
}USER_INFO;
/*计算hash值 */
struct hlist_head *call_hash(struct hlist_head *hash, uint32_t ip);
/*初始化函数 */
int Init_hash();
/*查找用户信息*/
struct user_info *ufind_user(uint32_t user_ip);
/*增加用户信息*/
int uadd_user(uint32_t user_ip, int user_id);
/*删除用户信息 */
void udelete_user(int user_ip);
/*删除所有的hash节点 */
void udelete_all();
/*打印所有信息信息 */
void uprintf_users();
#endif