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

📄 rlc.tex

📁 用C++编写的GPRS协议栈源代码
💻 TEX
字号:
\section{Radio Link  Control (RLC)}A new layer called  Radio Link Control is added to the wireless node,between the LL and IFQ\footnotemark[2]. This required changes in {\it ~ns}/tcl/lib/ns-mobilenode.tcl\footnotetext[2] { This was implemented by  Sandeep Kumar, KopparapuSuman and Richa Jain at Indian Institute of Technology, Bombay. June2001} The main features included are fragmentation and assembly, along with RLCretransmissions. The retransmit mechanism is a simplified form of SelectiveRetransmits. The fragmentation-reassembly and acknowledgements may beconfigured ON or OFF by the user and the RLC fragment size can be set. A newheader, the RLC header is introduced. Though this was written as a part of GPRS stack implementation, it can beused independently with any other stack with minor modifications.In case an RLC fragment is dropped by the MAC, in acknowledged mode, aduplicate acknowledgment for the last correctly received RLC fragment issentback to the sender, which then retransmits the expected RLC fragment.In unacknowledged mode, if an RLC fragment is missing, the RLC does notpass  any of the fragments to the LL. The LL in this case, would re-send theLL  fragment (if in acknowledged mode) or will let the higher layers (ieTCP) handle it.In acked mode, currently only one MS can be supported.                  In GPRS. the actual size of an RLC  packet's payload depends on the codingscheme used. We take the average GPRS RLC  payload size to be 200 bytes. InGPRS these 200 bytes are transmitted over four slots in  consecutive TDMAframes,amounting to 50 bytes per slot. To model this, the RLC fragments  areconfigured to be of 50 bytes and thus 50 bytes are transmitted in each TDMAslot.\subsection {RLC  class in C++}The RLC class derives from the LinkDelay class.  The code can be found in{\it ~ns}/ll-timers.\{cc,h\} and {\it ~ns}/ll.\{cc,h\}. The functions and variables of theclass are shown below\begin{verbatim}class RLC : public LinkDelay {     friend class rlcTxTimer;           //rtx timer for data pkts     friend class rlcackTimer;          //rtx timer for rlc ackspublic:      :     //new funcs     virtual void recvACK(Packet* p);    //recv ack pkts     virtual void recvDATA(Packet* p);   //recv data pkts     virtual void sendUpDATA(Packet* p); //reassemble and send data up     virtual void enqueDATA(Packet* p);  //frag and enque data     virtual void sendDownDATA(void);    //send data down     virtual void sendACK(Packet* p);    //send rlc ack      :     virtual void RetransmitDATA(void);  //rtx data on timeout     virtual void RetransmitACK(void);   //rtx rlc on timeout     virtual void sendDownDATAonACK(void);  //send data when recv ack      :	  protected:     int command(int argc, const char*const* argv);     static int rlcverbose_;       int seqno_;              // rlc sequence number     int ackno_;              // ACK received so far     int rackno_;             // seq no of left most pkt     int macDA_;              // destination MAC address     int window_;             //window size for sack     Queue* ifq_;             // interface queue     PacketQueue* buf_;       // queue to store frag pkts to sendDown     PacketQueue* Txbuf_;     // Tx buffer     PacketQueue* Rxbuf_;     // Rx buffer       :	 int acked_;              //RLC layer acked?     int rlcfraged_;          //RLC layer PDU fragmented?     int rlcfragsz_;          //RLC layer frag size     int datacounter;         //no of rtx for data     int ackcounter;          //no of rtx for rlc ack     Packet *pktTx_;          //store rtx data     Packet *pktRx_;          //store rtx  rlc ack     int inseq_;              //flag for pkts in seq in unack mode     int unackseqno_;         //seqno when in unack mode     int numdups;             //no of dupacks for sack      :	}\end{verbatim}\subsection{Parameters}    The following parameters can be set and the default values are setin {\it ~ns}/tcl/lib/ns-default.tcl\begin{verbatim}RLC set mindelay_    50usRLC set delay_       25usRLC set bandwidth_   0    ;# not usedRLC set debug_       falseRLC set macDA_       0RLC set acked_       1    ;# if 1 acked..0  non-ackedRLC set rlcfraged_   1    ;# if 1-frag.....0-nofragRLC set rlcfragsz_   45   ;# rlc frag sizeRLC set rlcverbose_  0    ;# if 1 print debug info\end{verbatim}The debug info is written into stderr.\subsection {Modifications for use outside GPRS}To use this acked/fragmented RLC  for a non-GPRS mac layer, in the function{\em sendACK()} in {\it ~ns}/rlc.cc ,  change the variable "dh" according to the mac layerbeing used\begin{verbatim}      void RLC::sendACK(Packet* p)        {                ...            hdr_mac_gprs *dh = HDR_MAC_GPRS(p);                ...        }\end{verbatim}For example, to use with  mac802\_11,  replace the shown line with:         hdr\_mac802\_11 *dh =HDR\_MAC802\_11(p);\subsection {To bypass the RLC}RLC layer can be bypassed by changing the following part in{\it ~ns}/tcl/lib/ns-mobilenode.tcl\begin{verbatim}     # Link Layer     $ll arptable $arptable_     $ll ifq $ifq     $ll mac $mac     # $ll down-target $ifq;    #if NO rlc uncomment it     $ll down-target $rlc;      #if NO rlc comment this and rest of rlc below     # for rlc     $rlc up-target $ll     $rlc mac $mac     $rlc down-target $ifq\end{verbatim}

⌨️ 快捷键说明

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