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

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

?? mac-tdma.cc

?? 在網絡仿真模擬工具下實現支持時隙的MAC層TDMA協議
?? CC
?? 第 1 頁 / 共 2 頁
字號:
// -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*-//// Copyright (c) 1999 by the University of Southern California// All rights reserved.//// Permission to use, copy, modify, and distribute this software and its// documentation in source and binary forms for non-commercial purposes// and without fee is hereby granted, provided that the above copyright// notice appear in all copies and that both the copyright notice and// this permission notice appear in supporting documentation. and that// any documentation, advertising materials, and other materials related// to such distribution and use acknowledge that the software was// developed by the University of Southern California, Information// Sciences Institute.  The name of the University may not be used to// endorse or promote products derived from this software without// specific prior written permission.//// THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about// the suitability of this software for any purpose.  THIS SOFTWARE IS// PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,// INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.//// Other copyrights might apply to parts of this software and are so// noted when applicable.//// $Header: /nfs/jade/vint/CVSROOT/ns-2/mac/mac-tdma.cc,v 1.12 2004/02/06 16:33:52 xuanc Exp $//// mac-tdma.cc// by Xuan Chen (xuanc@isi.edu), ISI/USC//// Preamble TDMA MAC layer for single hop.// Centralized slot assignment computing.#include "delay.h"#include "connector.h"#include "packet.h"#include "random.h"// #define DEBUG//#include <debug.h>#include "arp.h"#include "ll.h"#include "mac.h"#include "mac-tdma.h"#include "cmu-trace.h"#define SET_RX_STATE(x)			\{					\	rx_state_ = (x);			\}#define SET_TX_STATE(x)				\{						\	tx_state_ = (x);				\}/* Phy specs from 802.11 */static PHY_MIB PMIB = {	DSSS_CWMin, DSSS_CWMax, DSSS_SlotTime, DSSS_CCATime,	DSSS_RxTxTurnaroundTime, DSSS_SIFSTime, DSSS_PreambleLength,	DSSS_PLCPHeaderLength};	/* Timers */void MacTdmaTimer::start(Packet *p, double time){	Scheduler &s = Scheduler::instance();	assert(busy_ == 0);  	busy_ = 1;	paused_ = 0;	stime = s.clock();	rtime = time;	assert(rtime >= 0.0);  	s.schedule(this, p, rtime);}void MacTdmaTimer::stop(Packet *p) {	Scheduler &s = Scheduler::instance();	assert(busy_);  	if(paused_ == 0)		s.cancel((Event *)p);	// Should free the packet p.	Packet::free(p);  	busy_ = 0;	paused_ = 0;	stime = 0.0;	rtime = 0.0;}/* Slot timer for TDMA scheduling. */void SlotTdmaTimer::handle(Event *e){       	busy_ = 0;	paused_ = 0;	stime = 0.0;	rtime = 0.0;  	mac->slotHandler(e);}/* Receive Timer */void RxPktTdmaTimer::handle(Event *e) {       	busy_ = 0;	paused_ = 0;	stime = 0.0;	rtime = 0.0;  	mac->recvHandler(e);}/* Send Timer */void TxPktTdmaTimer::handle(Event *e) {       	busy_ = 0;	paused_ = 0;	stime = 0.0;	rtime = 0.0;  	mac->sendHandler(e);}/* ======================================================================   TCL Hooks for the simulator   ====================================================================== */static class MacTdmaClass : public TclClass {public:	MacTdmaClass() : TclClass("Mac/Tdma") {}	TclObject* create(int, const char*const*) {		return (new MacTdma(&PMIB));	}} class_mac_tdma;// Mac Tdma definitions// Frame format:// Pamble Slot1 Slot2 Slot3...MacTdma::MacTdma(PHY_MIB* p) : 	Mac(), mhSlot_(this), mhTxPkt_(this), mhRxPkt_(this){	/* Global variables setting. */	// Setup the phy specs.	phymib_ = p;		/* Get the parameters of the link (which in bound in mac.cc, 2M by default),	   the packet length within one TDMA slot (1500 byte by default), 	   and the max number of nodes (64) in the simulations.*/	bind("slot_packet_len_", &slot_packet_len_);	bind("max_node_num_", &max_node_num_);		//  slot_packet_len_ = 1500;	//  max_node_num_ = 64;	// Calculate the slot time based on the MAX allowed data length.	slot_time_ = DATA_Time(slot_packet_len_);		/* Calsulate the max slot num within on frame from max node num.	   In the simple case now, they are just equal. 	*/	max_slot_num_ = max_node_num_;		/* Much simplified centralized scheduling algorithm for single hop	   topology, like WLAN etc. 	*/	// Initualize the tdma schedule and preamble data structure.	tdma_schedule_ = new int[max_slot_num_];	tdma_preamble_ = new int[max_slot_num_];	/* Do each node's initialization. */	// Record the initial active node number.	active_node_++;	if (active_node_ > max_node_num_) {		printf("Too many nodes taking part in the simulations, aborting...\n");		exit(-1);	}    	// Initial channel / transceiver states. 	tx_state_ = rx_state_ = MAC_IDLE;	tx_active_ = 0;	// Initialy, the radio is off. NOTE: can't use radioSwitch(OFF) here.	radio_active_ = 0;	// Do slot scheduling.	re_schedule();	/* Deal with preamble. */	// Can't send anything in the first frame.	slot_count_ = FIRST_ROUND;	tdma_preamble_[slot_num_] = NOTHING_TO_SEND;	//Start the Slot timer..	mhSlot_.start((Packet *) (& intr_), 0);  }/* similar to 802.11, no cached node lookup. */int MacTdma::command(int argc, const char*const* argv){	if (argc == 3) {		if (strcmp(argv[1], "log-target") == 0) {			logtarget_ = (NsObject*) TclObject::lookup(argv[2]);			if(logtarget_ == 0)				return TCL_ERROR;			return TCL_OK;		}	}	return Mac::command(argc, argv);}/* ======================================================================   Debugging Routines   ====================================================================== */void MacTdma::trace_pkt(Packet *p) {	struct hdr_cmn *ch = HDR_CMN(p);	struct hdr_mac_tdma* dh = HDR_MAC_TDMA(p);	u_int16_t *t = (u_int16_t*) &dh->dh_fc;	fprintf(stderr, "\t[ %2x %2x %2x %2x ] %x %s %d\n",		*t, dh->dh_duration,		ETHER_ADDR(dh->dh_da), ETHER_ADDR(dh->dh_sa),		index_, packet_info.name(ch->ptype()), ch->size());}void MacTdma::dump(char *fname){	fprintf(stderr, "\n%s --- (INDEX: %d, time: %2.9f)\n", fname, 		index_, Scheduler::instance().clock());		fprintf(stderr, "\ttx_state_: %x, rx_state_: %x, idle: %d\n", 		tx_state_, rx_state_, is_idle());	fprintf(stderr, "\tpktTx_: %x, pktRx_: %x, callback: %x\n", 		(int) pktTx_, (int) pktRx_, (int) callback_);}/* ======================================================================   Packet Headers Routines   ====================================================================== */int MacTdma::hdr_dst(char* hdr, int dst ){	struct hdr_mac_tdma *dh = (struct hdr_mac_tdma*) hdr;	if(dst > -2)		STORE4BYTE(&dst, (dh->dh_da));	return ETHER_ADDR(dh->dh_da);}int MacTdma::hdr_src(char* hdr, int src ){	struct hdr_mac_tdma *dh = (struct hdr_mac_tdma*) hdr;	if(src > -2)		STORE4BYTE(&src, (dh->dh_sa));  	return ETHER_ADDR(dh->dh_sa);}int MacTdma::hdr_type(char* hdr, u_int16_t type) {	struct hdr_mac_tdma *dh = (struct hdr_mac_tdma*) hdr;	if(type)		STORE2BYTE(&type,(dh->dh_body));	return GET2BYTE(dh->dh_body);}/* Test if the channel is idle. */int MacTdma::is_idle() {	if(rx_state_ != MAC_IDLE)		return 0;	if(tx_state_ != MAC_IDLE)		return 0;	return 1;}/* Do the slot re-scheduling:   The idea of postphone the slot scheduling for one slot time may be useful.*/void MacTdma::re_schedule() {	static int slot_pointer = 0;	// Record the start time of the new schedule.	start_time_ = NOW;	/* Seperate slot_num_ and the node id: 	   we may have flexibility as node number changes.	*/	slot_num_ = slot_pointer++;	tdma_schedule_[slot_num_] = (char) index_;}/* To handle incoming packet. */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产网红主播福利一区二区| 欧美最新大片在线看| 国产精品成人网| 欧美在线观看视频一区二区三区| 亚洲一区二区三区三| 日韩视频永久免费| 国产福利精品导航| 热久久久久久久| 亚洲天堂免费看| 欧美不卡一区二区| 91麻豆精品国产91久久久更新时间| 国产黑丝在线一区二区三区| 亚洲一区免费视频| 国产欧美中文在线| 日韩三级精品电影久久久 | 国产精品综合二区| 亚洲成av人在线观看| 国产精品嫩草影院av蜜臀| 欧美成人精品3d动漫h| 9191久久久久久久久久久| 99久久免费精品高清特色大片| 毛片一区二区三区| 石原莉奈在线亚洲二区| 亚洲少妇中出一区| 中文一区二区完整视频在线观看 | 亚洲免费成人av| 精品乱人伦小说| 久久久久久久久久久黄色| 91精品国产欧美一区二区18| 欧美日韩国产高清一区二区 | 日韩一区二区影院| 6080午夜不卡| 欧美大片拔萝卜| 久久99精品一区二区三区| 99久久99久久精品国产片果冻| 精品美女一区二区| 国产成人av网站| 国产精品综合视频| 国产精品一区二区男女羞羞无遮挡 | 国产成人免费av在线| 精品综合久久久久久8888| 韩国精品久久久| 99精品视频一区二区三区| 9l国产精品久久久久麻豆| 91免费视频观看| 日韩欧美高清在线| 国产亚洲成aⅴ人片在线观看| 国产精品美女久久福利网站| 亚洲美女一区二区三区| 天天影视涩香欲综合网| 成人免费高清在线| 欧美三级韩国三级日本三斤| 欧美人xxxx| 亚洲精品一二三区| 国模冰冰炮一区二区| 日韩一级免费一区| 久久久久成人黄色影片| 一级中文字幕一区二区| 国产精品18久久久久久vr| 色菇凉天天综合网| 久久综合九色综合97婷婷| 亚洲妇女屁股眼交7| 丰满放荡岳乱妇91ww| 欧美一级xxx| 午夜日韩在线电影| 91年精品国产| 中文字幕一区三区| 国产成人免费视| 精品久久久久久久人人人人传媒| 亚洲国产一二三| 91视频91自| 国产精品国产精品国产专区不片| 久久精品国产成人一区二区三区 | 国产成人精品影视| 日韩欧美三级在线| 亚洲一区视频在线观看视频| 91在线精品秘密一区二区| 亚洲国产精品ⅴa在线观看| 久久99久久久久久久久久久| 欧美一区二区三区爱爱| 日本不卡免费在线视频| 制服丝袜成人动漫| 色婷婷av一区| 亚洲精品成人a在线观看| 成人国产精品免费观看动漫| 国产片一区二区三区| 99精品国产91久久久久久| 中文字幕免费不卡在线| 色综合一个色综合| 午夜影院久久久| 国产日韩影视精品| 成人动漫中文字幕| 亚洲自拍欧美精品| 5月丁香婷婷综合| 激情亚洲综合在线| 亚洲激情在线激情| 日韩欧美中文一区| 成人精品鲁一区一区二区| 亚洲一区在线电影| 亚洲精品在线免费观看视频| 国产.欧美.日韩| 一区二区视频在线看| 日韩免费电影一区| 在线区一区二视频| 国产在线播放一区| 性感美女久久精品| 国产一区二区成人久久免费影院| 久久久国产精华| 欧美色网一区二区| 成人免费黄色大片| 日韩在线卡一卡二| 亚洲欧洲成人自拍| 精品国产髙清在线看国产毛片 | 国产美女主播视频一区| 亚洲已满18点击进入久久| 国产日韩三级在线| 日韩精品一区二区三区视频在线观看 | 色美美综合视频| 欧美顶级少妇做爰| 91美女视频网站| 高清不卡在线观看av| 久久草av在线| 日本不卡的三区四区五区| 亚洲精品美国一| 欧美经典一区二区三区| 欧美r级电影在线观看| 亚洲永久免费视频| 亚洲国产精品影院| 午夜国产精品影院在线观看| 一区二区三区四区在线播放| 亚洲另类中文字| 自拍偷拍亚洲综合| 亚洲国产电影在线观看| 国产视频一区二区三区在线观看| 欧美v日韩v国产v| 国产精品少妇自拍| 国产精品网曝门| 一区二区日韩电影| 亚洲一区在线视频观看| 亚洲一区二区在线播放相泽 | av中文字幕一区| 91国产视频在线观看| 色婷婷精品大视频在线蜜桃视频| 欧美日韩一区中文字幕| 日韩一区二区三区电影在线观看 | 国产精品国产馆在线真实露脸| 成人欧美一区二区三区| 亚洲777理论| 北条麻妃一区二区三区| 91色.com| 久久久亚洲高清| 亚洲精品乱码久久久久久久久 | 色噜噜久久综合| 在线不卡a资源高清| 国产三级精品视频| 亚洲精品乱码久久久久久黑人| 免费精品视频在线| 大桥未久av一区二区三区中文| 在线国产电影不卡| 精品美女在线观看| 亚洲一区成人在线| 国产一区二区电影| 欧美一级午夜免费电影| 欧美激情一区二区三区全黄| www.欧美.com| 91.xcao| 天堂成人国产精品一区| av爱爱亚洲一区| 久久日一线二线三线suv| 日韩国产欧美在线视频| 91色视频在线| 国产精品久久久久7777按摩| 日本成人中文字幕| 在线成人av影院| 一级特黄大欧美久久久| 成人av免费在线观看| 欧美本精品男人aⅴ天堂| 日韩和欧美一区二区三区| 91激情在线视频| 欧美国产1区2区| 国产精品亚洲一区二区三区妖精 | 26uuu另类欧美| 久88久久88久久久| 26uuu亚洲| 懂色av噜噜一区二区三区av| 日本一区二区三区在线不卡| 国产精品自拍网站| 久久亚洲精品小早川怜子| 麻豆精品新av中文字幕| 精品国产91乱码一区二区三区 | 色综合久久中文字幕综合网| 亚洲欧美日韩国产一区二区三区| 成人免费视频一区| 亚洲欧美色一区| 欧美精品日韩综合在线| 国内偷窥港台综合视频在线播放| 国产婷婷色一区二区三区在线| 国产成人综合网站| 亚洲乱码中文字幕| 日韩欧美国产综合一区|