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

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

?? packet.cc

?? NS2網絡仿真軟件是目前最為流行的網絡仿真模擬軟件
?? CC
字號:
/* * Copyright (c) 1991,1993 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *	This product includes software developed by the Computer Systems *	Engineering Group at Lawrence Berkeley Laboratory. * 4. Neither the name of the University nor of the Laboratory may be used *    to endorse or promote products derived from this software without *    specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#) $Header: /cvsroot/nsnam/nam-1/packet.cc,v 1.33 2005/01/24 23:30:41 haldar Exp $ (LBL) */#ifdef WIN32#include <windows.h>#endif#include "transform.h"#include "view.h"#include "netview.h"#include "psview.h"#include "edge.h"#include "node.h"#include "packet.h"//<zheng: +++>#include "parser.h"#define MIN_RANGE_WPAN	3//</zheng: +++>#include "config.h"int Packet::count_ = 0;BPacket::BPacket(double  x, double y ,const PacketAttr& p , double now, 		 long offset, int direction, double duration, double radius )	: Animation(now, offset) {	x_ = x ;	y_ = y ;	pkt_ = p ;	if (direction == FORWARDS ) {		//radius_ = MIN_RANGE ;							//zheng: ---		radius_ = (ParseTable::nam4wpan)?MIN_RANGE_WPAN:MIN_RANGE ;		//zheng: +++		start_ = now ;		if (ParseTable::wpan_bradius < 0) 			ParseTable::wpan_bradius = (int)radius;	//zheng: +++	} else {		radius_ = MAX_RANGE ; // BACKWARD		if (ParseTable::nam4wpan)						//zheng: +++		if (ParseTable::wpan_bradius > 0) radius_ = ParseTable::wpan_bradius;	//zheng: +++		start_ = now - duration;	}	direction_ = direction;	aType_ = BPACKET;	duration_ = duration;	max_radius_ = radius;	if (ParseTable::nam4wpan)							//zheng: +++	if (ParseTable::wpan_bradius > 0) max_radius_ = ParseTable::wpan_bradius;	//zheng: +++}void BPacket::draw(View* nv, double now) {	nv->circle(x_, y_,radius_,paint_);}void BPacket::update(double now){	curTime_ = now;	update_bb();	if (now < start_ || now > start_ + duration_)		delete this;}void BPacket::update_bb(){	// radius_ starts at MIN_RANGE, moves to MAX_RANGE over duration_	//radius_ = ((curTime_ - start_) / duration_) * (max_radius_-MIN_RANGE)													//zheng: ---	//	+ MIN_RANGE;																			//zheng: ---	radius_ = ((curTime_ - start_) / duration_) * (max_radius_-((ParseTable::nam4wpan)?MIN_RANGE_WPAN:MIN_RANGE)) + ((ParseTable::nam4wpan)?MIN_RANGE_WPAN:MIN_RANGE);	//zheng: +++}const char* BPacket::info() const{	static char text[128];	sprintf(text, "%s %d: %s\n  Sent at %.6f\n  %d bytes\n",		pkt_.type, pkt_.id, pkt_.convid, start_, pkt_.size);	return (text);}const char* BPacket::getname() const{	static char text[128];	sprintf(text, "p");	return (text);}void BPacket::monitor(Monitor *m, double , char *result, int ){	if (((direction_ == FORWARDS) && (radius_ > MAX_RANGE)) ||	//    ((direction_ == BACKWARDS) && (radius_ < MIN_RANGE)) ) {						//zheng: ---	    ((direction_ == BACKWARDS) && (radius_ < ((ParseTable::nam4wpan)?MIN_RANGE_WPAN:MIN_RANGE))) ) {	//zheng: +++		result[0] = '\0' ; 		return ;	}		monitor_=m;	sprintf(result, "%s %d: %s\n Sent at %.6f\n %d bytes",		pkt_.type, pkt_.id, pkt_.convid, start_, pkt_.size);}MonState *BPacket::monitor_state(){	/*return any state we wish the monitor to remember after we're gone*/	MonState * ms = new MonState;	ms->type = MON_PACKET;	ms->pkt.id = pkt_.id;	return ms;}int BPacket::inside(float px, float py) const{	double dx =  ((double) px - x_ ) ;	double dy =  ((double) py - y_ ) ;	double d = sqrt(dx*dx + dy*dy) ;	double dev = 1 ;		if ((d <= (radius_ + dev)) && (d >= (radius_ - dev))) 		return 1 ;	else 		return 0;}/* * Compute the start and end points of the packet in the one dimensional * time space [0, link delay]. */inline int Packet::EndPoints(double now, double& tail, double& head) const{	int doarrow;	if (now < ta_) {		head = now - ts_;		doarrow = 1;	} else {		head = edge_->delay();		doarrow = 0;	}	double t = now - tx_;	tail = (t <= ts_) ? 0. : t - ts_;	tail = tail * edge_->reallength() / edge_->delay();	head = head * edge_->reallength() / edge_->delay();	return (doarrow);}Packet::Packet(Edge *e, const PacketAttr& p, double s, double txtime,	       long offset ) : Animation(s, offset){	edge_ = e;	e->AddPacket(this);	pkt_ = p;	ts_ = s;	ta_ = s + e->delay();	tx_ = txtime;	arriving_ = 0;	curTime_ = s;	update_bb(); // Initial setup	count_++;}Packet::~Packet(){  if (monitor_!=NULL) {    monitor_->delete_monitor_object(this);  }  count_--;}float Packet::distance(float /*x*/, float /*y*/) const {	// TODO	return HUGE_VAL;}/* * Compute the unit-space points for the packet polygon. * Return number of points in polygon. */int Packet::ComputePolygon(double now, float ax[5], float ay[5]) const{	double tail, head;	int doarrow = EndPoints(now, tail, head);	double deltap = head - tail;	const Transform& m = edge_->transform();	double height = edge_->PacketHeight();	//<zheng: +++>	//not too large	if (ParseTable::nam4wpan) {		float tx,ty,tx2,ty2,td;		tx = head;		ty = 0.2 * height;		m.imap(tx,ty);		tx2 = head;		ty2 = 0.2 * height + 1;		m.imap(tx2,ty2);		td = (tx2 - tx) * (tx2 - tx) + (ty2 - ty) * (ty2 - ty);		td = pow(td, 0.5);		if (height > td)			height = td;	}	//</zheng: +++>		float bot = 0.2 * height;	float top = 1.2 * height;	float mid = 0.7 * height;	/*XXX put some air between packet and link */	bot += 0.5 * height;	top += 0.5 * height;	mid += 0.5 * height;		if (doarrow && deltap >= height) {		/* packet with arrowhead */		m.map(tail, bot, ax[0], ay[0]);		m.map(tail, top, ax[1], ay[1]);		m.map(head - 0.75 * height, top, ax[2], ay[2]);		m.map(head, mid, ax[3], ay[3]);		m.map(head - 0.75 * height, bot, ax[4], ay[4]);		return (5);	} else {		/* packet without arrowhead */		m.map(tail, bot, ax[0], ay[0]);		m.map(tail, top, ax[1], ay[1]);		m.map(head, top, ax[2], ay[2]);		m.map(head, bot, ax[3], ay[3]);		return (4);	}}// Assuming that curTime_ is set correctly. This can be guaranteed since// the only way to adjust current time is through Packet::update().void Packet::update_bb(){	int npts;	float x[5], y[5];	npts = ComputePolygon(curTime_, x, y);	bb_.xmin = bb_.xmax = x[0];	bb_.ymin = bb_.ymax = y[0];	while (--npts > 0) {		if (x[npts] < bb_.xmin)			bb_.xmin = x[npts];		if (x[npts] > bb_.xmax)			bb_.xmax = x[npts];		if (y[npts] < bb_.ymin)			bb_.ymin = y[npts];		if (y[npts] > bb_.ymax)			bb_.ymax = y[npts];	}}int Packet::inside(double now, float px, float py) const{	int npts;	float x[5], y[5];	BBox bb;	if (now < ts_ || now > ta_ + tx_)		return (0);	npts = ComputePolygon(now, x, y);	bb.xmin = bb.xmax = x[0];	bb.ymin = bb.ymax = y[0];	while (--npts > 0) {		if (x[npts] < bb.xmin)			bb.xmin = x[npts];		if (x[npts] > bb.xmax)			bb.xmax = x[npts];		if (y[npts] < bb.ymin)			bb.ymin = y[npts];		if (y[npts] > bb.ymax)			bb.ymax = y[npts];	}	return bb.inside(px, py);}const char* Packet::info() const{	static char text[128];	sprintf(text, "%s %d: %s\n  Sent at %.6f\n  %d bytes\n",		pkt_.type, pkt_.id, pkt_.convid, ts_, pkt_.size);	return (text);}const char* Packet::gettype() const{	static char text[128];	sprintf(text, "%s", pkt_.type);	return (text);}const char* Packet::getfid() const{	static char text[128];	sprintf(text, "%s", pkt_.convid);	return (text);}const char* Packet::getesrc() const{	static char text[128];	sprintf(text, "%d", pkt_.esrc);	return (text);}const char* Packet::getedst() const{	static char text[128];	sprintf(text, "%d", pkt_.edst);	return (text);}const char* Packet::getname() const{	static char text[128];	sprintf(text, "p");	return (text);}void Packet::monitor(Monitor *m, double , char *result, int ){  monitor_=m;  sprintf(result, "%s %d: %s\n Sent at %.6f\n %d bytes",	  pkt_.type, pkt_.id, pkt_.convid, ts_, pkt_.size);}MonState *Packet::monitor_state(){  /*return any state we wish the monitor to remember after we're gone*/  MonState *ms=new MonState;  ms->type=MON_PACKET;  ms->pkt.id=pkt_.id;  return ms;}void Packet::RearrangePoints(View *v, int npts, float x[5], float y[5]) const{	x[4] = (int) x[0] + 1;	v->map(x[2], y[2]);	v->map(x[1], y[1]);	x[2] = (int) x[1] + 1;	if (npts == 5) {		v->map(x[3], y[3]);		x[3] = x[2];		v->imap(x[3], y[3]);	}	v->imap(x[4], y[4]);	v->imap(x[2], y[2]);}	void Packet::CheckPolygon(View *v, int npts, float ax[5], float ay[5]) const{	float x[5], y[5];	memcpy((char *)x, (char *)ax, npts * sizeof(float));	memcpy((char *)y, (char *)ay, npts * sizeof(float));	v->map(x[4], y[4]);	v->map(x[0], y[0]);	if ((x[4] > x[0]) && ((int)x[4] - (int)x[0] < 1)) {		RearrangePoints(v, npts, x, y);		memcpy((char *)ax, (char *)x, npts * sizeof(float));		memcpy((char *)ay, (char *)y, npts * sizeof(float));	} else if ((x[0] > x[4]) && (x[0] - x[4] < 1)) {		float tmp;		tmp = x[0], x[0] = x[4], x[4] = tmp;		tmp = x[1], x[1] = x[2], x[2] = tmp;		RearrangePoints(v, npts, x, y);		tmp = x[0], x[0] = x[4], x[4] = tmp;		tmp = x[1], x[1] = x[2], x[2] = tmp;		memcpy((char *)ax, (char *)x, npts * sizeof(float));		memcpy((char *)ay, (char *)y, npts * sizeof(float));	}}void Packet::draw(View* nv, double now) {	/* XXX */	if (now < ts_ || now > ta_ + tx_)		return;	float x[5], y[5];	int npts;	npts = ComputePolygon(now, x, y);	//CheckPolygon(nv, npts, x, y);	// Stupid way to decide fill/unfilled!//  	if ((pkt_.attr & 0x100) == 0)//  		nv->fill(x, y, npts, paint_);//  	else //  		nv->polygon(x, y, npts, paint_);	nv->fill(x, y, npts, paint_);	/*XXX stupid way to get size!*/	if (monitor_!=NULL)	  monitor_->draw(nv, x[0], y[0]);}/*void Packet::draw(PSView* nv, double now) const{	if (now < ts_ || now > ta_ + tx_)		return;	float x[5], y[5];	int npts;	npts = ComputePolygon(now, x, y);	nv->fill(x, y, npts, paint_);}*/void Packet::update(double now){  if ((now > ta_)&&(arriving_==0))    {      /*If the packet has started to arrive, trigger any arrival event	for the edge*/      edge_->arrive_packet(this, ta_);      arriving_=1;    }  if (now > ta_ + tx_ || now < ts_)    {		/* XXX this does not belong here */#ifdef DEBUG      printf("packet %d arrived from %d at %d\n", pkt_.id, edge_->src(), edge_->dst());#endif      /*remove this packet from the edge packet list*/      edge_->DeletePacket(this);      delete this;    } else {	    // Current time has changed, update its bounding box	    // XXX No clean way to keep its bb_ up-to-date. :(	    curTime_ = now;	    update_bb();    }}void Packet::position(float& x, float& y, double now) const{  float xs[5], ys[5];  int npts;  int i;  /*XXX using ComputePolygon is overkill*/  npts = ComputePolygon(now, xs, ys);  x=0;y=0;  for(i=0;i<npts;i++)    {      x+=xs[i];      y+=ys[i];    }  x/=npts;  y/=npts;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av资源在线观看| 久久亚洲春色中文字幕久久久| 国产一区二区中文字幕| 日本系列欧美系列| 青青草伊人久久| 美女脱光内衣内裤视频久久影院| 奇米色777欧美一区二区| 日韩不卡一区二区三区| 久久99九九99精品| 国产成人精品免费| av中文字幕亚洲| 在线看不卡av| 欧美日韩一区 二区 三区 久久精品 | 欧美羞羞免费网站| 欧美日韩精品系列| 日韩一区二区高清| 国产欧美日韩在线视频| 国产精品萝li| 亚洲成va人在线观看| 美女一区二区三区| 成人h动漫精品| 欧美视频在线一区| 亚洲精品一区二区三区福利| 国产亚洲污的网站| 一区二区三区四区不卡视频 | 欧美一个色资源| 精品国产一区二区三区不卡| 国产欧美一区二区精品性色| 一区二区欧美精品| 久久成人羞羞网站| 91丝袜国产在线播放| 欧美年轻男男videosbes| 日韩欧美三级在线| 国产精品福利影院| 奇米精品一区二区三区在线观看一| 国产一区二区三区免费| 在线视频综合导航| 国产亚洲精品福利| 日本欧美一区二区在线观看| 丰满少妇久久久久久久| 欧美精品免费视频| 亚洲视频免费看| 老司机午夜精品| 在线观看不卡视频| 欧美激情综合五月色丁香| 天天av天天翘天天综合网色鬼国产| 久久66热re国产| 在线观看欧美黄色| 国产亚洲人成网站| 蜜乳av一区二区| 一本久久a久久精品亚洲| 26uuu欧美| 日韩成人一级片| 91福利在线导航| 国产精品欧美极品| 韩日精品视频一区| 日韩视频免费观看高清在线视频| 国产午夜三级一区二区三| 日本成人在线不卡视频| av中文字幕一区| 欧美激情综合五月色丁香 | 成人午夜视频在线| 日韩一区二区三区观看| 亚洲一区二区三区四区的 | 视频一区免费在线观看| 91国偷自产一区二区开放时间| 国产欧美一区二区精品忘忧草| 麻豆成人久久精品二区三区小说| 精品视频1区2区3区| 一区二区三区国产豹纹内裤在线| 成人av片在线观看| 中文字幕日本乱码精品影院| 成人黄色大片在线观看| 亚洲国产精品成人久久综合一区| 国产在线观看免费一区| 欧美精品一区视频| 国产一区二区毛片| 久久久不卡网国产精品二区| 国产一区二区视频在线播放| 精品国产人成亚洲区| 国内精品伊人久久久久av影院 | 国产精品1024久久| 久久久久久久久伊人| 国产成人在线视频网站| 国产精品福利影院| 91影院在线免费观看| 亚洲伊人伊色伊影伊综合网| 99精品视频在线观看| 亚洲综合一区二区精品导航| 欧美撒尿777hd撒尿| 日韩avvvv在线播放| 精品福利在线导航| 岛国精品在线观看| 亚洲另类在线视频| 欧美日韩极品在线观看一区| 日韩精品久久久久久| 久久久亚洲精华液精华液精华液| zzijzzij亚洲日本少妇熟睡| 亚洲综合一区二区| 91精品国产一区二区三区蜜臀| 久久精品国产成人一区二区三区 | 久久精品国产亚洲高清剧情介绍| 精品免费一区二区三区| 成人激情免费电影网址| 亚洲成人午夜电影| 国产三级精品三级在线专区| 91欧美激情一区二区三区成人| 五月天丁香久久| 亚洲国产精品激情在线观看| 在线观看免费成人| 国产麻豆精品在线观看| 一级日本不卡的影视| 精品成人一区二区| 日本国产一区二区| 国产成人午夜精品影院观看视频| 有码一区二区三区| 国产午夜精品美女毛片视频| 欧美性受xxxx黑人xyx| 国产毛片精品国产一区二区三区| 亚洲精品一二三区| 久久色视频免费观看| 欧美视频中文字幕| 成人深夜福利app| 九九热在线视频观看这里只有精品| 亚洲欧洲成人自拍| 久久蜜桃av一区二区天堂| 91激情五月电影| 成人免费毛片app| 久久99热狠狠色一区二区| 亚洲一区二区在线观看视频| 欧美国产精品v| 久久一区二区三区四区| 欧美日本视频在线| 色呦呦国产精品| 成人动漫一区二区| 国产一区二三区| 蜜臂av日日欢夜夜爽一区| 亚洲欧美日韩在线| 中文字幕制服丝袜一区二区三区| wwwwxxxxx欧美| 日韩亚洲电影在线| 欧美色综合网站| 在线观看国产91| 在线日韩一区二区| 91蜜桃在线观看| aaa欧美大片| 99热在这里有精品免费| 成人性生交大片免费看视频在线 | 色94色欧美sute亚洲线路一ni| 国产99精品在线观看| 国产成人综合在线| 国内精品视频666| 国产又粗又猛又爽又黄91精品| 久久成人久久爱| 另类小说一区二区三区| 看片的网站亚洲| 久久国产精品99久久久久久老狼| 日本伊人色综合网| 精品中文av资源站在线观看| 精品一区二区三区在线观看| 国精产品一区一区三区mba桃花| 麻豆91精品91久久久的内涵| 激情欧美一区二区| 福利一区二区在线观看| 成人a级免费电影| 在线看不卡av| 欧美一级片免费看| 久久久久久久久一| 国产精品伦理在线| 一区二区三区日韩精品视频| 亚洲国产中文字幕在线视频综合| 亚洲成人动漫一区| 日本欧美在线看| 国产成人精品综合在线观看| 99久久精品一区二区| 欧美片在线播放| 久久人人爽人人爽| 亚洲天堂成人在线观看| 五月婷婷另类国产| 国产综合久久久久久鬼色| 成人午夜在线免费| 欧美精选在线播放| 久久精品一区二区三区av| 自拍视频在线观看一区二区| 日韩电影在线看| 成人av中文字幕| 91精品国产一区二区三区蜜臀 | 亚洲综合色自拍一区| 免费成人在线影院| 99久久免费国产| 日韩一级高清毛片| 日韩毛片在线免费观看| 美女网站色91| 在线观看欧美日本| 国产精品视频第一区| 日本不卡视频一二三区| 91在线精品秘密一区二区| 欧美va日韩va| 亚洲国产日韩一区二区| 丁香婷婷深情五月亚洲|