⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mac-802_11.h

📁 在网络仿真模拟工具下实现MAC层802.11DCF协议
💻 H
📖 第 1 页 / 共 2 页
字号:
	//		GroupAddresses;	u_int32_t	RTSThreshold;	u_int32_t	ShortRetryLimit;	u_int32_t	LongRetryLimit;// change wrt Mike's code//	u_int32_t	FragmentationThreshold;//	u_int32_t	MaxTransmitMSDULifetime;//	u_int32_t	MaxReceiveLifetime;	//		ManufacturerID;	//		ProductID;// change wrt Mike's codepublic://	u_int32_t	TransmittedFragmentCount;//	u_int32_t	MulticastTransmittedFrameCount;	u_int32_t	FailedCount;	//	u_int32_t	RetryCount;//	u_int32_t	MultipleRetryCount;//	u_int32_t	FrameDuplicateCount;//	u_int32_t	RTSSuccessCount;	u_int32_t	RTSFailureCount;	u_int32_t	ACKFailureCount;//	u_int32_t	ReceivedFragmentCount;//	u_int32_t	MulticastReceivedFrameCount;//	u_int32_t	FCSErrorCount; public:       inline u_int32_t getRTSThreshold() { return(RTSThreshold);}       inline u_int32_t getShortRetryLimit() { return(ShortRetryLimit);}       inline u_int32_t getLongRetryLimit() { return(LongRetryLimit);}};/* ======================================================================   The following destination class is used for duplicate detection.   ====================================================================== */class Host {public:	LIST_ENTRY(Host) link;	u_int32_t	index;	u_int32_t	seqno;};/* ======================================================================   The actual 802.11 MAC class.   ====================================================================== */class Mac802_11 : public Mac {	friend class DeferTimer;// change wrt Mike's code	friend class BeaconTimer;	friend class BackoffTimer;	friend class IFTimer;	friend class NavTimer;	friend class RxTimer;	friend class TxTimer;public:	// change wrt Mike's code	Mac802_11();	//	Mac802_11(PHY_MIB* p, MAC_MIB *m);	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);		// change wrt Mike's code	inline int bss_id() { return bss_id_; }		// Added by Sushmita to support event tracing        void trace_event(char *, Packet *);        EventTrace *et_;protected:	void	backoffHandler(void);	void	deferHandler(void);// change wrt Mike's code		void    beaconHandler(void);	void	navHandler(void);	void	recvHandler(void);	void	sendHandler(void);	void	txHandler(void);private:	int		command(int argc, const char*const* argv);	/*	 * Called by the timers.	 */	void		recv_timer(void);	void		send_timer(void);	int		check_pktCTRL();	int		check_pktRTS();	int		check_pktTx();	/*	 * Packet Transmission Functions.	 */	void	send(Packet *p, Handler *h);	void 	sendRTS(int dst);	void	sendCTS(int dst, double duration);	void	sendACK(int dst);	void	sendDATA(Packet *p);	void	RetransmitRTS();	void	RetransmitDATA();	/*	 * Packet Reception Functions.	 */	void	recvRTS(Packet *p);	void	recvCTS(Packet *p);	void	recvACK(Packet *p);	void	recvDATA(Packet *p);	void		capture(Packet *p);	void		collision(Packet *p);	void		discard(Packet *p, const char* why);	void		rx_resume(void);	void		tx_resume(void);	inline int	is_idle(void);	/*	 * Debugging Functions.	 */	void		trace_pkt(Packet *p);	void		dump(char* fname);	inline int initialized() {		// change wrt Mike's code	//	return (phymib_ && macmib_ && cache_ && logtarget_ && 	//		Mac::initialized());	return (cache_ && logtarget_                        && Mac::initialized());	}	// change wrt Mike's code	/*	void mac_log(Packet *p) {		logtarget_->recv(p, (Handler*) 0);	}*/	inline void mac_log(Packet *p) {                logtarget_->recv(p, (Handler*) 0);        }	double txtime(Packet *p);	double txtime(double psz, double drt);	double txtime(int bytes) { /* clobber inherited txtime() */ abort(); }// change wrt Mike's code	inline void transmit(Packet *p, double timeout);       inline void checkBackoffTimer(void);       inline void postBackoff(int pri);       inline void setRxState(MacState newState);       inline void setTxState(MacState newState);	inline void inc_cw() {		cw_ = (cw_ << 1) + 1;	// change wrt Mike's code	//	if(cw_ > phymib_->CWMax)	//		cw_ = phymib_->CWMax;	if(cw_ > phymib_.getCWMax())                       cw_ = phymib_.getCWMax();	}// change wrt Mike's code//	inline void rst_cw() { cw_ = phymib_->CWMin; }	inline void rst_cw() { cw_ = phymib_.getCWMin(); }	inline double sec(double t) { return(t *= 1.0e-6); }	inline u_int16_t usec(double t) {		u_int16_t us = (u_int16_t)floor((t *= 1e6) + 0.5);		/* u_int16_t us = (u_int16_t)rint(t *= 1e6); */		return us;	}	inline void set_nav(u_int16_t us) {		double now = Scheduler::instance().clock();		double t = us * 1e-6;		if((now + t) > nav_) {			nav_ = now + t;			if(mhNav_.busy())				mhNav_.stop();			mhNav_.start(t);		}	}protected:// change wrt Mike's code/*	PHY_MIB		*phymib_;	MAC_MIB		*macmib_;*/	PHY_MIB         phymib_;        MAC_MIB         macmib_;       /* the macaddr of my AP in BSS mode; for IBSS mode        * this is set to a reserved value IBSS_ID - the        * MAC_BROADCAST reserved value can be used for this        * purpose        */       int     bss_id_;       enum    {IBSS_ID=MAC_BROADCAST};private:	double		basicRate_; 	double		dataRate_;		/*	 * Mac Timers	 */	IFTimer		mhIF_;		// interface timer	NavTimer	mhNav_;		// NAV timer	RxTimer		mhRecv_;		// incoming packets	TxTimer		mhSend_;		// outgoing packets	DeferTimer	mhDefer_;	// defer timer	BackoffTimer	mhBackoff_;	// backoff timer// change wrt Mike's code	 BeaconTimer     mhBeacon_;      // to generate beacons	/* ============================================================	   Internal MAC State	   ============================================================ */	double		nav_;		// Network Allocation Vector	MacState	rx_state_;	// incoming state (MAC_RECV or MAC_IDLE)	MacState	tx_state_;	// outgoint state	int		tx_active_;	// transmitter is ACTIVE// change wrt Mike's code	Packet          *eotPacket_;    // copy for eot callback	Packet		*pktRTS_;	// outgoing RTS packet	Packet		*pktCTRL_;	// outgoing non-RTS packet	u_int32_t	cw_;		// Contention Window	u_int32_t	ssrc_;		// STA Short Retry Count	u_int32_t	slrc_;		// STA Long Retry Count// change wrt Mike's code //	double		sifs_;		// Short Interface Space//	double		pifs_;		// PCF Interframe Space	double		difs_;		// DCF Interframe Space	double		eifs_;		// Extended Interframe Space//	double		tx_sifs_;//	double		tx_pifs_;//	double		tx_difs_;	int		min_frame_len_;	NsObject*	logtarget_;// change wrt Mike's code	NsObject*       EOTtarget_;     // given a copy of packet at TX end	/* ============================================================	   Duplicate Detection state	   ============================================================ */	u_int16_t	sta_seqno_;	// next seqno that I'll use	int		cache_node_count_;	Host		*cache_;};#endif /* __mac_80211_h__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -