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

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

?? namecachemain.c

?? p2p類源代碼 kadc協議官方源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
		}		return 0;	} else if(rbt_status == RBT_STATUS_OK) {#ifdef DEBUG		KadC_log("create_pending_entry() found an existing pending_query entry for that question, so did nothing\n");#endif		/* already there, do nothing */		return 1;	} else {		assert(0);	/* if other cases, big trouble */		return -1;	}}/* If name is equal (apart from capitalization and   trailing dots) to one of array's elements (which are supposed   to have have no trailing dots), return 1 + index in the array */static int is_in(char *array[], int arraysize, char *name) {	int i, l;	if(name == NULL)		return 0;	for(l = strlen(name); l > 0 ; --l) {		if(name[l-1] != '.')			break;	}	/* l is now the length of name trimmed of any trailing dots */	if(l == 0)		return 0;	/* zero-length names are not supposed to be good */	for(i=0; i<arraysize; i++) {		char *s = strdup(array[i]);		char *p;		assert(s != NULL);		if((p = strchr(s, '=')) != NULL) {			*p = 0;	/* truncate string's copy at first '=' (if any) */		}		if(strlen(s) == l && strncasecmp(name, s, l) == 0) {			free(s);			return 1+i;		}		free(s);	}	return 0;}/* returns true (1) if name ends with a sequence of labels equal   (apart from capitalization and trailing dots) to one of array's   elements (which are guaranteed to have no trailing dots) */static int end_is_in(char *array[], int arraysize, char *name) {	int i, l;	if(name == NULL)		return 0;	for(l = strlen(name); l > 0 ; --l) {		if(name[l-1] != '.')			break;	}	/* l is now the length of name trimmed of any trailing dots */	if(l == 0)		return 0;	/* zero-length names are not supposed to be good */	for(i=0; i<arraysize; i++) {		int la = strlen(array[i]);		if(la > l)			continue;	/* array element must be not longer than name */		if(strncasecmp(name+l-la, array[i], la) == 0 &&		  (l == la || name[l-la-1] == '.')) {			return 1;			break;		}	}	return 0;}static void replyA(DNSIO *pdnsio, dns_msg *pdm, DNSpacket *pdnp, unsigned long int ip) {	DNSpacket *pdnpreply;	char *ipbuf = calloc(1, sizeof(unsigned long int));	assert(ipbuf != NULL);	pdm->rcode = RCODE_NO_ERROR;	pdm->ra = 1;	/* recursion available */	pdm->qr = 1;	/* it's a reply */	pdm->aa = 1;	/* we are authority */	pdm->nanswer_rr = 1;	assert(pdm->answer_rr == NULL);	/* pdm came from a query... */	pdm->answer_rr = calloc(1, sizeof(dns_rr *));	/* allocate space for one parsed answer field */	assert(pdm->answer_rr != NULL);	pdm->answer_rr[0] = calloc(1, sizeof(dns_rr));	assert(pdm->answer_rr[0] != NULL);	pdm->answer_rr[0]->rdata = ipbuf;	ipbuf[0] = (ip>>24) & 0xff;	ipbuf[1] = (ip>>16) & 0xff;	ipbuf[2] = (ip>> 8) & 0xff;	ipbuf[3] = (ip    ) & 0xff;	pdm->answer_rr[0]->rdatalen = sizeof(unsigned long int);	strcpy(pdm->answer_rr[0]->name, pdm->questions[0]->name);	pdm->answer_rr[0]->type = A;	pdm->answer_rr[0]->class = pdm->questions[0]->class;	pdm->answer_rr[0]->ttl = 600;	/* Why 10 minutes? And why not? */	pdnpreply = DNSmsg2packet(pdm, pdnp->remoteip, pdnp->remoteport, pdnp->fd);	DNSreply(pdnsio, pdnpreply);	DNSpacket_destroy(pdnpreply);}static void replyPTR(DNSIO *pdnsio, dns_msg *pdm, DNSpacket *pdnp, char *name) {	DNSpacket *pdnpreply;	packedname pn;	pdm->rcode = RCODE_NO_ERROR;	pdm->ra = 1;	/* recursion available */	pdm->qr = 1;	/* it's a reply */	pdm->aa = 1;	/* we are authority */	pdm->nanswer_rr = 1;	assert(pdm->answer_rr == NULL);	/* pdm came from a query... */	pdm->answer_rr = calloc(1, sizeof(dns_rr *));	/* allocate space for one parsed answer field */	assert(pdm->answer_rr != NULL);	pdm->answer_rr[0] = calloc(1, sizeof(dns_rr));	assert(pdm->answer_rr[0] != NULL);	pn = dns_domain_pack(name);	assert(pn.buf != NULL);	pdm->answer_rr[0]->rdata = pn.buf;	pdm->answer_rr[0]->rdatalen = pn.buflen;	strcpy(pdm->answer_rr[0]->name, pdm->questions[0]->name);	pdm->answer_rr[0]->type = PTR;	pdm->answer_rr[0]->class = pdm->questions[0]->class;	pdm->answer_rr[0]->ttl = 600;	/* Why 10 minutes? And why not? */	pdnpreply = DNSmsg2packet(pdm, pdnp->remoteip, pdnp->remoteport, pdnp->fd);	DNSreply(pdnsio, pdnpreply);	DNSpacket_destroy(pdnpreply);}static void replyERR(DNSIO *pdnsio, dns_msg *pdm, DNSpacket *pdnp, dns_rcode_t rcode) {	/* sigh, we can't answer. */	DNSpacket *pdnpreply;	pdm->rcode = rcode;	pdm->ra = 1;	/* recursion available */	pdm->qr = 1;	/* it's a reply */	pdnpreply = DNSmsg2packet(pdm, pdnp->remoteip, pdnp->remoteport, pdnp->fd);	DNSreply(pdnsio, pdnpreply);	DNSpacket_destroy(pdnpreply);}static void *p2pquery(void *p) {	raw_qa *pqa = p;	processing_thread_params *pptp = pqa->pptp;	DNSIO *pdnsio = pptp->pdnsio;	DNSpacket *pdnp = pqa->q;	dns_msg *pdm = DNSpacket2msg(pdnp);	dns_question *question = pdm->questions[0];	DNSpacket *pdnpreply;#ifdef DEBUG	KadC_log("p2pquery thread routine processing query for %s\n", question->name);#endif	/* it has already been checked that nquestions == 1 and	   question is sane and has class == I */	if(question->type == A) {		/* now start the time-consuming P2P search */		void *resdictrbt;		char index[512];		char filter[1024];		void *iter;		sprintf(index, "KadC::namecache::%s", question->name);		sprintf(filter, "KadCapp=namecache&rrtype=A");		/* launch a search with 10 threads, max 5 hits and 7 s duration */		resdictrbt = KadC_find(pptp->pkcc, index, filter, 20, 5, 7);		pdm->rcode = RCODE_NAME_ERROR;	/* default: record NOT found */		if(rbt_size(resdictrbt) == 0) {#ifdef DEBUG			KadC_log("p2pquery found no records, and will reply RCODE_NAME_ERROR\n");#endif		} else {			unsigned long int ip;			KadCdictionary *pkd;			char *ipbuf = calloc(1, sizeof(unsigned long int));#ifdef DEBUG			KadC_log("p2pquery found %d records, and will reply RCODE_NO_ERROR\n", rbt_size(resdictrbt));#endif			assert(ipbuf != NULL);			/* list each k-object */			for(iter = rbt_begin(resdictrbt); iter != NULL; iter = rbt_next(resdictrbt, iter)) {				KadCtag_iter kt_iter;				pkd = rbt_value(iter);				KadC_log("Found: \n");				KadCdictionary_dump(pkd);				KadC_log("\n");				if(KadCtag_find(pkd, "kadcapp", &kt_iter) == KADCTAG_STRING &&				   		strcasecmp(kt_iter.tagvalue, "namecache") == 0 &&				   KadCtag_find(pkd, "rrtype", &kt_iter) == KADCTAG_STRING &&				   		strcasecmp(kt_iter.tagvalue, "a") == 0 &&				   KadCtag_find(pkd, "ip", &kt_iter) == KADCTAG_STRING) {					ip = inet_addr(kt_iter.tagvalue);					ip = ntohl(ip);					KadC_log("Retrieved ip = %s\n", htoa(ip));					break;				}			}			/* build answer_rr */			assert(pdm->answer_rr == NULL);	/* double checking won't hurt */			pdm->answer_rr = calloc(1, sizeof(dns_rr *));	/* allocate space for one parsed answer field */			assert(pdm->answer_rr != NULL);			pdm->answer_rr[0] = calloc(1, sizeof(dns_rr));			assert(pdm->answer_rr[0] != NULL);			pdm->answer_rr[0]->rdata = ipbuf;			ipbuf[0] = (ip>>24) & 0xff;			ipbuf[1] = (ip>>16) & 0xff;			ipbuf[2] = (ip>> 8) & 0xff;			ipbuf[3] = (ip    ) & 0xff;			pdm->answer_rr[0]->rdatalen = sizeof(unsigned long int);			strcpy(pdm->answer_rr[0]->name, pdm->questions[0]->name);			pdm->answer_rr[0]->type = A;			pdm->answer_rr[0]->class = pdm->questions[0]->class;			pdm->answer_rr[0]->ttl = 600;	/* Why 10 minutes? And why not? */			pdm->nanswer_rr = 1;			pdm->rcode = RCODE_NO_ERROR;	/* record found */		}		for(iter = rbt_begin(resdictrbt); iter != NULL; iter = rbt_begin(resdictrbt)) {			KadCdictionary *pkd = rbt_value(iter);			rbt_erase(resdictrbt, iter);			KadCdictionary_destroy(pkd);		}		rbt_destroy(resdictrbt);	} else {		pdm->rcode = RCODE_NOT_IMPLEMENTED;	/* TEMPORARY!! */	}	pdm->aa = 1;	/* we are authoritative on this */	pdm->ra = 1;	/* recursion available */	pdm->qr = 1;	/* it's a reply */	pdnpreply = DNSmsg2packet(pdm, pdnp->remoteip, pdnp->remoteport, pdnp->fd);	dns_msg_destroy(pdm);	/* parsed dns_msg no longer necessary */	/* post the reply to the same queue used by the DNS network listener */	if(pdnsio->fifo->enq(pdnsio->fifo, pdnpreply) != 0) {		/* if FIFO full, drop the packet? */		free(pdnpreply->buf);		free(pdnpreply);	}	pqa->done = 1;	return NULL;}static void *processing_thread(void *p){	processing_thread_params *pptp = p;	for(;;) {		int sf;		DNSpacket *pdnp;		pthread_mutex_lock(&pptp->pdnsio->mutex);	/* \\\\\\ LOCK \\\\\\ */		sf = pptp->pdnsio->shutdown_flag;		pthread_mutex_unlock(&pptp->pdnsio->mutex);	/* ///// UNLOCK ///// */		if(sf)			break;		/* wait for requests on pptp->d.fifo */		pdnp = pptp->pdnsio->fifo->deqtw(pptp->pdnsio->fifo, 1000);		if(pdnp != NULL) {			dns_msg *pdm;			/* process request, possibly starting a separate thread			   if the tld is in tlpd[], use KadC search rather than upstream			   DNS servers */#ifdef VERBOSE_DEBUG /* DEBUG ONLY */			{				int i;				KadC_log("processing_thread - received from %s:%d %d bytes:",						htoa(pdnp->remoteip), pdnp->remoteport, pdnp->bufsize);				for(i=0; i < pdnp->bufsize /* && i < 48 */; i++) {					if((i % 16) == 0)						KadC_log("\n");					KadC_log("%02x ", pdnp->buf[i]);				}			}			KadC_log("\n--------------------------------\n");#endif			/* parse the DNSpacket into a dns_msg to perform tests more easily */			pdm = DNSpacket2msg(pdnp);			if(pdm != NULL) {				/* adjust the qsize field in pdnp (used by rbt comparison functions) */				pdnp->qsize = pdm->questions[0]->raw_length;				/* is this a query or a response? */				if(pdm->qr == 0) {					/* it's a query */					if(pdm->nquestions != 1 || 	/* sorry, unable to handle more than one question */					   pdm->nanswer_rr != 0) {	/* hey, queries are supposed not to contain answers... */						DNSpacket *pdnpreply;#ifdef DEBUG						KadC_log("This query had %d questions\n", pdm->nquestions);#endif						pdm->rcode = RCODE_NOT_IMPLEMENTED;						pdm->ra = 1;	/* recursion available */						pdm->qr = 1;	/* it's a reply */						pdnpreply = DNSmsg2packet(pdm, pdnp->remoteip, pdnp->remoteport, pdnp->fd);						DNSreply(pptp->pdnsio, pdnpreply);						DNSpacket_destroy(pdnpreply);					} else {						/* single question, good. */						void *iter = NULL;						rbt_StatusEnum rbt_status;						unsigned long int ip;						dns_type_t qtype;						char *qname;						dns_class_t qclass;						int dnindex;						assert(pdm->questions != NULL);						assert(pdm->questions[0] != NULL);	/* if there is one question it must be the first... */						qtype = pdm->questions[0]->type;						qname = pdm->questions[0]->name;						qclass = pdm->questions[0]->class;						rbt_status = RBT_STATUS_KEY_NOT_FOUND;	/* default */						/* check if a q/a for it is in cache */						pthread_mutex_lock(&pptp->mutex);	/* \\\\\\ LOCK \\\\\\ */						if(pdnp->remoteip != 0)	/* if not locally generated for predictive caching refresh */							rbt_status = rbt_find(pptp->cache_q_rbt, pdnp, &iter);						if(rbt_status == RBT_STATUS_OK) {							DNSpacket dnpreply;							raw_qa *cached_qa = rbt_value(iter);							assert(cached_qa != NULL);							cached_qa->last_accessed = time(NULL);	/* update "last read" time */							/* create on the stack a clone of reply fetched from cache */							dnpreply = *(cached_qa->a);							dnpreply.buf = malloc(dnpreply.bufsize);							assert(dnpreply.buf != NULL);							memcpy(dnpreply.buf, cached_qa->a->buf, dnpreply.bufsize);							/* modify the ID to match the query's */							dnpreply.buf[0] = ((pdm->id)>>8) & 0xff;							dnpreply.buf[1] = ((pdm->id)   ) & 0xff;							/* also match destination IP and port to the requestor's */							dnpreply.remoteip = pdnp->remoteip;							dnpreply.remoteport = pdnp->remoteport;							dnpreply.fd = pdnp->fd;							/* send the reply to the requestor */							DNSreply(pptp->pdnsio, &dnpreply);							/* free the buffer (the DNSpacket is auto... */							free(dnpreply.buf);						} else if(qclass == I &&								(qtype == PTR || qtype == 255) &&								is_a_local_address(ip = reverse_inet_addr(qname))) {							/* perhaps it's a query for things on which we							   are authoritative: PTR for local IP address,							   A and PTR for localhost (duh) or KadC-related							   domains (subdomains of arguments of "-t")							   IMMEDIATE REPLY, no pending_qa is created */							if(ip == 0x7f000001) {	/* 127.0.0.1 */								replyPTR(pptp->pdnsio, pdm, pdnp, "localhost");	/* which dumb resolver could ever ask that over the network? */							} else { /* must be an IP on a local interface */								replyPTR(pptp->pdnsio, pdm, pdnp, "cachehost.cachedomain");	/* assumed to be an alias of our machine... */							}						} else if(qclass == I && (dnindex=is_in(pptp->my_pseudo, pptp->nmy_pseudo, qname)) > 0) {							char *arg = strchr(pptp->my_pseudo[dnindex-1], '=');							if(arg == NULL)								ip = KadC_getextIP(pptp->pkcc);							else								ip = ntohl(inet_addr(arg+1));							if(ip != 0)	{ /* if we know from KadC our external IP address */								/* handle here queries for domain names equal to our pseudomains								   IMMEDIATE REPLY, no pending_qa is created */#ifdef DEBUG								KadC_log("A query for the pseudodomain %s resolves to %s\n", qname, htoa(ip));#endif								replyA(pptp->pdnsio, pdm, pdnp, ip);	/* assumed to be an alias of our machine... */							} else {								replyERR(pptp->pdnsio, pdm, pdnp, RCODE_NAME_ERROR);	/* we are authoritative, but the IP is unknown */							}						} else if(qclass == I && end_is_in(pptp->tlpd, pptp->ntlpd, qname)) {								/* handle here A queries for domain names that are subdomains of one of our tpld's */								/* post a search for the keyword "namecache::some.domain" */#ifdef DEBUG								KadC_log("A query for %s, a subdomain of one of the KadC TLPD's\n", qname);#endif							if(create_pending_entry(pptp, pdnp, &p2pquery) == 0) {	/* if there wasn't already one (also with same id), and it's been created... */								pdnp = NULL;	/* so it won't be freed below (now the packet is referenced by the pending_q rbt...) */							} else {								/* do nothing, maybe it's an unnecessary retry for timeout that is already being taken care of */							}						} else if(pptp->pdnsio->nupstream > 0) {							/* nope: if no pending queries, query all upstream servers and create a "pending" entry */							if(create_pending_entry(pptp, pdnp, NULL) == 0) {	/* if there wasn't already one (also with same id), and it's been created... */								int i;								for(i=0; i < pptp->pdnsio->nupstream; i++) {									DNSquery(pptp->pdnsio, pdnp, pptp->pdnsio->upstream[i]);								}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
五月天欧美精品| 成人黄色777网| 成人免费看视频| 91精品国产综合久久精品性色 | 日韩理论片在线| 奇米影视在线99精品| 91免费版在线看| 久久久青草青青国产亚洲免观| 玉足女爽爽91| av电影天堂一区二区在线观看| 欧美电影免费观看完整版| 亚洲一区二区三区四区在线免费观看 | 亚洲一区在线播放| 波多野结衣亚洲一区| 久久青草国产手机看片福利盒子| 亚洲福利视频一区二区| 日本韩国精品在线| 一色屋精品亚洲香蕉网站| 国产精品2024| 2019国产精品| 久久国产精品第一页| 日韩一区二区三区视频| 亚洲成av人**亚洲成av**| 色妞www精品视频| 中文字幕中文乱码欧美一区二区| 国产精品一区二区三区网站| 欧美成人一级视频| 久久疯狂做爰流白浆xx| 欧美一区二区三区系列电影| 日本伊人午夜精品| 91精品国产一区二区| 日本欧美韩国一区三区| 欧美一级片在线| 日本欧美肥老太交大片| 日韩亚洲欧美综合| 奇米精品一区二区三区在线观看| 欧美一区二区在线免费观看| 蜜臀av一区二区| 26uuu国产一区二区三区| 韩国精品主播一区二区在线观看| 日韩精品一区二区三区视频在线观看| 麻豆精品久久久| 国产日韩精品一区二区浪潮av | 视频一区欧美精品| 日韩免费视频线观看| 国产九色sp调教91| 国产精品伦一区二区三级视频| 99国产精品久久久久久久久久| 日本一区二区成人在线| 一本一本久久a久久精品综合麻豆| 亚洲一区二区在线免费看| 欧美裸体bbwbbwbbw| 久久国产夜色精品鲁鲁99| 久久美女高清视频| 色婷婷精品久久二区二区蜜臀av| 亚洲chinese男男1069| 欧美一级高清大全免费观看| 国产一区二区导航在线播放| 亚洲人妖av一区二区| 欧美日韩视频专区在线播放| 精品一区二区免费视频| 中文字幕在线不卡一区二区三区| 欧美性受xxxx黑人xyx性爽| 久久99热这里只有精品| 中文字幕在线观看不卡视频| 在线91免费看| 成人午夜短视频| 亚洲电影欧美电影有声小说| 久久精品一区二区三区四区| 91视频91自| 蜜桃传媒麻豆第一区在线观看| 欧美激情在线看| 欧美色大人视频| 丰满少妇在线播放bd日韩电影| 亚洲精品国产精华液| 2017欧美狠狠色| 欧美日韩久久一区| 丁香激情综合五月| 日韩黄色免费电影| 国产精品高清亚洲| 欧美成人a∨高清免费观看| 91免费观看在线| 精东粉嫩av免费一区二区三区| 亚洲欧美日韩精品久久久久| 欧美成人一区二区三区在线观看| 91黄色免费网站| 粉嫩aⅴ一区二区三区四区| 天堂久久久久va久久久久| 自拍偷拍欧美精品| 久久久99精品免费观看不卡| 欧美久久久久久久久中文字幕| 99久久婷婷国产精品综合| 国内久久婷婷综合| 热久久国产精品| 欧美tickle裸体挠脚心vk| 欧美一级欧美一级在线播放| 久久精品久久综合| 亚洲欧美电影院| 久久久影视传媒| 日韩一区二区三区视频| 欧美亚男人的天堂| 色先锋资源久久综合| 不卡av电影在线播放| 国产91丝袜在线18| 精品一区二区影视| 精品一区二区成人精品| 美国av一区二区| 日韩精品电影在线| 秋霞av亚洲一区二区三| 日韩精品一区第一页| 五月天亚洲婷婷| 午夜精品久久久久久久蜜桃app| 亚洲综合在线视频| 欧美一级日韩免费不卡| 国产精品蜜臀在线观看| 日韩欧美成人一区| 欧美一级搡bbbb搡bbbb| 欧美色精品天天在线观看视频| 欧美丝袜丝交足nylons图片| 91福利精品视频| 欧美日韩一卡二卡三卡| 欧美剧情片在线观看| 91精品午夜视频| 精品美女一区二区| 国产午夜亚洲精品理论片色戒| 国产欧美日韩精品a在线观看| 中文字幕电影一区| 中文字幕中文乱码欧美一区二区| 综合久久国产九一剧情麻豆| 亚洲免费三区一区二区| 亚洲小说欧美激情另类| 日本午夜一本久久久综合| 久久国产尿小便嘘嘘| 国产精品一区二区不卡| 99天天综合性| 欧美体内she精高潮| 欧美一级免费大片| 国产香蕉久久精品综合网| 亚洲女与黑人做爰| 日韩精品久久久久久| 国产精品乡下勾搭老头1| 97久久精品人人爽人人爽蜜臀| 欧美性受极品xxxx喷水| 精品人伦一区二区色婷婷| 国产欧美一区二区精品性色| 一区二区三区四区视频精品免费 | 久久久蜜桃精品| 综合婷婷亚洲小说| 日本vs亚洲vs韩国一区三区二区| 国产精品一级片| 欧美亚男人的天堂| 久久久精品欧美丰满| 有码一区二区三区| 国产最新精品精品你懂的| 91理论电影在线观看| 精品日韩欧美在线| 亚洲精品一卡二卡| 狠狠狠色丁香婷婷综合久久五月| 91视频观看视频| 精品国产乱码久久久久久图片| 亚洲欧美日韩国产另类专区| 久久精品国内一区二区三区 | 国产精品99久久久久久有的能看| 91成人在线观看喷潮| 久久尤物电影视频在线观看| 亚洲综合av网| jlzzjlzz亚洲女人18| 日韩免费一区二区| 亚洲综合一二三区| 国产福利精品一区二区| 欧美日本国产一区| 亚洲男人天堂av网| 国产宾馆实践打屁股91| 91精品欧美一区二区三区综合在| 综合精品久久久| 成人性生交大片免费看中文网站| 91精品国产一区二区三区| 一区二区三区欧美视频| 成人av网址在线观看| 久久午夜老司机| 久久精品国产亚洲aⅴ| 欧美日韩国产片| 一区二区三区四区国产精品| 国产成人av在线影院| 久久综合色之久久综合| 美女视频网站久久| 91精品国产一区二区三区蜜臀| 亚洲一区二区三区视频在线播放| eeuss鲁片一区二区三区| 国产色一区二区| 国产电影一区二区三区| 日韩精品一区二区三区视频| 日韩高清电影一区| 在线观看91av| 亚洲电影一区二区三区| 欧美在线观看视频一区二区| 亚洲与欧洲av电影| 欧美视频中文字幕| 亚洲成人一区在线| 欧美精品 国产精品|