亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hust_hash_qiu_5.20.c

?? 實現(xiàn)基于ip2022的MPEG2 TS的IP組播接收
?? C
字號:
/*------------------------------------------------------------------------- * hash.c - htnew, htreaderbegin, htreaderend, htwriterbegin, htwriterend, * htget, htgetent, htdel, htadd, hashstring, hashunsignedint, htcount, * htenum, htdestroy, unsignedinteq *------------------------------------------------------------------------- */////#include <stdio.h>#include "ipOS.h"#include "ipHAL.h"#include "hust_rtp.h"#include "hust_hash.h"/////#include <stdlib.h>/////#include <strings.h>/*------------------------------------------------------------------------ * htnew - create and return pointer to a new hashtable  *------------------------------------------------------------------------ */struct ht *htnew(u8_t size, int(* hashfcn)(unsigned long int, u8_t), int(* cmpfcn)(unsigned long int, unsigned long int), u8_t destroytype){	struct ht		*ht;  	ht = (struct ht *) heap_alloc(sizeof(struct ht));		memset(ht,0,sizeof(struct ht));	if (ht == NULL) 		return NULL;	/*pthread_mutex_init(&ht->ht_writepend, NULL);	pthread_mutex_init(&ht->ht_readblk, NULL);	pthread_mutex_init(&ht->ht_writeblk, NULL);	pthread_mutex_init(&ht->ht_rdcntmutex, NULL);	pthread_mutex_init(&ht->ht_wrcntmutex, NULL);*/	ht->ht_readcnt = 0;	ht->ht_writecnt = 0;	ht->ht_entries = (struct htent **) heap_alloc(sizeof(struct htent *) * size);		memset(ht->ht_entries,0,sizeof(struct htent *) * size);		ht->ht_count = 0;	ht->ht_hashfcn = hashfcn;	ht->ht_cmpfcn = cmpfcn;	ht->ht_destroy = destroytype;		if (ht->ht_entries == NULL) {		heap_free(ht);		return NULL;	}	memset((char *)ht->ht_entries,0, size * sizeof(struct htent *));	ht->ht_size = size;  	return ht;}//////新建一個哈希表,并返回該表的指針。在初始化一個session時被調用。/*------------------------------------------------------------------------ * htreaderbegin - to be called before reader access for locking *------------------------------------------------------------------------ */voidhtreaderbegin(struct ht *ht){	/*pthread_mutex_lock(&ht->ht_writepend);	pthread_mutex_lock(&ht->ht_readblk);	pthread_mutex_lock(&ht->ht_rdcntmutex);*/  	/*if ((++(ht->ht_readcnt)) == 1) {		pthread_mutex_lock(&ht->ht_writeblk);	}	pthread_mutex_unlock(&ht->ht_rdcntmutex);	pthread_mutex_unlock(&ht->ht_readblk);	pthread_mutex_unlock(&ht->ht_writepend);*/}/////*------------------------------------------------------------------------ * htreaderend - to be called after reader access for locking *------------------------------------------------------------------------ */voidhtreaderend(struct ht *ht){	/*pthread_mutex_lock(&ht->ht_rdcntmutex);	if (--ht->ht_readcnt == 0) {		pthread_mutex_unlock(&ht->ht_writeblk);	}	pthread_mutex_unlock(&ht->ht_rdcntmutex);*/}/*------------------------------------------------------------------------ * htwriterbegin - to be called before writer access for locking *------------------------------------------------------------------------ */voidhtwriterbegin(struct ht *ht){	/*pthread_mutex_lock(&ht->ht_wrcntmutex);	if ((++(ht->ht_writecnt)) == 1)		pthread_mutex_lock(&ht->ht_readblk);	pthread_mutex_unlock(&ht->ht_wrcntmutex);	pthread_mutex_lock(&ht->ht_writeblk);*/}/*------------------------------------------------------------------------ * htwriterend - to be called after writer access for locking *------------------------------------------------------------------------ */voidhtwriterend(struct ht *ht){	/*pthread_mutex_unlock(&ht->ht_writeblk);	pthread_mutex_lock(&ht->ht_wrcntmutex);	if ((--(ht->ht_writecnt)) == 0)		pthread_mutex_unlock(&ht->ht_readblk);	pthread_mutex_unlock(&ht->ht_wrcntmutex);*/}/*------------------------------------------------------------------------ * htget - retreive an object from the ht  *------------------------------------------------------------------------ */char *htget(struct ht *ht, unsigned long int key){	struct htent *p;	void *object;///	htreaderbegin(ht);	p = htgetent(ht, key);	if (p != NULL) {		object = p->hte_object;///		htreaderend(ht);		return object;	}	else {///		htreaderend(ht);		return NULL;	}}/*------------------------------------------------------------------------ * htgetent - non-locking internal call to do the work of retreiving  * object from ht *------------------------------------------------------------------------ */struct htent *htgetent(struct ht *ht, unsigned long int key){	u8_t			hash;	struct htent		*p;	hash = ht->ht_hashfcn(key, ht->ht_size);	p = ht->ht_entries[hash];	while(p) {		if (!ht->ht_cmpfcn(p->hte_key, key))			return p;		p = p->hte_chain;	}	/*	 * Not found.	 */	return NULL;}/*------------------------------------------------------------------------ * htdel - remove an object from the hashtable *------------------------------------------------------------------------ */inthtdel(struct ht *ht, unsigned long int key){	u8_t			hash;	struct htent		*p, *follow;	hash = ht->ht_hashfcn(key, ht->ht_size);  	///根據(jù)映射算法,計算索引  	///	htwriterbegin(ht);	////為寫操作作準備,主要是鎖讀的操作	p = ht->ht_entries[hash];////獲得可能包括要找的對象的bulk	follow = NULL;	while(p) {////從bulk的入口開始逐個比較key的值來確定		if (!ht->ht_cmpfcn(p->hte_key, key)) {			if (follow)				follow->hte_chain = p->hte_chain;			else				ht->ht_entries[hash] = p->hte_chain;			////通過指針操作把p所指的對象移到哈希表外			/*			if (ht->ht_destroykeyfcn != NULL)				ht->ht_destroykeyfcn(p->hte_key);			if (ht->ht_destroyobjectfcn != NULL)				ht->ht_destroyobjectfcn(p->hte_object);				*/			////銷毀p所指向的對象			if (ht->ht_destroy == SSRCDESTROY)			{				rtpdestroystream(p->hte_object);			}			if (ht->ht_destroy == CNAMEDESTROY)			{				heap_free(p->hte_key);				heap_free(p->hte_object);			}			heap_free(p);			ht->ht_count--;////			htwriterend(ht);			return OK;		}		follow = p;		p = p->hte_chain;		/////遍歷整個bulk鏈表。	}  	/* 	 * Not found.	 *////	htwriterend(ht);	return ERROR;}/*------------------------------------------------------------------------ * htadd - add an object to the hash table. Returns ERROR * if key is already present. *------------------------------------------------------------------------ */inthtadd(struct ht *ht, unsigned long int key, void *object){	u8_t			len;	u8_t			hash;	struct htent		*ent, *p;	/* 	 * Check for key.	 *////	htwriterbegin(ht);  	p = htgetent(ht, key);	if (p != NULL) {///		htwriterend(ht);		return ERROR;	}	///這個object在表中已經(jīng)存在	len = ht->ht_size;	ent = (struct htent *) heap_alloc(sizeof(struct htent));	if (ent == NULL) {////		htwriterend(ht);		return ERROR;	}	ent->hte_key = key;	ent->hte_object = object;	hash = ht->ht_hashfcn(key, len);	////根據(jù)key來計算哈希表中的索引值	/* 	 * Add to front of chain.	 */	p = ht->ht_entries[hash];	ent->hte_chain = p;  	ht->ht_entries[hash] = ent;	///對象插入到chain當中,是放到chain的開頭	ht->ht_count++;///	htwriterend(ht);	return OK;}////把一個object(stream)放到hash table中去/*------------------------------------------------------------------------ * hashstring - function to generate hash value for a string. * Fix me! TBD: Use use better string hash function. *------------------------------------------------------------------------ */inthashstring(unsigned long int key, u8_t len){	int		i;	int		acc = 0;	char          *str = (char *) key;	u8_t 		test;	for (i = 0; i < strlen(str); i++)		/*		 * Convert to uppercase.		 */		acc += (str[i] >= 97 && str[i] <= 122 ? str[i] - 32 : str[i]);  	test= acc % len;	return test;}////把key當作是string變量,從而獲得索引,并不去分string中字母的大小寫。/*------------------------------------------------------------------------ * hashunsignedint - function to generate a hashvalue for an unsigned int * Because SSRCs are expected to be random, using value % htsize should * suffice as a hash function. *------------------------------------------------------------------------ */inthashunsignedint(unsigned long int key, u8_t len){ 	return key % len;}////從一個整型的key來計算哈希表的索引/*------------------------------------------------------------------------ * htcount - return number of objects in the hashtable *------------------------------------------------------------------------ */inthtcount(struct ht *ht){	int count;	/*	 * Return number of items in hashtable.	 *////	htreaderbegin(ht);	count = ht->ht_count;///	htreaderend(ht);	return count;}////獲取表中對象的數(shù)目/*------------------------------------------------------------------------ * htenum - enumerate entries in the hashtable *------------------------------------------------------------------------ */struct htent **htenum(struct ht *ht){	struct htent	**v, *p;	int		i;	int		j;///	htreaderbegin(ht);	v = (struct htent **) heap_alloc(sizeof(struct htent *) * (ht->ht_count + 1));	if (v == NULL) {///		htreaderend(ht);		return NULL;	}	for (j = 0, i = 0; j < ht->ht_size; j++) {		p = ht->ht_entries[j];		////查找chain(bulk)的入口		while (p != NULL) {			v[i++] = p;			p = p->hte_chain;			///遍歷每個chain		}	}///	htreaderend(ht);	/*	 * Use NULL to mark end	 */	v[i] = NULL;	return v;}////把一個表中所有的entry的指針放到指針數(shù)組v中,這個函數(shù)被rtpsources調用。/*------------------------------------------------------------------------ * htdestroy - destroy hashtable and free all memory *------------------------------------------------------------------------ */inthtdestroy(struct ht *ht){	int		j;	struct htent *p, *q;	if (ht == NULL)		return ERROR;	///對于已空的表,destroy失敗	for (j = 0; j < ht->ht_size; j++) {		p = ht->ht_entries[j];		while (p != NULL) {			q = p->hte_chain;			/*			 * Destroy the key and object.			 */			/*			if (ht->ht_destroykeyfcn != NULL)				ht->ht_destroykeyfcn(p->hte_key);			if (ht->ht_destroyobjectfcn != NULL)				ht->ht_destroyobjectfcn(p->hte_object);			*/			/*			 * Free the memory from the hashtable entry.			 */			if (ht->ht_destroy == SSRCDESTROY)			{				rtpdestroystream(p->hte_object);			}			if (ht->ht_destroy == CNAMEDESTROY)			{				heap_free(p->hte_key);				heap_free(p->hte_object);			}			heap_free(p);			p = q;		}	}	/*	 * Free the array of pointers and ht structure.	 */	heap_free(ht->ht_entries);	heap_free(ht);	return OK;}/*------------------------------------------------------------------------ * unsignedinteq - determine if two unsigned ints are equal *------------------------------------------------------------------------ */intunsignedinteq(unsigned long int a, unsigned long int b){	return (!(a == b));}////相等則返回0////函數(shù)ht->ht_cmpfcn(p->hte_key, key)的原型。

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美久久久一区| 99精品欧美一区二区蜜桃免费| 亚洲女同女同女同女同女同69| 日本一区二区免费在线观看视频| 精品91自产拍在线观看一区| 精品日韩av一区二区| 久久人人超碰精品| 亚洲精品国产精华液| 夜夜夜精品看看| 国产一区二区三区蝌蚪| www.亚洲色图| 日韩欧美中文字幕一区| 国产三级三级三级精品8ⅰ区| 亚洲一级二级三级| 国产一区二区三区免费在线观看 | 一本久久a久久免费精品不卡| 91官网在线免费观看| 久久亚洲精华国产精华液 | 亚洲精品乱码久久久久| 国产片一区二区三区| 一区二区国产盗摄色噜噜| 久久精品国产在热久久| 欧美日韩一本到| 18成人在线观看| 国产91露脸合集magnet| 26uuu另类欧美亚洲曰本| 亚洲国产精品人人做人人爽| 一本高清dvd不卡在线观看| 久久影音资源网| 蜜臀av性久久久久av蜜臀妖精| 91免费视频网| 亚洲欧美一区二区三区孕妇| 国产在线乱码一区二区三区| 欧美不卡一区二区三区四区| 亚洲综合图片区| 欧美日产国产精品| 亚洲.国产.中文慕字在线| 欧美三级视频在线观看 | 国产在线乱码一区二区三区| 日韩一区二区免费在线观看| 开心九九激情九九欧美日韩精美视频电影| 99久久伊人精品| 亚洲欧美成人一区二区三区| 在线亚洲精品福利网址导航| 亚洲午夜激情av| 欧美精品一区二区三区蜜桃视频| 精品亚洲国产成人av制服丝袜| 欧美va天堂va视频va在线| 国产精品一区二区不卡| 久久精品一区蜜桃臀影院| 高清成人在线观看| 亚洲免费色视频| 欧美丰满一区二区免费视频| 精品写真视频在线观看| 综合自拍亚洲综合图不卡区| 在线观看精品一区| 国产成人精品影视| 欧美极品少妇xxxxⅹ高跟鞋| 国产成人自拍在线| 亚洲第一福利一区| 国产日韩成人精品| 欧美日韩精品专区| 国产一区二区三区在线观看免费| 亚洲人成7777| 26uuu精品一区二区| 欧美日韩亚洲综合一区| 懂色av噜噜一区二区三区av| 麻豆一区二区在线| 亚洲精品免费在线播放| 久久综合五月天婷婷伊人| 欧美剧情片在线观看| 懂色av一区二区三区免费观看| 久久99精品视频| 日韩综合在线视频| 亚洲成av人综合在线观看| 亚洲色图.com| 中文字幕在线不卡国产视频| 精品精品国产高清a毛片牛牛| 91精品国产综合久久精品图片| 色悠久久久久综合欧美99| 一本色道久久综合亚洲精品按摩 | 日韩午夜激情视频| 欧美一级在线免费| 91精品国产综合久久精品性色| 91麻豆免费观看| 色哟哟国产精品| 欧美日韩国产电影| 欧美精品18+| 精品成人一区二区三区| 精品成人免费观看| 国产精品美女久久久久久久| 亚洲欧美在线aaa| 亚洲宅男天堂在线观看无病毒| 成人免费在线视频| 亚洲精品videosex极品| 亚洲成av人**亚洲成av**| 免费在线观看不卡| av在线综合网| 日韩亚洲欧美在线| 欧美一区二区在线播放| 91麻豆精品国产自产在线观看一区| 欧美日韩不卡视频| 国产日韩视频一区二区三区| 亚洲日韩欧美一区二区在线| 五月天精品一区二区三区| 国产成人综合自拍| 欧美日韩综合一区| 国产欧美一区二区在线| 亚洲国产综合91精品麻豆| 国产一区二区剧情av在线| 一本一本大道香蕉久在线精品| 91精品国产福利在线观看| 欧美极品美女视频| 国产一区二区三区四区在线观看| 欧美综合久久久| 国产精品久久一卡二卡| 久久99精品一区二区三区| 欧美人动与zoxxxx乱| 亚洲视频精选在线| 成人综合日日夜夜| 久久看人人爽人人| 国模套图日韩精品一区二区| 欧美日韩aaaaaa| 一区二区不卡在线播放| 91日韩在线专区| 亚洲欧洲无码一区二区三区| 成人免费视频免费观看| 久久久久99精品国产片| 国产一区二区三区久久久| 日韩免费高清视频| 精品午夜一区二区三区在线观看| 日韩三区在线观看| 久久国产精品区| 久久精品欧美一区二区三区麻豆| 国产一本一道久久香蕉| 久久精品无码一区二区三区| 成人一级黄色片| 一区二区三区中文在线观看| 在线视频欧美区| 免费的成人av| 国产精品久线观看视频| 7777精品伊人久久久大香线蕉超级流畅| 亚洲成av人片在线| 国产午夜精品一区二区| 一本色道久久加勒比精品| 亚洲成人福利片| 国产亚洲视频系列| 91激情五月电影| 九九久久精品视频| 中文字幕日韩一区二区| 91麻豆精品国产91久久久资源速度 | 欧美国产精品久久| 欧美高清www午色夜在线视频| 美女精品一区二区| 一区二区激情小说| 日本一区二区动态图| 日韩欧美在线综合网| 色哟哟在线观看一区二区三区| 久久精品国产99国产| 亚洲电影在线播放| 亚洲激情在线播放| 中文字幕中文字幕在线一区 | 538prom精品视频线放| 99视频在线精品| 国产激情视频一区二区三区欧美 | 欧美精品一区二区久久久| 91久久香蕉国产日韩欧美9色| 国内成人免费视频| 韩国女主播成人在线| 久久国产成人午夜av影院| 天堂成人国产精品一区| 亚洲成在人线在线播放| 亚洲高清免费观看高清完整版在线观看 | av资源网一区| 色婷婷久久久久swag精品| 欧美日韩成人在线一区| 欧美日韩精品一区二区三区四区| 韩日欧美一区二区三区| 中文字幕日韩精品一区| 91精品国产色综合久久不卡电影| 美国十次综合导航| 亚洲一区中文在线| 久久久99久久精品欧美| 91精品国产综合久久精品| 91小视频在线| 日本高清免费不卡视频| 中文字幕亚洲区| 91精品办公室少妇高潮对白| 一区二区成人在线视频| 在线不卡一区二区| 国产精品自拍一区| 国产欧美日产一区| 日本韩国精品在线| 麻豆一区二区三| 一本一本大道香蕉久在线精品| 欧美色网站导航| 欧美色男人天堂| 欧美日韩高清不卡| 欧美一区二区三区喷汁尤物| 5566中文字幕一区二区电影|