📄 ll.tex
字号:
\section {Link Layer(LL)} This describes an implementation of Link Layer which supports fragmentationand link level ARQ\footnotemark[1] . Though this was written as a part of GPRS stackimplementation, it can be used independently with any other stack with minormodifications(section 4).\footnotetext[1] { This was implemented by Sandeep Kumar, Kopparapu Suman and Richa Jain at Indian Institute of Technology, Bombay. June 2001}The default LL provided by ns has been modified to include fragmentation andacknowledged mode as options. In acked mode, currently only one MS canbe supported.The LL can be used in fragmented or unfragmented mode. This can beconfigured from the OTcl script. In fragmented mode, packets received fromthe sending Agent are segmented before sending down to the RLC and arereassembled at the other end, before being passed up to the receiving Agent.The fragment size can be set by the user. It is currently set at a defaultof 1500 bytes in accordance with themaximum LL PDU size specified in GPRS.The LL can be used in acked or unacked mode. A stop-and-wait retransmitmechanism is implemented. The LL header has been modified to accommodatethese changes. Presently, this implementation supports only 2 nodes in theacked mode.In unacked mode with no fragmentation, the Link Layer functions like thedefault {\it ns} Link Layer.\subsection {LL class in C++}The LL class is derived 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 LL : public LinkDelay { friend class llTxTimer; //rtx timer for datapkts friend class llackTimer; //rtx timer for llackspublic: : // 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 sendDown(Packet* p); //hack for calls in snoop.cc virtual void enqueDATA(Packet* p); //set mac hdrs and arp virtual void fragDATA(Packet* p); //fragment data virtual void sendDownDATA(void); //send data down virtual void sendACK(Packet* p); //send ll ack virtual void sendHandler(void); virtual void send_timer(void); virtual void sendackHandler(void); virtual void send_acktimer(void); virtual void RetransmitDATA(void); //rtx data on timeout virtual void RetransmitACK(void); //rtc ll ack on timeout : protected: int command(int argc, const char*const* argv); static int llverbose_; //ll layer debug output int seqno_; // link-layer sequence number int ackno_; // ACK received so far int macDA_; // destination MAC address : Queue* ifq_; // interface queue PacketQueue* buf_; // queue to store frag pkts to sendDown : int acked_; //LL layer acked? int llfraged_; //LL layer PDU fragmented? int llfragsz_; //LL layer frag size int datacounter; //no of rtx for data int ackcounter; //no of rtx for ll ack Packet *pktTx_; //store rtx data Packet *pktRx_; //store rtx ll ack}\end{verbatim}\subsection {Parameters} The following parameters can be set and the default values arefixed in {\it ~ns}/tcl/lib/ns-default.tcl\begin{verbatim}LL set mindelay_ 50usLL set delay_ 25usLL set bandwidth_ 0 ;# not usedLL set debug_ false#new parametersLL set acked_ 1 ;# 1=> acked ; 0 =>unackedLL set llfraged_ 1 ;# 1=>fragmented ; 0=>no fragmentationLL set llfragsz 500 ;# Size of each LL fragmentLL set llverbose_ 0 ;# if 1 print debug info\end{verbatim}The debug info is written into stderr.\subsection{Modifications for use outside GPRS/GSM}To use this acked/fragmented LL for a non-GPRS/GSM mac layer, in the function{\em sendACK()} in {\it ~ns}/ll.cc , change the variable "dh" according to the mac layerbeing used \begin{verbatim} void LL::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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -