📄 printout.ps
字号:
(stdin) (Page 12/122) (Mar 01, 04 20:25) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (6/61) (Monday March 01, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (13-14) 7%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(integrated_agent.cc) K( Feb 29 18:09 2004 Page: 10) p n() N(/* Copyright \(c\) University of Maryland, Baltimore County, 2003.) N( * Original Authors: Ramakrishna Shenai, Sunil Gowda and Krishna Sivalingam.) N( *) N( * This software is developed at the University of Maryland, Baltimore County un) N(der) N( * grants from Cisco Systems Inc and the University of Maryland, Baltimore Count) N(y.) N( *) N( * Permission to use, copy, modify, and distribute this software and its) N( * documentation in source and binary forms for non-commercial purposes) N( * and without fee is hereby granted, provided that the above copyright) N( * notice appear in all copies and that both the copyright notice and) N( * this permission notice appear in supporting documentation. and that) N( * any documentation, advertising materials, and other materials related) N( * to such distribution and use acknowledge that the software was) N( * developed by the University of Maryland, Baltimore County. The name of) N( * the University may not be used to endorse or promote products derived from) N( * this software without specific prior written permission.) N( *) N( * Copyright \(C\) 2000-2003 Washington State University. All rights reserved.) N( * This software was originally developed at Alcatel USA and subsequently modifi) N(ed) N( * at Washington State University, Pullman, WA through research work which was) N( * supported by Alcatel USA, Inc and Cisco Systems Inc.) N() N( * The following notice is in adherence to the Washington State University) N( * copyright policy follows.) N( *) N( * License is granted to copy, to use, and to make and to use derivative) N( * works for research and evaluation purposes, provided that Washington) N( * State University is acknowledged in all documentation pertaining to any such) N( * copy or derivative work. Washington State University grants no other) N( * licenses expressed or implied. The Washington State University name) N( * should not be used in any advertising without its written permission.) N( *) N( * WASHINGTON STATE UNIVERSITY MAKES NO REPRESENTATIONS CONCERNING EITHER) N( * THE MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE) N( * FOR ANY PARTICULAR PURPOSE. The software is provided "as is") N( * without express or implied warranty of any kind. These notices must) N( * be retained in any copies of any part of this software.) N( */) N() N(#include "integrated_agent.h") N(#include "./debug.h") N() N(/* Default initial values for static variables */) N(int hdr_IPKT::offset_ipkt_;) N(unsigned long BurstManager::burstid__ = 0;) N(int BurstManager::maxburstsize__ = 1000; // 1000) N(int BurstManager::pcntguard__ = 0;) N() N(//GMG -- changed initialization of offsettime__ to array initialization; note th) N(at must change this) N(// if #QoS classes \(nqos_classes\) is changed) N(double BurstManager::offsettime__[] = { 0.000010, 0.000010, 0.000010, 0.000010, ) N(0.000010 };) N() N(double BurstManager::burst_timeout__ = 0.01; // 0.1) N(double BurstManager::delta__ = 0.00001;) N() N(stdin) (Page 13/122) (Mar 01, 04 20:25) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto() p n(stdin) (Page 14/122) (Mar 01, 04 20:25) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (7/61) (Monday March 01, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (15-16) 8%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(integrated_agent.cc) K( Feb 29 18:09 2004 Page: 11) p n() N() N(/*=====================================================================*) N( * *) N( * Implementation of the Burst-manager class *) N( * *) N( *=====================================================================*/) N(/* Constructs a new BurstManager */) N(BurstManager::BurstManager\(\) : bt_\(this\),) N( currburstsize) S(^H^H) L(^H currburstsize_\(0\), npkts_\(0\), a_\(NULL\), destnodeid_\() p n(-1\)) N({) N( for \( int i = 0 ; i < MAXBURSTSIZE ; i++ \)) N( BurstBuffer_[i] = NULL;) N(}) N() N() N() N() N() N() N(/* Init method, intended to be called by the parent IPKT Agent.) N( * parent - reference to the initializing IPKT Agent) N( * destnodeid - the default destination node identifier) N( */) N(void BurstManager::init\( IPKTAgent* parent,int destnodeid, int priority \)) N({) N( a_ = parent;) N( destnodeid_ = destnodeid;) N( prio_ = priority;) N(}) N() N(/* Support - method 1 - Calculates the number of hops between the source) N( * and destination.) N( * src - the source address) N( * des - the destination address) N( * returns the number of hops in the burst manager */) N(int BurstManager::nhops\(nsaddr_t src,nsaddr_t des\)) N({) N( Tcl& tcl = Tcl::instance\(\);) N( sprintf\(tcl.buffer\(\),"[Simulator instance] nhops %d %d",src,des\);) N( tcl.eval\(\);) N( char *ni = tcl.result\(\);) N( return atoi\(ni\);) N(}) N() N(/* Recv method. */) N(void BurstManager::recv\( Packet *pkt, Handler *h \)) N({) N( hdr_cmn *ch = hdr_cmn::access\( pkt \);) N( int pktsize = ch->size\(\);) N( if \(ch->ptype\(\) == PT_TCP\) //GMG -- added TCPSND, ACKSND, and UDPSND) N( // statistics collection) N( {) N( StatCollector &sc = StatCollector::instance\(\);) N( sc.updateEntry\( "TCPSND", sc.getValue\( "TCPSND" \) + 1.0 \);) N( sc.updateEntry\( "TCPBYTESSND", sc.getValue\( "TCPBYTESSND" \) + pktsize \);) N( }) N() N(stdin) (Page 15/122) (Mar 01, 04 20:25) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(integrated_agent.cc) K( Feb 29 18:09 2004 Page: 12) p n() N( else if \(ch->ptype\(\) == PT_ACK\)) N( {) N( StatCollector &sc = StatCollector::instance\(\);) N( sc.updateEntry\( "ACKSND", sc.getValue\( "ACKSND" \) + 1.0 \);) N( }) N( else if \(ch->ptype\(\) == PT_UDP\)) N( {) N( StatCollector &sc = StatCollector::instance\(\);) N( sc.updateEntry\( "UDPSND", sc.getValue\( "UDPSND" \) + 1.0 \);) N( sc.updateEntry\( "UDPBYTESSND", sc.getValue\( "UDPBYTESSND" \) + pktsize \);) N( }) N( else if \(ch->ptype\(\) == PT_CBR\)) N( {) N( StatCollector &sc = StatCollector::instance\(\);) N( sc.updateEntry\( "CBRSND", sc.getValue\( "CBRSND" \) + 1.0 \);) N( sc.updateEntry\( "CBRBYTESSND", sc.getValue\( "CBRBYTESSND" \) + pktsize \);) N( }) N( else if \(ch->ptype\(\) == PT_EXP\)) N( {) N( StatCollector &sc = StatCollector::instance\(\);) N( sc.updateEntry\( "EXPSND", sc.getValue\( "EXPSND" \) + 1.0 \);) N( sc.updateEntry\( "EXPBYTESSND", sc.getValue\( "EXPBYTESSND" \) + pktsize \);) N( }) N( else if \(ch->ptype\(\) == PT_PARETO\)) N( {) N( StatCollector &sc = StatCollector::instance\(\);) N( sc.updateEntry\( "PARSND", sc.getValue\( "PARSND" \) + 1.0 \);) N( sc.updateEntry\( "PARBYTESSND", sc.getValue\( "PARBYTESSND" \) + pktsize \);) N( }) N( else if \(ch->ptype\(\) == PT_SELFSIM\)) N( {) N( StatCollector &sc = StatCollector::instance\(\);) N( sc.updateEntry\( "SSIMSND", sc.getValue\( "SSIMSND" \) + 1.0 \);) N( sc.updateEntry\( "SSIMBYTESSND", sc.getValue\( "SSIMBYTESSND" \) + pktsize \)) N(;) N( }) N() N( if \( \( currburstsize_ + pktsize \) > maxburstsize__ \)) N( sendBurst\(\);) N( if \( npkts_ == 0 \)) N( bt_.resched\( burst_timeout\(\) \);) N() N( BurstBuffer_[npkts_++] = pkt;) N( currburstsize_ += pktsize;) N() N( if \( currburstsize_ >= maxburstsize__ \)) N( sendBurst\(\);) N( // Debug::debug\( "BurstManager: added the TCP/UDP packet successfully" \);) N(}) N() N(void BurstManager::timeout\(\)) N() N() N() N() N({) N( if\( currburstsize_ > 0 \) {) N() N(stdin) (Page 16/122) (Mar 01, 04 20:25) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (8/61) (Monday March 01, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (17-18) 9%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(integrated_agent.cc) K( Feb 29 18:09 2004 Page: 13) p n() N( sendBurst\(\);) N( }) N( bt_.resched\( burst_timeout\(\) \);) N(}) N() N(void BurstManager::sendBurst\(\)) N({) N( if\( currburstsize_ > 0 \) {) N( a_->sendBurst\( BurstBuffer_, getburstid\(\), npkts_,) N( currburstsize_, destnodeid_, offsettime__[prio_], pcntguard__,) N( delta__, prio_ \);) N( }) N( resetBurstParams\(\);) N(}) N() N(void BurstManager::resetBurstParams\(\)) N({) N( int i = 0;) N() N( while\(BurstBuffer_[i]!= NULL && i<MAXBURSTSIZE \)) N( BurstBuffer_[i++] = NULL;) N() N( currburstsize_ = 0;) N( npkts_ = 0;) N(}) N() N(int BurstManager::command\( int argc, const char*const* argv\) {) N( return NsObject::command\( argc, argv \);) N(}) N() N(double& BurstManager::offsettime\(int j\)) N({) N( char s[200];) N() N( if \(j < 0 || j >= nqos_classes\)) N( {) N( sprintf\(s, "Invalid QoS class %d in obtaining offsettime", j\);) N( Debug::debug\(s\);) N( exit\(1\);) N( }) N( return offsettime__[j];) N(}) N() N(void BurstManager::setOffsettime\( int j, double offsettime \)) N({) N( char s[200];) N() N( if \(j < 0 || j >= nqos_classes\)) N( {) N( sprintf\(s, "Invalid QoS class %d in obtaining offsettime", j\);) N( Debug::debug\(s\);) N( exit\(1\);) N( }) N( offsettime__[j] = offsettime;) N(}) N() N() N(stdin) (Page 17/122) (Mar 01, 04 20:25) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(integrated_agent.cc) K( Feb 29 18:09 2004 Page: 14) p n() N(/*=====================================================================*) N( * *) N( * Implementation of the Integrated-Agent class *) N( * *) N( *=====================================================================*/) N() N(// default constructor //) N(IPKTAgent::IPKTAgent\(\) : Agent\(PT_IPKT\) , maxindx_\( -1 \),) N( seqno) S(^H^H^H^H^H) L(^H) K(^H ) p n( seqno_\(0\)) N({) N( int j;) N( for \( j = 0; j < nqos_classes; j++\)) N( BM_[j] = \(BurstManager*\)NULL;) N() N( bind\("packetSize_", &size_\);) N( bind\( "address_", &address_ \);) N(}) N() N() N() N() N() N() N(// handle the recv of a packet) N(void IPKTAgent::recv\( Packet *pkt, Handler *h \)) N({) N( hdr_ip* hdrip = hdr_ip::access\(pkt\);) N( hdr_cmn* ch = hdr_cmn::access\(pkt\);) N( hdr_IPKT* hdr = hdr_IPKT::access\( pkt \);) N( int priority; //GMG -- added priority variable) N() N( char s[200];) N() N(// if \( \( ch->ptype\(\) == PT_TCP || ch->ptype\(\) == PT_ACK \)) N() N( if \( \(ch->ptype\(\) != PT_IPKT\) //GMG -- changed this to) N( && \( hdrip->saddr\(\)== addr\(\) \) \) { // correspond to the) N( // receipt of any data packet \(not) N( //just TCP, ACK, or UDP\)) N(//GMG -- added calculation of packet priority; print error message and terminate) N( if out of range.) N( priority = hdrip->prio\(\);) N( if \(priority < 0 || priority >= nqos_classes\)) N( {) N( sprintf \(s, "Priority = %d is out of bounds", priority\);) N( Debug::debug\(s\);) N( char *src_nodeaddr = Address::instance\(\).print_nodeaddr\(hdrip->saddr\() N(\)\);) N( char *src_portaddr = Address::instance\(\).print_portaddr\(hdrip->sport\() N(\)\);) N( char *dst_nodeaddr = Address::instance\(\).print_nodeaddr\(hdrip->daddr\() N(\)\);) N( char *dst_portaddr = Address::instance\(\).print_portaddr\(hdrip->dport\() N(\)\);) N( sprintf \(s, "Source node.port = %s.%s Dest node.port = %s.%s",) N( src_nodeaddr, src_portaddr, dst_nodeaddr, dst_portadd) N(r\);) N( Debug::debug\(s\);) N( exit\(1\);) N(stdin) (Page 18/122) (Mar 01, 04 20:25) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (9/61) (Monday March 01, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (19-20) 10%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -