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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ax25.c

?? TCPIP協(xié)議包
?? C
字號(hào):
/* Low level AX.25 code:
 */
#include <stdio.h>
#include "global.h"
#include "mbuf.h"
#include "iface.h"
#include "arp.h"
#include "slip.h"
#include "ax25.h"
#include "lapb.h"
#include "netrom.h"
#include "ip.h"
#include "devparam.h"
#include <ctype.h>

/* List of AX.25 multicast addresses in network format (shifted ascii).
 * Only the first entry is used for transmission, but an incoming
 * packet with any one of these destination addresses is recognized
 * as a multicast.
 */
uint8 Ax25multi[][AXALEN] = {
	'Q'<<1, 'S'<<1, 'T'<<1, ' '<<1, ' '<<1, ' '<<1, '0'<<1,	/* QST */
	'M'<<1, 'A'<<1, 'I'<<1, 'L'<<1, ' '<<1, ' '<<1, '0'<<1,	/* MAIL */
	'N'<<1, 'O'<<1, 'D'<<1, 'E'<<1, 'S'<<1, ' '<<1, '0'<<1,	/* NODES */
	'I'<<1, 'D'<<1, ' '<<1, ' '<<1, ' '<<1, ' '<<1, '0'<<1,	/* ID */
	'O'<<1, 'P'<<1, 'E'<<1, 'N'<<1, ' '<<1, ' '<<1, '0'<<1,	/* OPEN */
	'C'<<1, 'Q'<<1, ' '<<1, ' '<<1, ' '<<1, ' '<<1, '0'<<1,	/* CQ */
	'B'<<1, 'E'<<1, 'A'<<1, 'C'<<1, 'O'<<1, 'N'<<1, '0'<<1,	/* BEACON */
	'R'<<1, 'M'<<1, 'N'<<1, 'C'<<1, ' '<<1, ' '<<1, '0'<<1,	/* RMNC */
	'A'<<1, 'L'<<1, 'L'<<1, ' '<<1, ' '<<1, ' '<<1, '0'<<1,	/* ALL */
	'\0',
};
uint8 Mycall[AXALEN];
struct ax_route *Ax_routes;	/* Routing table header */
int Digipeat = 1;	/* Controls digipeating */

int
axi_send(
struct mbuf **bpp,
struct iface *iface,
int32 gateway,
uint8 tos
){
	return axui_send(bpp,iface,gateway,tos);
}

/* Send IP datagrams across an AX.25 link */
int
axui_send(
struct mbuf **bpp,
struct iface *iface,
int32 gateway,
uint8 tos
){
	struct mbuf *tbp;
	uint8 *hw_addr;
	struct ax25_cb *axp;

	if((hw_addr = res_arp(iface,ARP_AX25,gateway,bpp)) == NULL)
		return 0;	/* Wait for address resolution */

	/* UI frames are used for any one of the following three conditions:
	 * 1. The "low delay" bit is set in the type-of-service field.
	 * 2. The "reliability" TOS bit is NOT set and the interface is in
	 *    datagram mode.
	 * 3. The destination is the broadcast address (this is helpful
	 *    when broadcasting on an interface that's in connected mode).
	 */
	if((tos & IP_COS) == DELAY
	 || ((tos & IP_COS) != RELIABILITY && (iface->send == axui_send))
	 || addreq(hw_addr,Ax25multi[0])){
		/* Use UI frame */
		return (*iface->output)(iface,hw_addr,iface->hwaddr,PID_IP,bpp);
	}
	/* Reliability is needed; use I-frames in AX.25 connection */
	if((axp = find_ax25(hw_addr)) == NULL){
		/* Open a new connection */
		axp = open_ax25(iface,iface->hwaddr,hw_addr,
		 AX_ACTIVE,Axwindow,s_arcall,s_atcall,s_ascall,-1);
		if(axp == NULL){
			free_p(bpp);
			return -1;
		}
	}
	if(axp->state == LAPB_DISCONNECTED){
		est_link(axp);
		lapbstate(axp,LAPB_SETUP);
	}
	/* Insert the PID */
	pushdown(bpp,NULL,1);
	(*bpp)->data[0] = PID_IP;
	if((tbp = segmenter(bpp,axp->paclen)) == NULL){
		free_p(bpp);
		return -1;
	}
	return send_ax25(axp,&tbp,-1);
}
/* Add header and send connectionless (UI) AX.25 packet.
 * Note that the calling order here must match enet_output
 * since ARP also uses it.
 */
int
ax_output(
struct iface *iface,	/* Interface to use; overrides routing table */
uint8 *dest,		/* Destination AX.25 address (7 bytes, shifted) */
uint8 *source,		/* Source AX.25 address (7 bytes, shifted) */
uint16 pid,		/* Protocol ID */
struct mbuf **bpp	/* Data field (follows PID) */
){
	/* Prepend pid to data */
	pushdown(bpp,NULL,1);
	(*bpp)->data[0] = (uint8)pid;
	return axsend(iface,dest,source,LAPB_COMMAND,UI,bpp);
}
/* Common subroutine for sendframe() and ax_output() */
int
axsend(
struct iface *iface,	/* Interface to use; overrides routing table */
uint8 *dest,		/* Destination AX.25 address (7 bytes, shifted) */
uint8 *source,		/* Source AX.25 address (7 bytes, shifted) */
int cmdrsp,		/* Command/response indication */
int ctl,		/* Control field */
struct mbuf **bpp	/* Data field (includes PID) */
){
	struct ax25 addr;
	struct ax_route *axr;
	uint8 *idest;
	int rval;

	/* If the source addr is unspecified, use the interface address */
	if(source[0] == '\0')
		source = iface->hwaddr;

	/* If there's a digipeater route, get it */
	axr = ax_lookup(dest);

	memcpy(addr.dest,dest,AXALEN);
	memcpy(addr.source,source,AXALEN);
	addr.cmdrsp = cmdrsp;

	if(axr != NULL){
		memcpy(addr.digis,axr->digis,axr->ndigis*AXALEN);
		addr.ndigis = axr->ndigis;
		idest = addr.digis[0];
	} else {
		addr.ndigis = 0;
		idest = dest;
	}
	addr.nextdigi = 0;

	/* Allocate mbuf for control field, and fill in */
	pushdown(bpp,NULL,1);
	(*bpp)->data[0] = ctl;

	htonax25(&addr,bpp);
	/* This shouldn't be necessary because redirection has already been
	 * done at the IP router layer, but just to be safe...
	 */
	if(iface->forw != NULL){
		logsrc(iface->forw,iface->forw->hwaddr);
		logdest(iface->forw,idest);
		rval = (*iface->forw->raw)(iface->forw,bpp);
	} else {
		logsrc(iface,iface->hwaddr);
		logdest(iface,idest);
		rval = (*iface->raw)(iface,bpp);
	}
	return rval;
}
/* Process incoming AX.25 packets.
 * After optional tracing, the address field is examined. If it is
 * directed to us as a digipeater, repeat it.  If it is addressed to
 * us or to QST-0, kick it upstairs depending on the protocol ID.
 */
void
ax_recv(
struct iface *iface,
struct mbuf **bpp
){
	uint8 control;
	struct ax25 hdr;
	struct ax25_cb *axp;
	struct ax_route *axr;
	uint8 (*mpp)[AXALEN];
	int mcast;
	uint8 *isrc,*idest;	/* "immediate" source and destination */

	/* Pull header off packet and convert to host structure */
	if(ntohax25(&hdr,bpp) < 0){
		/* Something wrong with the header */
		free_p(bpp);
		return;
	}
	/* If there were digis in this packet and at least one has
	 * been passed, then the last passed digi is the immediate source.
	 * Otherwise it is the original source.
	 */
	if(hdr.ndigis != 0 && hdr.nextdigi != 0)
		isrc = hdr.digis[hdr.nextdigi-1];
	else
		isrc = hdr.source;

	/* If there are digis in this packet and not all have been passed,
	 * then the immediate destination is the next digi. Otherwise it
	 * is the final destination.
	 */
	if(hdr.ndigis != 0 && hdr.nextdigi != hdr.ndigis)
		idest = hdr.digis[hdr.nextdigi];
	else
		idest = hdr.dest;

	/* Don't log our own packets if we overhear them, as they're
	 * already logged by axsend() and by the digipeater code.
	 */
	if(!addreq(isrc,iface->hwaddr)){
		logsrc(iface,isrc);
		logdest(iface,idest);
	}
	/* Examine immediate destination for a multicast address */
	mcast = 0;
	for(mpp = Ax25multi;(*mpp)[0] != '\0';mpp++){
		if(addreq(idest,*mpp)){
			mcast = 1;
			break;
		}
	}
	if(!mcast && !addreq(idest,iface->hwaddr)){
		/* Not a broadcast, and not addressed to us. Inhibit
		 * transmitter to avoid colliding with addressed station's
		 * response, and discard packet.
		 */
		if(iface->ioctl != NULL)
			(*iface->ioctl)(iface,PARAM_MUTE,1,-1);
		free_p(bpp);
		return;
	}
	if(!mcast && iface->ioctl != NULL){
		/* Packet was sent to us; abort transmit inhibit */
		(*iface->ioctl)(iface,PARAM_MUTE,1,0);
	}
	/* At this point, packet is either addressed to us, or is
	 * a multicast.
	 */
	if(hdr.nextdigi < hdr.ndigis){
		/* Packet requests digipeating. See if we can repeat it. */
		if(Digipeat && !mcast){
			/* Yes, kick it back out. htonax25 will set the
			 * repeated bit.
			 */
			hdr.nextdigi++;
			htonax25(&hdr,bpp);
			if(iface->forw != NULL){
				logsrc(iface->forw,iface->forw->hwaddr);
				logdest(iface->forw,hdr.digis[hdr.nextdigi]);
				(*iface->forw->raw)(iface->forw,bpp);
			} else {
				logsrc(iface,iface->hwaddr);
				logdest(iface,hdr.digis[hdr.nextdigi]);
				(*iface->raw)(iface,bpp);
			}
		}
		free_p(bpp);	/* Dispose if not forwarded */
		return;
	}
	/* If we reach this point, then the packet has passed all digis,
	 * and is either addressed to us or is a multicast.
	 */
	if(*bpp == NULL)
		return;		/* Nothing left */

	/* If there's no locally-set entry in the routing table and
	 * this packet has digipeaters, create or update it. Leave
	 * local routes alone.
	 */
	if(((axr = ax_lookup(hdr.source)) == NULL || axr->type == AX_AUTO)
	 && hdr.ndigis > 0){
		uint8 digis[MAXDIGIS][AXALEN];
		int i,j;

		/* Construct reverse digipeater path */
		for(i=hdr.ndigis-1,j=0;i >= 0;i--,j++){
			memcpy(digis[j],hdr.digis[i],AXALEN);
			digis[j][ALEN] &= ~(E|REPEATED);
		}
		ax_add(hdr.source,AX_AUTO,digis,hdr.ndigis);
	}
	/* Sneak a peek at the control field. This kludge is necessary because
	 * AX.25 lacks a proper protocol ID field between the address and LAPB
	 * sublayers; a control value of UI indicates that LAPB is to be
	 * bypassed.
	 */
	control = *(*bpp)->data & ~PF;

	if(control == UI){
		int pid;
		struct axlink *ipp;

		(void) PULLCHAR(bpp);
		if((pid = PULLCHAR(bpp)) == -1)
			return;		/* No PID */
		/* Find network level protocol and hand it off */
		for(ipp = Axlink;ipp->funct != NULL;ipp++){
			if(ipp->pid == pid)
				break;
		}
		if(ipp->funct != NULL)
			(*ipp->funct)(iface,NULL,hdr.source,hdr.dest,bpp,mcast);
		else
			free_p(bpp);
		return;
	}
	/* Everything from here down is connected-mode LAPB, so ignore
	 * multicasts
	 */
	if(mcast){
		free_p(bpp);
		return;
	}
	/* Find the source address in hash table */
	if((axp = find_ax25(hdr.source)) == NULL){
		/* Create a new ax25 entry for this guy,
		 * insert into hash table keyed on his address,
		 * and initialize table entries
		 */
		if((axp = cr_ax25(hdr.source)) == NULL){
			free_p(bpp);
			return;
		}
		/* Swap source and destination */
		memcpy(axp->remote,hdr.source,AXALEN);
		memcpy(axp->local,hdr.dest,AXALEN);
		axp->iface = iface;
	}
	if(hdr.cmdrsp == LAPB_UNKNOWN)
		axp->proto = V1;	/* Old protocol in use */

	lapb_input(axp,hdr.cmdrsp,bpp);
}
/* Find a route for an AX.25 address */
struct ax_route *
ax_lookup(
uint8 *target
){
	register struct ax_route *axr;
	struct ax_route *axlast = NULL;

	for(axr = Ax_routes; axr != NULL; axlast=axr,axr = axr->next){
		if(addreq(axr->target,target)){
			if(axr != Ax_routes){
				/* Move entry to top of list to speed
				 * future searches
				 */
				axlast->next = axr->next;
				axr->next = Ax_routes;
				Ax_routes = axr;

			}
			return axr;
		}
	}
	return axr;
}
/* Add an entry to the AX.25 routing table */
struct ax_route *
ax_add(
uint8 *target,
int type,
uint8 digis[][AXALEN],
int ndigis
){
	register struct ax_route *axr;

	if(ndigis < 0 || ndigis > MAXDIGIS)
		return NULL;

	if((axr = ax_lookup(target)) == NULL){
		axr = (struct ax_route *)callocw(1,sizeof(struct ax_route));
		axr->next = Ax_routes;
		Ax_routes = axr;
		memcpy(axr->target,target,AXALEN);
		axr->ndigis = ndigis;
	}
	axr->type = type;
	if(axr->ndigis != ndigis)
		axr->ndigis = ndigis;

	memcpy(axr->digis,digis[0],ndigis*AXALEN);
	return axr;
}
int
ax_drop(
uint8 *target
){
	register struct ax_route *axr;
	struct ax_route *axlast = NULL;

	for(axr = Ax_routes;axr != NULL;axlast=axr,axr=axr->next)
		if(memcmp(axr->target,target,AXALEN) == 0)
			break;
	if(axr == NULL)
		return -1;	/* Not in table! */
	if(axlast != NULL)
		axlast->next = axr->next;
	else
		Ax_routes = axr->next;
	
	free(axr);
	return 0;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品中文字幕一区| 一本色道久久综合亚洲91| 欧美伦理影视网| 日本大胆欧美人术艺术动态| 欧美亚洲综合一区| 日韩av电影免费观看高清完整版| 91精品国产91久久久久久最新毛片 | 欧美精品第1页| 蜜桃视频在线一区| 国产午夜精品一区二区三区四区| av男人天堂一区| 亚洲成人自拍网| 精品久久人人做人人爽| 成人国产电影网| 亚洲成av人片在www色猫咪| 日韩欧美一区中文| 粉嫩av一区二区三区在线播放| 国产精品电影院| 91精品麻豆日日躁夜夜躁| 国产麻豆精品视频| 亚洲综合精品自拍| 精品国产伦理网| 97久久超碰国产精品| 日韩av电影免费观看高清完整版| 久久久99精品免费观看| 在线日韩av片| 国产精品一二三四| 亚洲一线二线三线视频| 精品国产91乱码一区二区三区| www.爱久久.com| 日韩av电影天堂| |精品福利一区二区三区| 51精品视频一区二区三区| 成人午夜看片网址| 日韩高清不卡在线| 国产精品久99| 欧美va在线播放| 在线看国产一区二区| 日日欢夜夜爽一区| 国产精品精品国产色婷婷| 日韩女优毛片在线| 欧美在线观看18| 成人午夜激情影院| 九色porny丨国产精品| 亚洲另类春色国产| www激情久久| 7777精品伊人久久久大香线蕉超级流畅| 国产成人99久久亚洲综合精品| 日韩不卡一区二区三区| 亚洲欧美乱综合| 国产人成一区二区三区影院| 欧美一区二区日韩一区二区| 91一区在线观看| 懂色av噜噜一区二区三区av| 日本欧美韩国一区三区| 一区二区日韩av| 国产精品天干天干在线综合| 精品国产一区二区在线观看| 欧美日韩精品久久久| 色婷婷亚洲精品| 成人av在线一区二区三区| 国产精品综合在线视频| 蜜臀99久久精品久久久久久软件| 亚洲国产日韩一级| 亚洲资源中文字幕| 亚洲激情一二三区| 亚洲精品高清视频在线观看| 亚洲视频免费在线| 中文字幕亚洲综合久久菠萝蜜| 国产女同互慰高潮91漫画| 日韩欧美卡一卡二| 欧美卡1卡2卡| 91麻豆精品久久久久蜜臀| 欧美日韩一区二区三区四区| 91精彩视频在线| 欧美三级视频在线观看| 欧美日韩一区高清| 91精品国产日韩91久久久久久| 欧美另类videos死尸| 欧美一区日韩一区| 精品国产一区二区在线观看| 久久久久综合网| 国产精品视频在线看| 亚洲日本一区二区| 亚洲午夜在线观看视频在线| 婷婷综合在线观看| 美女网站视频久久| 国产成人在线视频网站| 92国产精品观看| 在线观看亚洲成人| 91精品在线麻豆| 久久蜜臀中文字幕| 亚洲私人影院在线观看| 亚洲国产日韩a在线播放 | 丝袜美腿亚洲综合| 久久国产婷婷国产香蕉| 国产伦理精品不卡| 色香蕉成人二区免费| 欧美日韩一区国产| 精品成人在线观看| 亚洲黄色尤物视频| 毛片一区二区三区| 成人一级视频在线观看| 欧洲一区二区av| 日韩一级二级三级| 国产精品久久毛片a| 午夜精品成人在线| 国产成人免费视频| 欧美日韩免费不卡视频一区二区三区| 日韩一区二区在线观看视频| 久久九九99视频| 亚洲午夜免费视频| 国产乱码精品1区2区3区| 日本乱人伦aⅴ精品| 精品免费一区二区三区| 亚洲色欲色欲www| 精品中文字幕一区二区| 91在线观看成人| 精品国产免费久久| 亚洲一区二区视频在线观看| 看电影不卡的网站| 欧美在线制服丝袜| 国产精品私房写真福利视频| 天堂久久一区二区三区| 国产成人精品综合在线观看| 欧美另类videos死尸| 国产精品美日韩| 久久66热re国产| 欧美三级视频在线观看| 久久久国产精品不卡| 亚洲成人动漫精品| 91免费小视频| 国产片一区二区三区| 美腿丝袜亚洲综合| 欧美日韩一区二区三区四区五区| 国产精品天干天干在线综合| 麻豆国产欧美一区二区三区| 色综合久久66| 国产女人水真多18毛片18精品视频 | 欧美二区三区91| 一区二区三区自拍| 成人小视频在线| 国产无一区二区| 韩国精品免费视频| 日韩女优av电影在线观看| 亚洲大片一区二区三区| 色婷婷av一区二区三区软件| 国产亚洲精久久久久久| 激情五月播播久久久精品| 欧美日韩高清不卡| 亚洲午夜一区二区| 欧美性猛交xxxx黑人交| 亚洲免费观看高清完整 | 欧美制服丝袜第一页| 亚洲欧洲av在线| 成人av资源站| 国产精品国产自产拍高清av王其| 国产精品 欧美精品| 久久精品日韩一区二区三区| 久久超碰97人人做人人爱| 日韩午夜中文字幕| 久久精工是国产品牌吗| 日韩亚洲欧美高清| 青椒成人免费视频| 日韩欧美一级特黄在线播放| 性感美女极品91精品| 欧美丝袜自拍制服另类| 午夜电影久久久| 欧美一级理论片| 狠狠色丁香久久婷婷综合_中| 欧美tickle裸体挠脚心vk| 国产呦萝稀缺另类资源| 久久久久久久久久美女| 成人一级视频在线观看| 亚洲视频综合在线| 欧美日韩一区成人| 美女一区二区视频| 久久久精品国产免费观看同学| 国产激情一区二区三区| 国产精品少妇自拍| 99久久er热在这里只有精品66| 亚洲免费在线看| 欧美男生操女生| 精品亚洲成a人| 国产精品看片你懂得| 欧美日韩一区二区三区四区五区| 轻轻草成人在线| 国产欧美日韩麻豆91| 91蝌蚪porny成人天涯| 首页国产丝袜综合| www国产精品av| 色综合中文字幕国产| 亚洲欧美一区二区不卡| 欧美日韩成人高清| 国产传媒一区在线| 亚洲免费资源在线播放| 欧美一二三区在线观看| 成人听书哪个软件好| 午夜精品久久久久久久99水蜜桃 | 欧美艳星brazzers|