-
Notifications
You must be signed in to change notification settings - Fork 0
/
uthash_my.h
32 lines (23 loc) · 837 Bytes
/
uthash_my.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef UTHASH_MY_H_INCLUDED
#define UTHASH_MY_H_INCLUDED
#include "allmyfile.h"
/*Defining a structure that can be hashed*/
struct packet
{
int id; /* key */
dl_list_node * hash_to_list;
UT_hash_handle hh; /* makes this structure hashable */
};
//declaration of hash_table
extern struct packet * hash_table;
/*add user, must make sure key is not used before adding*/
void add_user(int user_id, dl_list_node * node_pointer);
/*Find a structure using its key,return pointer when found, return NULL when not found*/
struct packet * find_user(int user_id);
/*Delete an item from a hash*/
void delete_user(struct packet *user);
/*Delete all items from a hash*/
void delete_all();
/*Count of items in the hash table,return 0 if NULL*/
unsigned int count_table();
#endif // UTHASH_MY_H_INCLUDED