📄 pcf_support-2.1b8.patch
字号:
+// IBSS Parameter Set+struct mmff_IBSSParamSet {+ u_char elemID;//=MMFF_IBSS_PARAM_SET;+ u_char length;+ +};++struct mmff_TIM {+ u_char elemID;//=MMFF_TIM;+ u_char length;+ u_char DTIMcount;+ u_char DTIMperiod;+ u_char bitmapcontrol;//=0; // These are ignored in this+ u_char PVB[1]; // implementation... (PVB could be+ // up to 251 octets long IRL)+};++struct beacon_frame {+ struct frame_control bf_fc;+ u_int16_t bf_duration;+ u_char bf_da[ETHER_ADDR_LEN];+ u_char bf_sa[ETHER_ADDR_LEN];+ u_char bf_bssid[ETHER_ADDR_LEN];+ u_int16_t bf_scontrol;+ unsigned long long bf_timestamp;+ u_int16_t bf_binterval;+ u_int16_t bf_capability;+ struct mmff_SSID bf_ssid;+ struct mmff_rates bf_supported_rates;+ struct mmff_FHParamSet bf_fhparamset;+ struct mmff_DSParamSet bf_dsparamset;+ struct mmff_CFParamSet bf_cfparamset;+ struct mmff_IBSSParamSet bf_ibssparamset;+ struct mmff_TIM bf_tim;+ u_char bf_fcs[ETHER_FCS_LEN];+};+// wqos - changes by dugdale ends+ /* ====================================================================== Definitions ====================================================================== */@@ -220,6 +368,13 @@ u_int32_t FragmentationThreshold; u_int32_t MaxTransmitMSDULifetime; u_int32_t MaxReceiveLifetime;+ // wqos - Wed 04 Oct 00, 09:20 - dugdale+ u_int32_t dot11CFPollable;+ u_char dot11CFPPeriod;+ u_int16_t dot11CFPMaxDuration;+ u_int16_t dot11BeaconPeriod;+ u_char dot11DTIMPeriod;+ // wqos - changes by dugdale ends // ManufacturerID; // ProductID; @@ -249,6 +404,39 @@ }; +// wqos - Thu 05 Oct 00, 13:36 - almquist+/* ======================================================================+ PCF List and utilities+ ====================================================================== */+class PCFPollElement{+public:+ inline PCFPollElement(int macId, int cfPollField):+ macId_(macId), cfPollField_(cfPollField), dontPoll_(0), next_(NULL){}+ int macId_;+ int cfPollField_;+ int dontPoll_;+ PCFPollElement *next_;+};++class PCFPollList{+public:+ PCFPollList();+ ~PCFPollList();+ int getNextPollable();+ void insertNode(int macId, int cfPollable, int cfPollReq);+ int deleteNode(int macId);+ void initPoll();+ void markDontPoll(int macId);+ void clearDontPoll();+ int numPollable();+ +private:+ int nrOfNodes, onlyPollable;+ PCFPollElement *lastPollable, *lastPolled;+ PCFPollElement *firstElement, *lastElement;+};+// wqos - changes by almquist ends+ /* ====================================================================== The actual 802.11 MAC class. ====================================================================== */@@ -259,6 +447,9 @@ friend class NavTimer; friend class RxTimer; friend class TxTimer;+ // wqos - Tue 26 Sep 00, 16:43 - dugdale+ friend class BeaconTimer;+ // wqos - changes by dugdale ends public: Mac802_11(PHY_MIB* p, MAC_MIB *m); void recv(Packet *p, Handler *h);@@ -273,7 +464,11 @@ void recvHandler(void); void sendHandler(void); void txHandler(void);-+ // wqos - Tue 26 Sep 00, 16:43 - dugdale+ virtual void beaconHandler(void);+ virtual void pcfHandler(void);+ // wqos - changes by dugdale ends+ private: int command(int argc, const char*const* argv); @@ -285,7 +480,10 @@ int check_pktCTRL(); int check_pktRTS(); int check_pktTx();-+ // wqos - Tue 26 Sep 00, 17:04 - dugdale+ virtual int check_pktPCF();+ // wqos - changes by dugdale ends+ /* * Packet Transmission Functions. */@@ -296,6 +494,12 @@ void sendDATA(Packet *p); void RetransmitRTS(); void RetransmitDATA();+ // wqos - Tue 26 Sep 00, 17:04 - dugdale+ void send_beacon();+ void sendPoll();+ void sendCFEnd();+ void pcfSend(int type, int subtype);+ // wqos - changes by dugdale ends /* * Packet Reception Functions.@@ -304,7 +508,10 @@ void recvCTS(Packet *p); void recvACK(Packet *p); void recvDATA(Packet *p);-+ // wqos - Wed 29 Nov 00, 13:20 - dugdale+ void recvPoll(Packet *p);+ // wqos - changes by dugdale ends+ void capture(Packet *p); void collision(Packet *p); void discard(Packet *p, const char* why);@@ -313,6 +520,10 @@ inline int is_idle(void); + // wqos - Mon 09 Oct 00, 09:45 - dugdale+ void do_cfp(); // Function to do a CFP... Remove this?+ // wqos - changes by dugdale ends+ /* * Debugging Functions. */@@ -340,11 +551,28 @@ cw_ = phymib_->CWMax; } inline void rst_cw() { cw_ = phymib_->CWMin; }- inline u_int16_t usec(double t) {- u_int16_t us = (u_int16_t)ceil(t *= 1e6);+// wqos - Sat 18 Aug 01, 16:39 - dugdale+ inline u_int32_t usec(double t) {+ u_int32_t us = (u_int16_t)ceil(t *= 1e6); return us; }- inline void set_nav(u_int16_t us) {+// wqos - changes by dugdale ends++ // wqos - Thu 05 Oct 00, 10:42 - dugdale + // Converts seconds to TU+ inline u_int16_t tu(double t) {+ return (u_int16_t)ceil(t/0.001024);+ }+ + // Converts TU to seconds+ inline double tutos(int t) {+ return (double)(t*0.001024);+ }+ // wqos - changes by dugdale ends+ +// wqos - Sat 18 Aug 01, 16:39 - dugdale+ inline void set_nav(u_int32_t us) {+// wqos - changes by dugdale ends double now = Scheduler::instance().clock(); double t = us * 1e-6; @@ -368,7 +596,10 @@ NavTimer mhNav_; // NAV timer RxTimer mhRecv_; // incoming packets TxTimer mhSend_; // outgoing packets-+ // wqos - Tue 26 Sep 00, 16:46 - dugdale+ BeaconTimer mhBeacon_; // Beacon timer+ // wqos - changes by dugdale ends+ DeferTimer mhDefer_; // defer timer BackoffTimer mhBackoff_; // backoff timer @@ -383,6 +614,9 @@ Packet *pktRTS_; // outgoing RTS packet Packet *pktCTRL_; // outgoing non-RTS packet+ // wqos - Tue 10 Oct 00, 14:14 - dugdale + Packet *pktPCF_; // outgoing PCF stuff+ // wqos - changes by dugdale ends u_int32_t cw_; // Contention Window u_int32_t ssrc_; // STA Short Retry Count@@ -398,6 +632,16 @@ int min_frame_len_; NsObject* logtarget_;++ // wqos - Sat 30 Sep 00, 18:58 - dugdale+ // If this is non-zero then this is a PC+ int pc_;+ u_char dtimcount_, cfpcount_;+ int cfp_; // Non-zero during a CFP+ PCFPollList *pollList_;+ int pollsToSend_, btbs_;+ double lastPoll_;+ // wqos - changes by dugdale ends /* ============================================================ Duplicate Detection stateIndex: mac-timers.ccdiff -u mac-timers.cc:1.1 mac-timers.cc:1.1.1.1.6.3--- mac-timers.cc:1.1 Tue Aug 14 11:37:45 2001+++ mac-timers.cc Tue Aug 21 01:14:36 2001@@ -32,6 +32,32 @@ * SUCH DAMAGE. */ /* Ported from CMU/Monarch's code, nov'98 -Padma.*/+/*+ * Code contained within lines such as the below+ *+ // wqos - <date> - dugdale+ // wqos - changes by dugdale ends+ *+ * or+ *+ // wqos - <date> - almquist+ // wqos - changes by almquist ends+ *+ * have been changed or added to implement the PCF mode of IEEE 802.11 and is+ * Copyright (c) 2001 Anders Lindgren and Andreas Almquist.+ *+ * 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 above disclaimer.+ * 2. Redistributions in binary form must reproduce the above copyright+ * notice, this list of conditions and the above disclaimer in the+ * documentation and/or other materials provided with the distribution.+ *+ * The disclaimer above apply to the modifications made to the source code+ * by Anders Lindgren and Andreas Almquist as well as to the rest of the code.+ */ #include <delay.h>@@ -181,6 +207,21 @@ mac->sendHandler(); } +// wqos - Tue 26 Sep 00, 16:42 - dugdale+/* ======================================================================+ Beacon Timer+ ====================================================================== */+void +BeaconTimer::handle(Event *)+{ + busy_ = 0;+ paused_ = 0;+ stime = 0.0;+ rtime = 0.0;++ mac->beaconHandler();+}+// wqos - changes by dugdale ends /* ====================================================================== Interface TimerIndex: mac-timers.hdiff -u mac-timers.h:1.1 mac-timers.h:1.1.1.1.6.3--- mac-timers.h:1.1 Tue Aug 14 11:37:45 2001+++ mac-timers.h Tue Aug 21 01:14:36 2001@@ -32,6 +32,32 @@ * SUCH DAMAGE. */ /* Ported from CMU/Monarch's code, nov'98 -Padma.*/+/*+ * Code contained within lines such as the below+ *+ // wqos - <date> - dugdale+ // wqos - changes by dugdale ends+ *+ * or+ *+ // wqos - <date> - almquist+ // wqos - changes by almquist ends+ *+ * have been changed or added to implement the PCF mode of IEEE 802.11 and is+ * Copyright (c) 2001 Anders Lindgren and Andreas Almquist.+ *+ * 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 above disclaimer.+ * 2. Redistributions in binary form must reproduce the above copyright+ * notice, this list of conditions and the above disclaimer in the+ * documentation and/or other materials provided with the distribution.+ *+ * The disclaimer above apply to the modifications made to the source code+ * by Anders Lindgren and Andreas Almquist as well as to the rest of the code.+ */ #ifndef __mac_timers_h__ #define __mac_timers_h__@@ -118,6 +144,15 @@ void handle(Event *e); };++// wqos - Tue 26 Sep 00, 15:55 - dugdale+class BeaconTimer : public MacTimer {+public:+ BeaconTimer(Mac802_11 *m) : MacTimer(m) {}++ void handle(Event *e);+};+// wqos - changes by dugdale ends #endif /* __mac_timers_h__ */ Index: mac.hdiff -u mac.h:1.1 mac.h:1.1.1.1.6.3--- mac.h:1.1 Tue Aug 14 11:37:45 2001+++ mac.h Tue Aug 21 01:14:36 2001@@ -35,6 +35,32 @@ * * @(#) $Header$ (UCB) */+/*+ * Code contained within lines such as the below+ *+ // wqos - <date> - dugdale+ // wqos - changes by dugdale ends+ *+ * or+ *+ // wqos - <date> - almquist+ // wqos - changes by almquist ends+ *+ * have been changed or added to implement the PCF mode of IEEE 802.11 and is+ * Copyright (c) 2001 Anders Lindgren and Andreas Almquist.+ *+ * 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 above disclaimer.+ * 2. Redistributions in binary form must reproduce the above copyright+ * notice, this list of conditions and the above disclaimer in the+ * documentation and/or other materials provided with the distribution.+ *+ * The disclaimer above apply to the modifications made to the source code+ * by Anders Lindgren and Andreas Almquist as well as to the rest of the code.+ */ #ifndef ns_mac_h #define ns_mac_h@@ -85,7 +111,10 @@ MAC_RTS = 0x0200, MAC_CTS = 0x0400, MAC_ACK = 0x0800,- MAC_COLL = 0x1000+ MAC_COLL = 0x1000,+ // wqos - Thu 26 Oct 00, 16:13 - dugdale+ MAC_BEACONING = 0x2000 // Beaconing...+ // wqos - changes by dugdale ends }; enum MacFrameType {@@ -211,7 +240,10 @@ dh->hdr_type_ = type; return dh->hdr_type(); }-+ // wqos - Fri 13 Oct 00, 12:50 - dugdale+ inline void setll(LL *ll) {ll_ = ll;}+ // wqos - changes by dugdale ends+ private: void mac_log(Packet *p) { logtarget_->recv(p, (Handler*) 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -