📄 patch_gprs
字号:
> {> hdr_cmn *ch = HDR_CMN(p);> hdr_ll *llh = HDR_LL(p);> hdr_ip *iph = HDR_IP(p);> hdr_mac_gprs *dh = HDR_MAC_GPRS(p);> char *mh = (char*)p->access(hdr_mac::offset_);> > Packet* sp = Packet::alloc();> > hdr_cmn *chsp = HDR_CMN(sp);> hdr_ll *llhsp = HDR_LL(sp);> hdr_ip *iphsp = HDR_IP(sp);> char *mhsp = (char *)HDR_MAC(sp);> // char *mhsp = (char*)sp->access(hdr_mac::offset_);> > iphsp->src_ = iph->dst_;> iphsp->dst_ = iph->src_;> > // chsp->next_hop_ = ch->prev_hop_;> chsp->next_hop_=Address::instance().get_nodeaddr(iph->saddr()); > // chsp->prev_hop_ = ch->next_hop_;> chsp->prev_hop_=Address::instance().get_nodeaddr(iph->daddr()); > chsp->addr_type_ = ch->addr_type_;> chsp->direction_ = hdr_cmn::DOWN;> chsp->ptype_=PT_LLACK; > chsp->size_=6;> chsp->iface()= -2;> chsp->error()= 0;> chsp->uid()= 0;> // if (llverbose_==1) fprintf(stderr,"<%d> %fnexthop=%x; prevhop=%x, lasthop=%x",chsp->next_hop_,chsp->prev_hop_,chsp->last_hop_); > // if (llverbose_==1) fprintf(stderr,"<%d> %f LL:test:recv pkt_type=%s uid=%d src=%d dst=%d\n", mac_->addr(), NOW ,packet_info.name(ch->ptype()),ch->uid_,Address::instance().get_nodeaddr(iph->saddr()),Address::instance().get_nodeaddr(iph->daddr()));> > // mhsp->set(mh->ftype(),mh->macDA(),mh->macSA());> // mhsp->dh_da=mh->dh_sa;> // mhsp->dh_sa=mh->dh_da;> // mhsp->hdr_type_=mh->hdr_type_;> // mhsp->ftype_=mh->ftype_;> > int dst_=ETHER_ADDR(dh->dh_sa);> mac_->hdr_src(mhsp, mac_->addr());> mac_->hdr_type(mhsp, ETHERTYPE_IP);> mac_->hdr_dst(mhsp, dst_);> // mac_->hdr_dst((char*) HDR_MAC(sp), chsp->next_hop());> > > llhsp->lltype() = LL_ACK;> llhsp->ackno_ = llh->seqno_+1;> > > pktRx_ = sp->copy(); > Scheduler& s = Scheduler::instance();> s.schedule(downtarget_, sp, delay_);> acSend_.stop();> acSend_.start(0.5);//why 1.5 ?? rj> if (llverbose_==1) fprintf(stderr,"<%d> %f LL: recvd a LL frag. sending LL ack num %d\n",> mac_->addr(), NOW, llhsp->ackno_);> > //Packet::free(p); > }> > void LL::sendHandler()> {> send_timer();> }> > void LL::sendackHandler()> {> send_acktimer();244a583,640> void LL::send_timer()> {> RetransmitDATA();> // RetransmitACK();> }> > void LL::send_acktimer()> {> RetransmitACK();> }> > > void LL::RetransmitDATA()> {> datacounter =datacounter + 1;> assert(pktTx_);> hdr_ll* llh=HDR_LL(pktTx_);> > if (datacounter <4){ > if (llverbose_==1) fprintf(stderr,"<%d> %f LL: wait for ack timed out. retxing ll_seqno=%d bopno=%d eopno=%d for %dth time\n",> mac_->addr(), NOW, llh->seqno_, llh->bopno_, llh->eopno_, datacounter);> Scheduler& s = Scheduler::instance();> s.schedule(downtarget_, pktTx_->copy(), delay_);> lhSend_.stop();> lhSend_.start(0.5);> }> else{> if (llverbose_==1) fprintf(stderr,"<%d> %f LL: retxed 5 times. ditched ll_seqno=%d bopno=%d eopno=%d\n", > mac_->addr(), NOW, llh->seqno_, llh->bopno_, llh->eopno_);> datacounter=0; //check this up...was good without it> ackno_ ++;> sendDownDATA();> }> }> > void LL::RetransmitACK()> {> ackcounter =ackcounter +1;> assert(pktRx_);> hdr_ll *llh=HDR_LL(pktRx_);> if (ackcounter < 4){> if (llverbose_==1) fprintf(stderr,"<%d> %f LL: retx ack=%d for %dth time\n",> mac_->addr(), NOW, llh->ackno_, ackcounter);> Scheduler& s = Scheduler::instance();> s.schedule(downtarget_,pktRx_->copy(),delay_);> acSend_.stop();> acSend_.start(0.5);> }> else{> if (llverbose_==1) fprintf(stderr,"<%d> %f LL: retx ack 5 times. ditching\n", mac_->addr(), NOW );> }> }> > /* hack for the sendDown being called directly from snoop and satlink*/> void LL::sendDown(Packet* p)> {> enqueDATA(p);> }diff -r ns2b7a-original/ns-allinone-2.1b7a/ns-2.1b7a/ll.h ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/ll.h1a2,33> > /* 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.> */> > 35,36d66< *< * @(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/ll.h,v 1.28 2000/09/01 03:04:06 haoboy Exp $ (UCB)38d67< 47a77> #include <ll-timers.h>79a110,111> friend class llTxTimer; //rtx timer for datapkts> friend class llackTimer; //rtx timer for llacks89,96c121,141< < virtual void sendUp(Packet* p);< virtual void sendDown(Packet* p);< < inline int seqno() { return seqno_; }< inline int ackno() { return ackno_; }< inline int macDA() { return macDA_; }< inline Queue *ifq() { return ifq_; }---> // 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 102a148,149> > static int llverbose_; //ll layer debug output108a156> PacketQueue* buf_; // queue to store frag pkts to sendDown110c158< LanRouter* lanrouter_; // for lookups of the next hop---> LanRouter* lanrouter_; 117c165,175< ---> 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> > private:> llTxTimer lhSend_; > llackTimer acSend_;Only in ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a: mac-gprs.ccOnly in ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a: mac-gprs.hdiff -r ns2b7a-original/ns-allinone-2.1b7a/ns-2.1b7a/mac.cc ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/mac.cc89c89< hRes_(this), hSend_(this), state_(MAC_IDLE), pktRx_(0), pktTx_(0)---> hRes_(this), hSend_(this), state_(MAC_IDLE), pktRx_(0), pktTx_(0),q_(0)107c107< }---> } diff -r ns2b7a-original/ns-allinone-2.1b7a/ns-2.1b7a/mac.h ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/mac.h51c51< ---> 173a174,175> inline Queue *q() { return q_; } //rj > Queue *q_;//pointer to the ifq rj 193,194c195,196< < //mac methods to set dst, src and hdt_type in pkt hdrs.---> > //mac methods to set dst, src and hdt_type in pkt hdrs.225a228,229> > 231c235< Tap *tap_; // tap agent---> Tap *tap_; // tap agent232a237> 238a244,245> Event intr1_; //rj> Event intr; //rjdiff -r ns2b7a-original/ns-allinone-2.1b7a/ns-2.1b7a/mobilenode.cc ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/mobilenode.cc124c124< ---> 128c128< ---> 137a138> 224c225< } else if(strcmp(argv[1], "random-motion") == 0) {---> } else if(strcmp(argv[1], "random-motion") == 0) {249,250c250,252< return TCL_OK;< } ---> return TCL_OK; > }> 300a303> 566a570,571> > diff -r ns2b7a-original/ns-allinone-2.1b7a/ns-2.1b7a/mobilenode.h ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/mobilenode.h130c130< inline void getLoc(double *x, double *y, double *z) {---> inline void getLoc(double *x, double *y, double *z) {133c133< inline void getVelo(double *dx, double *dy, double *dz) {---> inline void getVelo(double *dx, double *dy, double *dz) {136a137> 153a155> 163c165< double position_update_interval_;---> double position_update_interval_;191c193< double radius_;---> double radius_;200,201c202,203< void random_destination();< int set_destination(double x, double y, double speed);---> void random_destination();> int set_destination(double x, double y, double speed);228a231> Only in ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/mpls: classifier-addr-mpls.oOnly in ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/mpls: ldp.oOnly in ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/mpls: mpls-module.oOnly in ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a: noahdiff -r ns2b7a-original/ns-allinone-2.1b7a/ns-2.1b7a/node.cc ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/node.cc85d84< diff -r ns2b7a-original/ns-allinone-2.1b7a/ns-2.1b7a/node.h ns-richa-gprs/ns-allinone-2.1b7a/ns-2.1b7a/node.h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -