📄 hust_hash.h
字号:
/* * $Id: hash.h,v 1.3 2000/03/01 03:21:02 evangemh Exp $ */#ifndef HASH_H#define HASH_H////#include <pthread.h>/* structure for hashtable entry */struct htent { unsigned long int hte_key; /* key; may be pointer */ void *hte_object; /* pointer to object */ struct htent *hte_chain; /* next htent in bucket */};/* structure for hashtable */struct ht { struct htent **ht_entries; /* array of buckets */ int (* ht_hashfcn)(unsigned long int, u8_t);/* ptr to hash function */ int (* ht_cmpfcn)(unsigned long int, unsigned long int); /* ptr to comparison function; should return 0 on equal. *//// void (* ht_destroykeyfcn)(unsigned long int); /* ptr to function to destroy or free key *//// void (* ht_destroyobjectfcn)(void *); /* ptr to function to destroy or free object */ ////这里即是rtpdestroystream函数。 u8_t ht_destroy; u8_t ht_size; /* number of buckets */ ////规定一个哈希表中可含有的最多的bulks ////这里他的值为RTP_SSRCHTSZ(27) int ht_count; /* number of items in table */ ///////pthread_mutex_t ht_writepend; /* mutexes and counters to */ ///////pthread_mutex_t ht_readblk; /* implement basic readers */ ///////pthread_mutex_t ht_writeblk; /* writers locking with */ ///////pthread_mutex_t ht_rdcntmutex; /* priority given to writers. */ ///////pthread_mutex_t ht_wrcntmutex; int ht_readcnt; int ht_writecnt;};/* API calls */char* htget(struct ht *, unsigned long int);struct ht* htnew(u8_t, int(*)(unsigned long int, u8_t), int(*)(unsigned long int, unsigned long int), u8_t);int htadd(struct ht *, unsigned long int, void *);int htdel(struct ht *, unsigned long int);int htdestroy(struct ht *);int htcount(struct ht *);struct htent **htenum(struct ht *);/* Internal calls */struct htent *htgetent(struct ht *, unsigned long int);void htreaderbegin(struct ht *);void htreaderend(struct ht *);void htwriterbegin(struct ht *);void htwriterend(struct ht *);/* Hash and comparison functions */int hashstring(unsigned long int, u8_t);int hashunsignedint(unsigned long int, u8_t);int unsignedinteq(unsigned long int, unsigned long int);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -