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

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

?? mac-gprs.h

?? 用C++編寫的GPRS協議棧源代碼
?? H
字號:
/* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- *//* By Richa Jain, * Indian Institute of Technology, Bombay. * June, 2001.*/ /* Copyright (c) 2001 Indian Insitute of Technology, Bombay.   * 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 and binary code must contain * the above copyright notice, this list of conditions and the following  * disclaimer. *  * 2. All advertising materials mentioning features or use of this software * must display the following acknowledgement:  * This product includes software developed at Indian Insitute of * Technology, Bombay.  * * 3. The name of the Institute may not be used to endorse or promote  * products derived from this software without specific prior written  * permission. * INDIAN INSTITUTE OF TECHNOLOGY, BOMBAY, MAKES NO REPRESENTATIONS  * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE  * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE.  The software  * is provided "as is" without express or implied warranty of any kind.*//* A special slotted Aloha based MAC for GPRS/GSM  */ #ifndef ns_mac_gprs_h#define ns_mac_gprs_h// #define DEBUG//#include <debug.h>#include "marshall.h"#include <delay.h>#include <connector.h>#include <packet.h>#include <random.h>#include <arp.h>#include <ll.h>#include <mac.h>// some macros for address conversion#define GET_ETHER_TYPE(x)		GET2BYTE((x))#define SET_ETHER_TYPE(x,y)    {u_int16_t t = (y); STORE2BYTE(x,&t);}/* We are still using these specs for phy layer---same as 802.11. *//* * IEEE 802.11 Spec, section 15.3.2 *	- default values for the DSSS PHY MIB */#define DSSS_CWMin			31#define DSSS_CWMax			1023#define DSSS_SlotTime			0.000020	// 20us#define	DSSS_CCATime			0.000015	// 15us#define DSSS_RxTxTurnaroundTime		0.000005	// 5us#define DSSS_SIFSTime			0.000010	// 10us#define DSSS_PreambleLength		144		// 144 bits#define DSSS_PLCPHeaderLength		48		// 48 bitsclass PHY_MIB {public:	u_int32_t	CWMin;	u_int32_t	CWMax;	double		SlotTime;	double		CCATime;	double		RxTxTurnaroundTime;	double		SIFSTime;	u_int32_t	PreambleLength;	u_int32_t	PLCPHeaderLength;};/* ======================================================================   Frame Formats   ====================================================================== */#define MAX_NUM_FREQ 30  //maximum number of frequencies permissiblein the cell#define MAX_NUM_MS 64    //maximum number of Mobiles permissible in the cell#define SLOTS_PER_FRAME 8 // number of slots in evry TDMA frame #define	MAC_ProtocolVersion	0x00// Packets can be of GPRS Mac type - Data or Control// with subtypes - data, resource request, reply or resource release.#define MAC_Type_Data		0x02#define MAC_Type_Control	0x03#define MAC_Subtype_data	0x00#define MAC_Subtype_res_request	0x01  // resource request#define MAC_Subtype_res_reply	0x02  // resource reply#define MAC_Subtype_tx_end		0x03  // resource release#define NONE 0// channel states for the (Packet) Random Acess channel. #define IDLE 0#define BUSY 1#define COLL 2// To indicate whether the radio's ON or OFF#define ON                       1#define OFF                      0// Quoted from MAC-802.11. #define DATA_DURATION           5// We use the same frame structure as 802.11 struct frame_control {	u_char		fc_subtype		: 4;	u_char		fc_type			: 2;	u_char		fc_protocol_version	: 2;	u_char		fc_order		: 1;	u_char		fc_wep			: 1;	u_char		fc_more_data		: 1;	u_char		fc_pwr_mgt		: 1;	u_char		fc_retry		: 1;	u_char		fc_more_frag		: 1;	u_char		fc_from_ds		: 1;	u_char		fc_to_ds		: 1;};// the GPRS headerstruct hdr_mac_gprs {	struct frame_control	dh_fc;	u_int16_t		dh_duration;	u_char			dh_da[ETHER_ADDR_LEN];	u_char			dh_sa[ETHER_ADDR_LEN];	u_char			dh_bssid[ETHER_ADDR_LEN];	u_char			dh_body[0]; // XXX Non-ANSI	int             dh_freq; // freq/slot information to be sent down 	int             dh_slot; // in the resource reply message - rj		int             dh_wait; // to resume tx at BS after slot_allot - rj							 //dh_wait =1 => dont tx now, wait .....	};// in GPRS, the mac/rlc hdr is 8 bits.#define ETHER_HDR_LEN 1struct data_at_bs{		//i th element is the hier address of node with index_=i		int hier_addr_[MAX_NUM_MS] ;			//these tables store the mac index_ of the node that has been    		// alloted freq i, slot j		int up_table[MAX_NUM_FREQ][SLOTS_PER_FRAME];	 	int down_table[MAX_NUM_FREQ][SLOTS_PER_FRAME];   };/* Timers */class MacGprs;class MacGprsTimer : public Handler {public:	MacGprsTimer(MacGprs* m, double s = 0) : mac(m) {		busy_ = paused_ = 0; stime = rtime = 0.0; slottime_ = s;	}	virtual void handle(Event *e) = 0;	virtual void start(Packet *p, double time);	virtual void stop(Packet *p);	virtual void pause(void) { assert(0); }	virtual void resume(void) { assert(0); }	inline int busy(void) { return busy_; }	inline int paused(void) { return paused_; }	inline double slottime(void) { return slottime_; }	inline double expire(void) {		return ((stime + rtime) - Scheduler::instance().clock());	}protected:	MacGprs	*mac;	int	busy_;	int	paused_;	Event intr;	double stime;	// start time	double rtime;	// remaining time	double	slottime_;};// Timer to release resources (ie free a slot)class SlotReleaseTimer : public MacGprsTimer {	public: 		SlotReleaseTimer(MacGprs *m) : MacGprsTimer(m) {} 	 	void start(double time); // - over written to get a simple timer.		void stop(void);		void handle(Event *e);};		 //timer to wait for res_replyclass WaitTimer : public MacGprsTimer {	public: 		WaitTimer(MacGprs *m) : MacGprsTimer(m) {} 	 	void start(double time); // - over written to get a simple timer.		void stop(void);		void handle(Event *e);};		 // Backoff timer for random access -class BackoffGprsTimer : public MacGprsTimer {	public: 		BackoffGprsTimer(MacGprs *m) : MacGprsTimer(m) {} 	 	void start(double time); // - over written to get a simple timer.		void stop(void);		void handle(Event *e);};		 // Timers to time the Upslots and Downslots.class DownSlotGprsTimer : public MacGprsTimer {public:	DownSlotGprsTimer(MacGprs *m) : MacGprsTimer(m) {}	void handle(Event *e);};class UpSlotGprsTimer : public MacGprsTimer {public:	UpSlotGprsTimer(MacGprs *m) : MacGprsTimer(m) {}	void handle(Event *e);};/* Timers to control packet sending and receiving time. */class RxPktGprsTimer : public MacGprsTimer {public:	RxPktGprsTimer(MacGprs *m) : MacGprsTimer(m) {}	void	handle(Event *e);};class TxPktGprsTimer : public MacGprsTimer {public:	TxPktGprsTimer(MacGprs *m) : MacGprsTimer(m) {}	void	handle(Event *e);};/* GPRS Mac layer. */class MacGprs : public Mac {  friend class DownSlotGprsTimer;  friend class UpSlotGprsTimer;  friend class TxPktGprsTimer;  friend class RxPktGprsTimer;  friend class SlotReleaseTimer;  friend class BackoffGprsTimer;  friend class WaitTimer;	  public:  MacGprs(PHY_MIB* p);  void recv(Packet *p, Handler *h);    inline int hdr_dst(char* hdr, int dst = -2);  inline int hdr_src(char* hdr, int src = -2);  inline int hdr_type(char* hdr, u_int16_t type = 0);    // Timer handlers   void downslotHandler(Event *e);  void upslotHandler(Event *e);  void recvHandler(Event *e);  void sendHandler(Event *e);  void releaseHandler(void);  void backoffHandler(void);  void waitHandler(void);   protected:  PHY_MIB		*phymib_;    Packet * p_temp; //temporary storage for a pkt while waiting for a res_reply  Packet * temp_reply; // Storage in case two res_replies are  					   //generated at the BS in a particular TDMA frame  // user defined variables					     static int slot_packet_len_; // max pkt size that can be txd in one slot  static int max_num_ms_;      // user defined max num of MS in cell  static int max_num_freq_;    // num of frequencies to be permitted inthe cell  static int gprs_slots_per_frame_ ; // how many slots of the 8 per frame  									// are to be reserved for gprs.  static int rlc_error_; // whether or not to include the rlc error model  static int error_rate_;// the "error rate"  static int verbose_;   // to include a verbose output ..      // for the slot level error model  static int drop_gap_;  static int drop_counter_;  static int next_drop_;    static int tx_rate;     int gprs_; //to indicate whether the mobile is a GPRS MS or GSM   private:  int command(int argc, const char*const* argv);    void ms_recv(Packet *p, Handler *h);  void bs_recv(Packet *p, Handler *h);    void slot_allot(int ms_, int &freq, int &slot);  void radioSwitch(int i);  // Packet Transmission Functions.  void rx_from_phy(Packet* p);   void rx_from_ll(Packet* p); // called when a pkt is to be acceptedfrom the IFQ  void fwd_DATA_to_LL(Packet *p); //fwding data to the upper layer: LL/RLC  void tx_onto_PHY(Packet *p );    // to create the message packets.  void send_res_reply (int dst, int freq, int slot);  void send_res_request ();  void send_let_go();    // to calculate tx time for a packet  double DATA_Time(int len) ;     double TX_Time(Packet *p) ;    /* Debugging Functions.*/  void trace_pkt(Packet *p);  void dump(char* fname);  void mac_log(Packet *p) {    logtarget_->recv(p, (Handler*) 0);  }    // Other fncs  inline u_int16_t usec(double t) {    u_int16_t us = (u_int16_t)ceil(t *= 1e6);    return us;  };// variables:  static double start_time_; // The start time for whole TDMA scheduling.   static double slot_time_;  // The duration of each TDMA slot  static int active_node_ ; //num of active nodes with this BS(including BS)   // These data structures shud ideally reside at the BS. But since  // there is no distinct BaseStation created at the C++ level in ns,   // we create them as static structures in the MAC itself. This  // causes them to be unique for each instance of the MAC -  // equivalent to each cell. And hence we have to limit our  // simulations to a single cell. If a separate BS were created at  // the C++ level, these could be shifted there and configured for  // a multi-cell layout.      //static Packet * rxQ[max_num_freq_][SLOTS_PER_FRAME];  //static Packet * txQ[max_num_freq_][SLOTS_PER_FRAME];  static Packet * rxQ[][];  static Packet * txQ[][];  static struct data_at_bs vlr_; //equivalent to the VLR at the BS    // for the Random Access Channel - PRACH - uplink freq 0, slot 0  static int chan0_0;    // a variable identifying the PRACH  static int coll_count; // num of MS transmitting on the PRACH	    // indicates whether the radio is active or not. Each MS has a seperate radio  int radio_active_;     //shudnt these be static- since for 1 BS(ie cell) only.??  int down_slot_;    int up_slot_;   int first_round_;    //indicates that the MS has sent a request and is waiting for a reply.  int wait_for_res;     double slot_release_time_;    //shud be only for MS ??  int tx_chan[SLOTS_PER_FRAME];  int rx_chan[SLOTS_PER_FRAME];  Packet * pktTx[SLOTS_PER_FRAME];   Packet * pktRx[SLOTS_PER_FRAME];      // Timers   DownSlotGprsTimer mhDownSlot_;  UpSlotGprsTimer mhUpSlot_;  TxPktGprsTimer mhTxPkt_;  RxPktGprsTimer mhRxPkt_;  SlotReleaseTimer mhRel_;  BackoffGprsTimer mhBackoff_;	   WaitTimer mhwait_;    NsObject*	logtarget_;};//for the static variables: - shifted to mac-gprs.cc/*Packet * MacGprs::rxQ[MAX_NUM_FREQ][SLOTS_PER_FRAME]={NULL};Packet * MacGprs::txQ[MAX_NUM_FREQ][SLOTS_PER_FRAME]={NULL}; struct data_at_bs MacGprs::vlr_ = {0};int MacGprs:: slot_packet_len_ = {0};int MacGprs:: tx_rate = {0};int MacGprs:: max_num_ms_ = {0};int MacGprs:: max_num_freq_ = {0};int MacGprs:: gprs_slots_per_frame_ = {0};double MacGprs::slot_time_ = 0;double MacGprs::start_time_ = 0;int MacGprs::chan0_0 = {0};int MacGprs::coll_count = {0}; int MacGprs::active_node_ = {0};*/#endif /* __mac_gprs_h__ */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区欧美二区| 国产婷婷精品av在线| 成人国产电影网| 免费人成在线不卡| 男男成人高潮片免费网站| 粉嫩一区二区三区在线看| 成人av免费在线观看| 制服丝袜av成人在线看| 777午夜精品视频在线播放| 欧美精彩视频一区二区三区| 国产免费观看久久| 青青草视频一区| 色婷婷亚洲婷婷| 在线观看视频91| 欧美男人的天堂一二区| 日韩一区二区三区四区| 精品捆绑美女sm三区| 久久精品一区二区三区不卡 | 不卡电影一区二区三区| 精品日韩在线一区| 日韩一区欧美二区| 国产一区欧美一区| 日韩一区二区三区三四区视频在线观看| 中文字幕日本不卡| 石原莉奈一区二区三区在线观看| 一本色道久久加勒比精品| 国产精品嫩草影院av蜜臀| 一区二区三区久久久| 日韩国产欧美在线播放| 粉嫩一区二区三区在线看| 久久久久久一二三区| 亚洲精品一二三| 韩国v欧美v日本v亚洲v| 色噜噜狠狠色综合欧洲selulu| 91精品国模一区二区三区| 亚洲一区av在线| 高清不卡一二三区| 国产精品女主播av| zzijzzij亚洲日本少妇熟睡| 欧美日韩国产精品成人| 午夜视频一区二区| 不卡在线观看av| 1024成人网| 91国偷自产一区二区三区成为亚洲经典| 成人欧美一区二区三区| 91亚洲永久精品| 久久久久久夜精品精品免费| 国产99久久久国产精品潘金网站| 久久精品视频免费| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 青青草成人在线观看| 欧美一二三四区在线| 极品少妇xxxx偷拍精品少妇| 91激情五月电影| 午夜久久久久久电影| 日韩欧美色综合| 亚洲成av人片观看| 色哟哟一区二区三区| 亚洲一区国产视频| 日韩精品一区二区在线| 国产成人精品免费网站| 精品久久五月天| 成人av影院在线| 午夜欧美一区二区三区在线播放| 日韩视频在线观看一区二区| 国产精品一区二区无线| 欧美大片一区二区| 91在线观看视频| 日本不卡中文字幕| 中文字幕一区二区三区不卡| 欧美日韩国产电影| 大尺度一区二区| 国产视频一区二区三区在线观看| 91视频精品在这里| 裸体在线国模精品偷拍| 欧美一区二区视频在线观看2022| 亚洲成av人影院| 亚洲欧美另类图片小说| 不卡电影免费在线播放一区| 亚洲福利国产精品| 欧美理论在线播放| 日韩精品三区四区| 国产精品国模大尺度视频| 丁香天五香天堂综合| 亚洲成a人片在线不卡一二三区| 久久精品亚洲精品国产欧美| 欧美日韩一区三区四区| 日韩电影在线一区二区| 成人免费一区二区三区视频| 欧美电视剧在线看免费| 欧美在线观看一区| 99久久777色| 国产乱子轮精品视频| 日欧美一区二区| 亚洲欧美日韩国产一区二区三区| 久久先锋资源网| www.日韩精品| 国产精品一区二区不卡| 美女性感视频久久| 日韩电影在线免费看| 亚洲在线视频免费观看| 欧美高清在线视频| 欧美日韩综合在线免费观看| www.亚洲免费av| 国产伦精品一区二区三区视频青涩 | 日本欧美肥老太交大片| 亚洲影院理伦片| 亚洲欧美偷拍三级| 1024国产精品| 亚洲天堂免费看| 欧美一区午夜精品| 欧美日韩你懂得| 欧洲av在线精品| 欧美亚洲综合一区| 国产精品一区免费视频| 韩国毛片一区二区三区| 老司机一区二区| 亚洲欧美日韩在线| 中文字幕一区二区三区在线观看 | 久久日韩粉嫩一区二区三区| 欧美一区二区二区| 日韩欧美综合一区| 欧美成人vps| 久久色.com| 国产精品全国免费观看高清| 国产精品天美传媒| 亚洲欧美日韩国产综合| 一区二区三区欧美日韩| 亚洲伊人色欲综合网| 石原莉奈在线亚洲三区| 美脚の诱脚舐め脚责91| 国产麻豆精品在线| 风间由美中文字幕在线看视频国产欧美| 国产激情精品久久久第一区二区| 国产盗摄一区二区三区| 91欧美激情一区二区三区成人| 色婷婷久久一区二区三区麻豆| 欧美日韩国产小视频| 日韩精品一区二区三区在线观看 | 亚洲国产精品av| 伊人性伊人情综合网| 午夜久久久久久久久久一区二区| 久久99精品久久久久| 成人免费毛片app| 欧美偷拍一区二区| 欧美成人午夜电影| 亚洲日本在线视频观看| 亚洲成人7777| 国产一区二区三区精品欧美日韩一区二区三区 | 日本中文字幕一区| 国产精品一二三| 在线观看日产精品| 欧美成人官网二区| 亚洲日韩欧美一区二区在线| 秋霞成人午夜伦在线观看| 国产精品羞羞答答xxdd| 欧美亚洲丝袜传媒另类| 久久婷婷国产综合精品青草| 亚洲一区二区视频在线| 韩国三级电影一区二区| 欧美无乱码久久久免费午夜一区| 久久久国产精华| 午夜日韩在线电影| 97国产精品videossex| 日韩欧美国产综合| 亚洲码国产岛国毛片在线| 精品亚洲国内自在自线福利| 日本韩国一区二区| 国产日韩精品一区二区三区在线| 亚洲高清在线视频| voyeur盗摄精品| 日韩欧美国产麻豆| 亚洲国产精品久久不卡毛片| 成熟亚洲日本毛茸茸凸凹| 日韩欧美久久一区| 亚洲国产aⅴ成人精品无吗| 大胆欧美人体老妇| 精品成人私密视频| 中文一区二区在线观看| 婷婷久久综合九色国产成人| 94-欧美-setu| 国产日韩欧美一区二区三区乱码| 热久久国产精品| 欧美影院午夜播放| 亚洲色图视频网| 国产成人福利片| 精品国产91久久久久久久妲己| 婷婷久久综合九色综合绿巨人| 日本韩国欧美一区| 日韩伦理电影网| a4yy欧美一区二区三区| 国产欧美日韩三区| 国产成人亚洲精品青草天美| 精品久久久久久久久久久久久久久| 午夜私人影院久久久久| 在线看国产一区| 亚洲与欧洲av电影| 欧美在线视频日韩| 亚洲成人自拍偷拍| 欧美日韩精品一区二区三区四区|