secgateway/Product/common/u-hashtable.h

40 lines
871 B
C

#ifndef U_HASHTABLE_H
#define U_HASHTABLE_H
#include <stdint.h>
#include <time.h>
#include "uthash.h"
typedef struct user_info
{
char name[32]; /*用户名 */
int user_id; /*用户ID */
int usergroud_id; /*用户组ID */
uint64_t message_num; /*下行报文数 */
uint64_t byte_num; /*下行字节数*/
time_t online_time; /*在线时间 */
}USER;
typedef struct user_struct
{
uint32_t ip; /*用户IP key*/
USER info; /*用户信息 */
UT_hash_handle hh;
}USER_STRUCT;
/*add user information */
void uadd_user(uint32_t user_ip, USER user_info);
/*find user information */
USER_STRUCT *ufind_user(uint32_t user_ip);
/*delete user information */
void udelete_user(USER_STRUCT *user);
/*delect all uesr'informations */
void udelete_all();
/*printf user information */
void uprint_users();
#endif