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

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

?? nr3.c

?? 這是新華龍(www.xhl.xom.xn)開發的
?? C
?? 第 1 頁 / 共 2 頁
字號:
static int
accept_bc(addr,ifnum)
uint8 *addr;
unsigned ifnum;
{
	struct nrnf_tab *fp;

	if(Nr_nfmode == NRNF_NOFILTER)		/* no filtering in effect */
		return 1;

	fp = find_nrnf(addr,ifnum);		/* look it up */
	
	if((fp != NULL && Nr_nfmode == NRNF_ACCEPT)
		|| (fp == NULL && Nr_nfmode == NRNF_REJECT))
		return 1;
	else
		return 0;
}


/* receive and process node broadcasts. */
void
nr_nodercv(
struct iface *iface,
uint8 *source,
struct mbuf **bpp
){
	register int ifnum;
	char bcalias[AXALEN];
	struct nr3dest ds;
	
	/* First, see if this is even a net/rom interface: */
	for(ifnum = 0; ifnum < Nr_numiface; ifnum++)
		if(iface == Nrifaces[ifnum].iface)
			break;
			
	if(ifnum == Nr_numiface){	/* not in the interface table */
		free_p(bpp);
		return;
	}

	if(!accept_bc(source,ifnum)){	/* check against filter */
		free_p(bpp);
		return;
	}
	
	/* See if it has a routing broadcast signature: */
	if(PULLCHAR(bpp) != NR3NODESIG){
		free_p(bpp);
		return;
	}

	/* now try to get the alias */
	if(pullup(bpp,bcalias,ALEN) < ALEN){
		free_p(bpp);
		return;
	}

	bcalias[ALEN] = '\0';		/* null terminate */

	/* enter the neighbor into our routing table */
	if(nr_routeadd(bcalias,source,ifnum,Nrifaces[ifnum].quality,
	 source, 0, 0) == -1){
		free_p(bpp);
		return;
	}
	
	/* we've digested the header; now digest the actual */
	/* routing information */
	while(ntohnrdest(&ds,bpp) != -1){
		/* ignore routes to me! */
		if(ismycall(ds.dest))
			continue;
		/* ignore routes below the minimum quality threshhold */
		if(ds.quality < Nr_autofloor)
			continue;
		/* set loopback paths to 0 quality */
		if(ismycall(ds.neighbor))
			ds.quality = 0;
		else
			ds.quality = ((ds.quality * Nrifaces[ifnum].quality + 128)
			 / 256) & 0xff;
		if(nr_routeadd(ds.alias,ds.dest,ifnum,ds.quality,source,0,0)
			== -1)
			break;
	}
			
	free_p(bpp);	/* This will free the mbuf if anything fails above */
}


/* The following are utilities for manipulating the routing table */

/* hash function for callsigns.  Look familiar? */
uint16
nrhash(s)
uint8 *s;
{
	register uint8 x;
	register int i;

	x = 0;
	for(i = ALEN; i !=0; i--)
		x ^= *s++ & 0xfe;
	x ^= *s & SSID;
	return (uint16)(x % NRNUMCHAINS);
}

/* Find a neighbor table entry.  Neighbors are determined by
 * their callsign and the interface number.  This takes care
 * of the case where the same switch or hosts uses the same
 * callsign on two different channels.  This isn't done by
 * net/rom, but it might be done by stations running *our*
 * software.
 */
static struct nrnbr_tab *
find_nrnbr(addr,ifnum)
register uint8 *addr;
unsigned ifnum;
{
	uint16 hashval;
	register struct nrnbr_tab *np;

	/* Find appropriate hash chain */
	hashval = nrhash(addr);

	/* search hash chain */
	for(np = Nrnbr_tab[hashval]; np != NULL; np = np->next){
		/* convert first in  list to ax25 address format */
		if(addreq(np->call,addr) && np->iface == ifnum){
			return np;
		}
	}
	return NULL;
}


/* Find a route table entry */
struct nrroute_tab *
find_nrroute(addr)
register uint8 *addr;
{
	uint16 hashval;
	register struct nrroute_tab *rp;

	/* Find appropriate hash chain */
	hashval = nrhash(addr);

	/* search hash chain */
	for(rp = Nrroute_tab[hashval]; rp != NULL; rp = rp->next){
		if(addreq(rp->call,addr)){
			return rp;
		}
	}
	return NULL;
}

/* Try to find the AX.25 address of a node with the given alias.  Return */
/* a pointer to the AX.25 address if found, otherwise NULL.  The alias */
/* should be a six character, blank-padded, upper-case string. */

uint8 *
find_nralias(alias)
char *alias;
{
	int i;
	register struct nrroute_tab *rp;

	/* Since the route entries are hashed by ax.25 address, we'll */
	/* have to search all the chains */
	
	for(i = 0; i < NRNUMCHAINS; i++)
		for(rp = Nrroute_tab[i]; rp != NULL; rp = rp->next)
			if(strncmp(alias, rp->alias, 6) == 0)
				return rp->call;

	/* If we get to here, we're out of luck */

	return NULL;
}


/* Find a binding in a list by its neighbor structure's address */
static struct nr_bind *
find_binding(list,neighbor)
struct nr_bind *list;
register struct nrnbr_tab *neighbor;
{
	register struct nr_bind *bp;

	for(bp = list; bp != NULL; bp = bp->next)
		if(bp->via == neighbor)
			return bp;

	return NULL;
}

/* Find the worst quality non-permanent binding in a list */
static
struct nr_bind *
find_worst(list)
struct nr_bind *list;
{
	register struct nr_bind *bp;
	struct nr_bind *worst = NULL;
	unsigned minqual = 1000;	/* infinity */

	for(bp = list; bp != NULL; bp = bp->next)
		if(!(bp->flags & NRB_PERMANENT) && bp->quality < minqual){
			worst = bp;
			minqual = bp->quality;
		}

	return worst;
}

/* Find the best binding of any sort in a list.  If obso is 1,
 * include entries below the obsolescence threshhold in the
 * search (used when this is called for routing broadcasts).
 * If it is 0, routes below the threshhold are treated as
 * though they don't exist.
 */
static
struct nr_bind *
find_best(list,obso)
struct nr_bind *list;
unsigned obso;
{
	register struct nr_bind *bp;
	struct nr_bind *best = NULL;
	int maxqual = -1;	/* negative infinity */

	for(bp = list; bp != NULL; bp = bp->next)
		if((int)bp->quality > maxqual)
			if(obso || bp->obsocnt >= Obso_minbc){
				best = bp;
				maxqual = bp->quality;
			}

	return best;
}

/* Add a route to the net/rom routing table */
int
nr_routeadd(alias,dest,ifnum,quality,neighbor,permanent,record)
char *alias;		/* net/rom node alias, blank-padded and */
			/* null-terminated */
uint8 *dest;		/* destination node callsign */
unsigned ifnum;	/* net/rom interface number */
unsigned quality;	/* route quality */
uint8 *neighbor;	/* neighbor node + 2 digis (max) in arp format */
unsigned permanent;	/* 1 if route is permanent (hand-entered) */
unsigned record;	/* 1 if route is a "record route" */
{
	struct nrroute_tab *rp;
	struct nr_bind *bp;
	struct nrnbr_tab *np;
	uint16 rhash, nhash;

	/* See if a routing table entry exists for this destination */
	if((rp = find_nrroute(dest)) == NULL){
		rp = (struct nrroute_tab *)callocw(1,sizeof(struct nrroute_tab));
		/* create a new route table entry */
		strncpy(rp->alias,alias,6);
		memcpy(rp->call,dest,AXALEN);
		rhash = nrhash(dest);
		rp->next = Nrroute_tab[rhash];
		if(rp->next != NULL)
			rp->next->prev = rp;
		Nrroute_tab[rhash] = rp;	/* link at head of hash chain */
	} else if(!record){
		strncpy(rp->alias,alias,6);	/* update the alias */
	}

	/* See if an entry exists for this neighbor */
	if((np = find_nrnbr(neighbor,ifnum)) == NULL){
		np = (struct nrnbr_tab *)callocw(1,sizeof(struct nrnbr_tab));
		/* create a new neighbor entry */
		memcpy(np->call,neighbor,AXALEN);
		np->iface = ifnum;
		nhash = nrhash(neighbor);
		np->next = Nrnbr_tab[nhash];
		if(np->next != NULL)
			np->next->prev = np;
		Nrnbr_tab[nhash] = np;
	} else if(permanent){		/* force this path to the neighbor */
		memcpy(np->call,neighbor,AXALEN);
	}
		
	/* See if there is a binding between the dest and neighbor */
	if((bp = find_binding(rp->routes,np)) == NULL){
		bp = (struct nr_bind *)callocw(1,sizeof(struct nr_bind));
		/* create a new binding and link it in */
		bp->via = np;	/* goes via this neighbor */
		bp->next = rp->routes;	/* link into binding chain */
		if(bp->next != NULL)
			bp->next->prev = bp;
		rp->routes = bp;
		rp->num_routes++;	/* bump route count */
		np->refcnt++;		/* bump neighbor ref count */
		bp->quality = quality;
		bp->obsocnt = Obso_init;	/* use initial value */
		if(permanent)
			bp->flags |= NRB_PERMANENT;
		else if(record)	/* notice permanent overrides record! */
			bp->flags |= NRB_RECORDED;
	} else {
		if(permanent){	/* permanent request trumps all */
			bp->quality = quality;
			bp->obsocnt = Obso_init;
			bp->flags |= NRB_PERMANENT;
			bp->flags &= ~NRB_RECORDED;	/* perm is not recorded */
		} else if(!(bp->flags & NRB_PERMANENT)){	/* not permanent */
			if(record){	/* came from nr_route */
				if(bp->flags & NRB_RECORDED){ /* no mod non-rec bindings */
					bp->quality = quality;
					bp->obsocnt = Obso_init; /* freshen recorded routes */
				}
			} else {		/* came from a routing broadcast */
				bp->quality = quality;
				bp->obsocnt = Obso_init;
				bp->flags &= ~NRB_RECORDED; /* no longer a recorded route */
			}
		}
	}

	/* Now, check to see if we have too many bindings, and drop */
	/* the worst if we do */
	if(rp->num_routes > Nr_maxroutes){
		/* since find_worst never returns permanent entries, the */
		/* limitation on number of routes is circumvented for    */
		/* permanent routes */
		if((bp = find_worst(rp->routes)) != NULL){
			nr_routedrop(dest,bp->via->call,bp->via->iface);
		}
	}

	return 0;
}


/* Drop a route to dest via neighbor */
int
nr_routedrop(dest,neighbor,ifnum)
uint8 *dest, *neighbor;
unsigned ifnum;
{
	register struct nrroute_tab *rp;
	register struct nrnbr_tab *np;
	register struct nr_bind *bp;

	if((rp = find_nrroute(dest)) == NULL)
		return -1;

	if((np = find_nrnbr(neighbor,ifnum)) == NULL)
		return -1;

	if((bp = find_binding(rp->routes,np)) == NULL)
		return -1;

	/* drop the binding first */
	if(bp->next != NULL)
		bp->next->prev = bp->prev;
	if(bp->prev != NULL)
		bp->prev->next = bp->next;
	else
		rp->routes = bp->next;

	free(bp);
	rp->num_routes--;		/* decrement the number of bindings */
	np->refcnt--;			/* and the number of neighbor references */
	
	/* now see if we should drop the route table entry */
	if(rp->num_routes == 0){
		if(rp->next != NULL)
			rp->next->prev = rp->prev;
		if(rp->prev != NULL)
			rp->prev->next = rp->next;
		else
			Nrroute_tab[nrhash(dest)] = rp->next;

		free(rp);
	}

	/* and check to see if this neighbor can be dropped */
	if(np->refcnt == 0){
		if(np->next != NULL)
			np->next->prev = np->prev;
		if(np->prev != NULL)
			np->prev->next = np->next;
		else
			Nrnbr_tab[nrhash(neighbor)] = np->next;

		free(np);
	}
	
	return 0;
}

#ifdef	notused
/* Find the best neighbor for destination dest, in arp format */
static uint8 *
nr_getroute(dest)
uint8 *dest;
{
	register struct nrroute_tab *rp;
	register struct nr_bind *bp;

	if((rp = find_nrroute(dest)) == NULL)
		return NULL;

	if((bp = find_best(rp->routes,1)) == NULL)	/* shouldn't happen! */
		return NULL;

	return bp->via->call;
}
#endif	/* notused */

/* Find an entry in the filter table */
static struct nrnf_tab *
find_nrnf(addr,ifnum)
register uint8 *addr;
unsigned ifnum;
{
	uint16 hashval;
	register struct nrnf_tab *fp;

	/* Find appropriate hash chain */
	hashval = nrhash(addr);

	/* search hash chain */
	for(fp = Nrnf_tab[hashval]; fp != NULL; fp = fp->next){
		if(addreq(fp->neighbor,addr) && fp->iface == ifnum){
			return fp;
		}
	}

	return NULL;
}

/* Add an entry to the filter table.  Return 0 on success,
 * -1 on failure
 */
int
nr_nfadd(addr,ifnum)
uint8 *addr;
unsigned ifnum;
{
	struct nrnf_tab *fp;
	uint16 hashval;
	
	if(find_nrnf(addr,ifnum) != NULL)
		return 0;	/* already there; it's a no-op */

	fp = (struct nrnf_tab *)callocw(1,sizeof(struct nrnf_tab));

	hashval = nrhash(addr);
	memcpy(fp->neighbor,addr,AXALEN);
	fp->iface = ifnum;
	fp->next = Nrnf_tab[hashval];
	if(fp->next != NULL)
		fp->next->prev = fp;
	Nrnf_tab[hashval] = fp;

	return 0;
}

/* Drop a neighbor from the filter table.  Returns 0 on success, -1
 * on failure.
 */
int
nr_nfdrop(addr,ifnum)
uint8 *addr;
unsigned ifnum;
{
	struct nrnf_tab *fp;

	if((fp = find_nrnf(addr,ifnum)) == NULL)
		return -1;	/* not in the table */

	if(fp->next != NULL)
		fp->next->prev = fp->prev;
	if(fp->prev != NULL)
		fp->prev->next = fp->next;
	else
		Nrnf_tab[nrhash(addr)] = fp->next;

	free(fp);

	return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线视频你懂得| 国产成人a级片| 亚洲自拍欧美精品| 亚洲欧洲精品一区二区三区| 国产精品嫩草影院com| 国产女主播视频一区二区| 久久精品夜色噜噜亚洲aⅴ| 精品国产乱子伦一区| 久久久久久一二三区| 国产丝袜在线精品| 亚洲人吸女人奶水| 亚洲国产另类精品专区| 亚洲v中文字幕| 久久精品国产精品亚洲红杏| 美腿丝袜亚洲三区| 国产精品亚洲第一| 91丨porny丨国产入口| 精品视频一区三区九区| 日韩三级免费观看| 国产欧美日韩不卡免费| 亚洲视频一区在线| 视频一区欧美精品| 久久66热偷产精品| 成人av电影免费在线播放| 在线亚洲欧美专区二区| 91精品国产欧美日韩| 国产校园另类小说区| 一区二区理论电影在线观看| 日本午夜精品视频在线观看| 国产ts人妖一区二区| 一道本成人在线| 日韩欧美一二区| 中文字幕在线不卡国产视频| 日韩高清在线观看| 成人免费视频视频| 欧美精品777| 国产精品国产三级国产普通话三级| 亚洲柠檬福利资源导航| 黄色小说综合网站| 在线观看一区二区精品视频| 精品国产电影一区二区| 亚洲综合小说图片| 国产盗摄视频一区二区三区| 欧美日韩一二区| 国产精品网曝门| 蜜臀av一区二区在线免费观看 | 成人黄色在线网站| 欧美日韩精品一区视频| 国产精品日韩精品欧美在线| 亚洲444eee在线观看| 成人免费视频国产在线观看| 日韩三级精品电影久久久| 亚洲综合丝袜美腿| 成人sese在线| 国产性天天综合网| 久久成人免费网| 欧美另类久久久品| 一区二区不卡在线播放 | 欧美一级欧美三级| 亚洲欧洲日韩在线| 日韩高清一区二区| 日韩av一级片| 精品国产91乱码一区二区三区| 国产精一品亚洲二区在线视频| 国产精品网站在线观看| 欧美视频你懂的| 另类小说视频一区二区| 中文字幕精品一区二区精品绿巨人 | 99re视频这里只有精品| 亚洲6080在线| 欧美激情一区二区三区全黄| 色婷婷精品大在线视频| 精品一区二区三区在线观看国产| 国产精品美女久久久久久久| 欧美日免费三级在线| 国产馆精品极品| 亚洲3atv精品一区二区三区| 久久综合久久综合久久| 欧美色图第一页| 丁香婷婷综合色啪| 日韩av二区在线播放| 亚洲日本韩国一区| 久久综合国产精品| 欧美午夜宅男影院| 成人av电影在线播放| 另类中文字幕网| 亚洲国产日产av| 国产精品久久久99| 欧美一区二区免费视频| 在线观看www91| 成人a级免费电影| 精东粉嫩av免费一区二区三区| 亚洲综合在线第一页| 国产精品久久久久久久久动漫 | 午夜精品久久久久影视| 国产午夜精品一区二区三区嫩草| 欧美猛男男办公室激情| 91小视频免费观看| 福利电影一区二区| 国产一区二区三区av电影 | 一区二区三区精品久久久| 久久精品人人做人人爽97| 欧美日韩精品福利| 欧美视频一区在线| 一本色道a无线码一区v| 97精品超碰一区二区三区| 国产一区二区三区| 国产在线播放一区三区四| 免费成人小视频| 丝袜美腿亚洲综合| 丝袜美腿亚洲色图| 日韩av网站免费在线| 午夜在线成人av| 无吗不卡中文字幕| 肉丝袜脚交视频一区二区| 亚洲大片免费看| 亚洲综合999| 亚洲一区免费视频| 一区二区三区波多野结衣在线观看| 国产精品超碰97尤物18| 1024亚洲合集| 成人欧美一区二区三区1314| 国产精品久久久久久久蜜臀| 国产精品国产三级国产aⅴ入口 | 综合av第一页| 一区二区三区在线免费观看| 亚洲欧美日韩中文播放| 亚洲另类在线视频| 亚洲18影院在线观看| 日精品一区二区| 久久精品99国产精品| 精品亚洲国产成人av制服丝袜| 国产乱码精品一区二区三| 国产91精品久久久久久久网曝门 | 91色综合久久久久婷婷| 欧美日韩你懂的| 欧美精品高清视频| 久久日韩粉嫩一区二区三区| 中文无字幕一区二区三区 | 国产欧美一区二区三区沐欲| 国产精品狼人久久影院观看方式| 国产精品国产三级国产普通话三级| 一区二区三区在线影院| 日韩成人免费电影| 国产高清不卡二三区| 色8久久人人97超碰香蕉987| 欧美精品一级二级| 久久九九久久九九| 一区二区在线免费| 美女视频一区在线观看| 波多野结衣亚洲一区| 欧美日高清视频| 久久日韩粉嫩一区二区三区| 亚洲美女免费在线| 免费精品视频在线| caoporen国产精品视频| 制服视频三区第一页精品| 国产性做久久久久久| 亚洲aⅴ怡春院| 成人性色生活片| 欧美一区二区久久久| 中文字幕在线播放不卡一区| 麻豆精品久久精品色综合| 99精品1区2区| 精品女同一区二区| 亚洲综合在线电影| 国产激情视频一区二区在线观看 | 欧美日韩久久久久久| 久久久综合网站| 亚洲444eee在线观看| 大桥未久av一区二区三区中文| 欧美日韩高清在线| 中文字幕一区在线观看视频| 精品一区二区日韩| 欧美挠脚心视频网站| 亚洲视频一区二区在线| 国产精品99久久不卡二区| 欧美日韩精品一区二区三区四区| 国产精品色婷婷| 国产一区二区在线视频| 欧美精品一级二级三级| 亚洲激情在线激情| 99这里只有精品| 欧美激情综合在线| 精品无人区卡一卡二卡三乱码免费卡 | 色爱区综合激月婷婷| 国产精品久久99| 成人午夜碰碰视频| 国产亚洲制服色| 国产老女人精品毛片久久| 日韩欧美国产wwwww| 日韩专区一卡二卡| 欧美日韩日日骚| 亚洲成人先锋电影| 欧美三级电影在线观看| 亚洲电影一区二区| 欧美日韩你懂的| 亚洲国产成人av| 欧美久久久久久久久中文字幕| 夜色激情一区二区|