?? ll.h
字號:
/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- *//* Modified and extended by Sandeep Kumar, Kopparapu Suman and 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.*//* * Copyright (c) 1997 Regents of the University of California. * 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 must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Daedalus Research * Group at the University of California Berkeley. * 4. Neither the name of the University nor of the Laboratory may be used * to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Contributed by the Daedalus Research Group, http://daedalus.cs.berkeley.edu */#ifndef ns_ll_h#define ns_ll_h#include <delay.h>#include <queue.h>#include <arp.h>#include <classifier.h>#include <lanRouter.h>#include <varp.h>#include <ll-timers.h>enum LLFrameType { LL_DATA = 0x0001, LL_ACK = 0x0010};struct hdr_ll { LLFrameType lltype_; // link-layer frame type int seqno_; // sequence number int ackno_; // acknowledgement number int bopno_; // begin of packet seqno int eopno_; // end of packet seqno int psize_; // size of packet double sendtime_; // time the packet is sent static int offset_; inline int& offset() { return offset_; } static hdr_ll* access(const Packet* p) { return (hdr_ll*) p->access(offset_); } inline LLFrameType& lltype() { return lltype_; } inline int& seqno() { return seqno_; } inline int& ackno() { return ackno_; } inline int& bopno() { return bopno_; } inline int& eopno() { return eopno_; } inline int& psize() { return psize_; } inline double& sendtime() { return sendtime_; }};class LL : public LinkDelay { friend class llTxTimer; //rtx timer for datapkts friend class llackTimer; //rtx timer for llackspublic: friend void ARPTable::arpinput(Packet *p, LL* ll); friend void ARPTable::arprequest(nsaddr_t src, nsaddr_t dst, LL* ll); LL(); virtual void recv(Packet* p, Handler* h); void handle(Event* e) { recv((Packet*)e, 0); } inline int initialized() { return (mac_ && uptarget_ && downtarget_); }// 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 sendUp(Packet* p); 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 inline int seqno() { return seqno_; } //seqno of data pkt inline int ackno() { return ackno_; } //ackno of ll ack pkt inline int macDA() { return macDA_; } inline Queue *ifq() { return ifq_; } //IFQ inline NsObject* downtarget() { return downtarget_; } inline NsObject* uptarget() { return uptarget_; } inline ARPTable *arp_table() { return arptable_; } 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 Mac* mac_; // MAC object LanRouter* lanrouter_; ARPTable* arptable_; // ARP table object VARPTable* varp_; // Virtual ARP object NsObject* downtarget_; // for outgoing packet NsObject* uptarget_; // for incoming packet 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 ackprivate: llTxTimer lhSend_; llackTimer acSend_;};#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -