?? rlc.h
字號:
/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- *//* 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.*/#ifndef ns_rlc_h#define ns_rlc_h#include <delay.h>#include <queue.h>#include <arp.h>#include <classifier.h>#include <lanRouter.h>#include <varp.h>#include <rlc-timers.h>//#include <rlc-timers.h> enum RLCFrameType { RLC_DATA = 0x0001, RLC_ACK = 0x0010, RLC_NACK = 0x0000,};struct hdr_rlc { RLCFrameType rlctype_; // 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_rlc* access(const Packet* p) { return (hdr_rlc*) p->access(offset_); } inline RLCFrameType& rlctype() { return rlctype_; } 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 RLC : public LinkDelay { friend class rlcTxTimer; friend class rlcackTimer;public:// friend void ARPTable::arpinput(Packet *p, LL* ll);// friend void ARPTable::arprequest(nsaddr_t src, nsaddr_t dst, LL* ll); RLC(); virtual void recv(Packet* p, Handler* h); void handle(Event* e) { recv((Packet*)e, 0); } inline int initialized() { return (mac_ && uptarget_ && downtarget_); }//sandy's new funcs virtual void recvACK(Packet* p); virtual void recvDATA(Packet* p); virtual void sendUpDATA(Packet* p); virtual void enqueDATA(Packet* p); virtual void sendDownDATA(void); virtual void sendACK(Packet* p);// virtual void sendUp(Packet* p);// virtual void sendDown(Packet* p); virtual void sendHandler(void); virtual void send_timer(void); virtual void sendackHandler(void); virtual void send_acktimer(void); virtual void RetransmitDATA(void); virtual void RetransmitACK(void); virtual void sendDownDATAonACK(void); inline int seqno() { return seqno_; } inline int ackno() { return ackno_; } inline int macDA() { return macDA_; } inline Queue *ifq() { return 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 rlcverbose_; //rj int seqno_; // link-layer sequence number int ackno_; // ACK received so far int rackno_; // seq no of left most pkt int macDA_; // destination MAC address int window_; //sandy window size for sack Queue* ifq_; // interface queue PacketQueue* buf_; //sandy's queue PacketQueue* Txbuf_; //sandy's Tx buffer PacketQueue* Rxbuf_; //sandy's Rx buffer Mac* mac_; // MAC object LanRouter* lanrouter_; // for lookups of the next hop ARPTable* arptable_; // ARP table object VARPTable* varp_; // Virtual ARP object NsObject* downtarget_; // for outgoing packet NsObject* uptarget_; // for incoming packet int acked_; //sandy int rlcfraged_; int rlcfragsz_; int datacounter; int ackcounter; Packet *pktTx_; Packet *pktRx_; int inseq_; //sandy int unackseqno_; //sandy int numdups; //sandyprivate: rlcTxTimer lhSend_; rlcackTimer acSend_;};#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -