Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

WebTrafSession Class Reference

#include <webtraf.h>

Inheritance diagram for WebTrafSession:

Inheritance graph
[legend]
Collaboration diagram for WebTrafSession:

Collaboration graph
[legend]
List of all members.

Public Types

enum  TimerStatus { TIMER_IDLE, TIMER_PENDING, TIMER_HANDLING }

Public Member Functions

 WebTrafSession (WebTrafPool *mgr, Node *src, int np, int id, int ftcp_, int recycle_p)
virtual ~WebTrafSession ()
RandomVariable *& interPage ()
RandomVariable *& pageSize ()
RandomVariable *& interObj ()
RandomVariable *& objSize ()
void donePage (void *ClntData)
void launchReq (void *ClntData, int obj, int size)
int id () const
WebTrafPoolmgr ()
void set_interPageOption (int option)
void sched (double delay)
void resched (double delay)
void cancel ()
void force_cancel ()
int status ()

Static Public Attributes

int LASTPAGE_ = 1

Protected Attributes

int status_
Event event_

Private Member Functions

virtual void expire (Event *e=0)
virtual void handle (Event *e)

Private Attributes

RandomVariablervInterPage_
RandomVariablervPageSize_
RandomVariablervInterObj_
RandomVariablervObjSize_
WebTrafPoolmgr_
Nodesrc_
int nPage_
int curPage_
int donePage_
int id_
int interPageOption_
int fulltcp_
int recycle_page_

Member Enumeration Documentation

enum TimerHandler::TimerStatus [inherited]
 

Enumeration values:
TIMER_IDLE 
TIMER_PENDING 
TIMER_HANDLING 

Definition at line 66 of file timer-handler.h.


Constructor & Destructor Documentation

WebTrafSession::WebTrafSession WebTrafPool mgr,
Node src,
int  np,
int  id,
int  ftcp_,
int  recycle_p
 

Definition at line 117 of file webtraf.cc.

References fulltcp_, and recycle_page_.

00117                                                                                                     : 
00118         rvInterPage_(NULL), rvPageSize_(NULL),
00119         rvInterObj_(NULL), rvObjSize_(NULL), 
00120         mgr_(mgr), src_(src), nPage_(np), curPage_(0), donePage_(0),
00121         id_(id), interPageOption_(1), fulltcp_(0) {
00122         fulltcp_ = ftcp_;
00123         recycle_page_ = recycle_p;
00124 }

WebTrafSession::~WebTrafSession  )  [virtual]
 

Definition at line 127 of file webtraf.cc.

References abort(), curPage_, donePage_, recycle_page_, rvInterObj_, rvInterPage_, rvObjSize_, rvPageSize_, TimerHandler::status_, and TimerHandler::TIMER_IDLE.

00128 {
00129         if (donePage_ != curPage_) {
00130                 fprintf(stderr, "done pages %d != all pages %d\n",
00131                         donePage_, curPage_);
00132                 abort();
00133         }
00134         if (status_ != TIMER_IDLE) {
00135                 fprintf(stderr, "WebTrafSession must be idle when deleted.\n");
00136                 abort();
00137         }
00138 
00139         // Recycle the objects of page level attributes if needed
00140         // Reuse these objects may save memory for large simulations--xuanc
00141         if (recycle_page_) {
00142                 if (rvInterPage_ != NULL)
00143                         Tcl::instance().evalf("delete %s", rvInterPage_->name());
00144                 if (rvPageSize_ != NULL)
00145                         Tcl::instance().evalf("delete %s", rvPageSize_->name());
00146                 if (rvInterObj_ != NULL)
00147                         Tcl::instance().evalf("delete %s", rvInterObj_->name());
00148                 if (rvObjSize_ != NULL)
00149                         Tcl::instance().evalf("delete %s", rvObjSize_->name());
00150         }
00151 }

Here is the call graph for this function:


Member Function Documentation

void TimerHandler::cancel  )  [inherited]
 

Definition at line 31 of file timer-handler.cc.

References TimerHandler::_cancel(), abort(), TimerHandler::status_, TimerHandler::TIMER_IDLE, and TimerHandler::TIMER_PENDING.

Referenced by BayFullTcpAgent::cancel_rtx_timeout(), PushbackTimer::cancelStatus(), SmacCsTimer::checkToCancel(), LmsReceiver::delete_nak(), QA::get_data(), SMAC::handleACK(), SMAC::handleCTS(), SMAC::handleSYNC(), LandmarkAgent::periodic_callback(), LandmarkAgent::ProcessHierUpdate(), DelAckSink::recv(), TcpAsymSink::recv(), AbsDelAckSink::recv(), MIPMHAgent::recv(), FtpClientAgent::recv(), PushbackTimer::removeEvents(), DelAckSink::reset(), FackTcpAgent::send_much(), TcpSessionAgent::set_rtx_timer(), TcpFsAgent::set_rtx_timer(), TrafficGenerator::stop(), SA_Agent::stop(), RTCPAgent::stop(), RapAgent::stop(), QA::stop(), LandmarkAgent::stop(), Estimator::stop(), NeighborCache::~NeighborCache(), PacketTypeLog::~PacketTypeLog(), QA::~QA(), and TBF::~TBF().

00032 {
00033         if (status_ != TIMER_PENDING) {
00034                 fprintf(stderr,
00035                   "Attempting to cancel timer at %p which is not scheduled\n",
00036                   this);
00037                 abort();
00038         }
00039         _cancel();
00040         status_ = TIMER_IDLE;
00041 }

Here is the call graph for this function:

void WebTrafSession::donePage void *  ClntData  ) 
 

Definition at line 153 of file webtraf.cc.

References abort(), WebPage::curObj(), WebPage::doneObj(), donePage_, WebTrafPool::doneSession(), WebPage::id(), id_, interPageOption_, WebTrafPool::isdebug(), mgr_, nPage_, rvInterPage_, TimerHandler::sched(), and RandomVariable::value().

Referenced by WebPage::doneObject().

00154 {
00155         WebPage* pg = (WebPage*)ClntData;
00156         if (mgr_->isdebug()) 
00157                 printf("Session %d done page %d\n", id_, pg->id());
00158         if (pg->doneObj() != pg->curObj()) {
00159                 fprintf(stderr, "done objects %d != all objects %d\n",
00160                         pg->doneObj(), pg->curObj());
00161                 abort();
00162         }
00163         delete pg;
00164         // If all pages are done, tell my parent to delete myself
00165         //
00166         if (++donePage_ >= nPage_)
00167                 mgr_->doneSession(id_);
00168         else if (interPageOption_) {
00169                 // Polly Huang: Wed Nov 21 18:23:30 CET 2001
00170                 // add inter-page time option
00171                 // inter-page time = end of a page to the start of the next
00172                 sched(rvInterPage_->value());
00173                 // printf("donePage: %g %d %d\n", Scheduler::instance().clock(), donePage_, curPage_);
00174         }
00175 }

Here is the call graph for this function:

void WebTrafSession::expire Event e = 0  )  [private, virtual]
 

Implements TimerHandler.

Definition at line 178 of file webtraf.cc.

References curPage_, id_, WebTrafPool::isdebug(), LASTPAGE_, mgr_, WebTrafPool::pickdst(), rvPageSize_, WebPage::start(), and RandomVariable::value().

00179 {
00180         // Pick destination for this page
00181         Node* dst = mgr_->pickdst();
00182         // Make sure page size is not 0!
00183         WebPage* pg = new WebPage(LASTPAGE_++, this, 
00184                                   (int)ceil(rvPageSize_->value()), dst);
00185         if (mgr_->isdebug())
00186                 printf("Session %d starting page %d, curpage %d\n", 
00187                        id_, LASTPAGE_-1, curPage_);
00188         pg->start();
00189 }

Here is the call graph for this function:

void TimerHandler::force_cancel  )  [inline, inherited]
 

Definition at line 60 of file timer-handler.h.

References TimerHandler::_cancel(), TimerHandler::status_, TimerHandler::TIMER_IDLE, and TimerHandler::TIMER_PENDING.

Referenced by TcpAgent::cancel_rtx_timer(), TcpSessionAgent::cancel_rtx_timer(), TcpFsAgent::cancel_rtx_timer(), AbsTcpAgent::cancel_timer(), TcpAgent::cancel_timers(), TcpSessionAgent::cancel_timers(), FullTcpAgent::cancel_timers(), TcpFsAgent::cancel_timers(), SinkAgent::command(), UnslottedAlohaMac::end_of_contention(), GAFAgent::processDiscoveryMsg(), RTPAgent::rate_change(), TfrcAgent::stop(), RTPAgent::stop(), and SinkAgent::stop().

00060                                    {    // cancel!
00061                 if (status_ == TIMER_PENDING) {
00062                         _cancel();
00063                         status_ = TIMER_IDLE;
00064                 }
00065         }

Here is the call graph for this function:

void WebTrafSession::handle Event e  )  [private, virtual]
 

Reimplemented from TimerHandler.

Definition at line 191 of file webtraf.cc.

References curPage_, TimerHandler::handle(), interPageOption_, nPage_, rvInterPage_, TimerHandler::sched(), and RandomVariable::value().

00192 {
00193         // If I haven't scheduled all my pages, do the next one
00194         TimerHandler::handle(e);
00195         ++curPage_;
00196         // XXX Notice before each page is done, it will schedule itself 
00197         // one more time, this makes sure that this session will not be
00198         // deleted after the above call. Thus the following code will not
00199         // be executed in the context of a deleted object. 
00200         //
00201         // Polly Huang: Wed Nov 21 18:23:30 CET 2001
00202         // add inter-page time option
00203         // inter-page time = inter-page-start time
00204         // If the interPageOption_ is not set, the XXX Notice above applies.
00205         if (!interPageOption_) {
00206                 if (curPage_ < nPage_) {
00207                         sched(rvInterPage_->value());
00208                         // printf("schedule: %g %d %d\n", Scheduler::instance().clock(), donePage_, curPage_);
00209                 }
00210         }
00211 }

Here is the call graph for this function:

int WebTrafSession::id  )  const [inline]
 

Definition at line 66 of file webtraf.h.

References id_.

Referenced by WebPage::expire().

00066 { return id_; }

RandomVariable*& WebTrafSession::interObj  )  [inline]
 

Definition at line 61 of file webtraf.h.

References rvInterObj_.

Referenced by WebTrafPool::command(), and WebPage::handle().

00061 { return rvInterObj_; }

RandomVariable*& WebTrafSession::interPage  )  [inline]
 

Definition at line 59 of file webtraf.h.

References rvInterPage_.

Referenced by WebTrafPool::command().

00059 { return rvInterPage_; }

void WebTrafSession::launchReq void *  ClntData,
int  obj,
int  size
 

Definition at line 214 of file webtraf.cc.

References WebTrafPool::launchReq(), mgr_, and src_.

Referenced by WebPage::expire().

00214                                                                 {
00215         mgr_->launchReq(src_, ClntData, obj, size);
00216 }

Here is the call graph for this function:

WebTrafPool* WebTrafSession::mgr  )  [inline]
 

Definition at line 67 of file webtraf.h.

References mgr_.

Referenced by WebPage::expire().

00067 { return mgr_; }

RandomVariable*& WebTrafSession::objSize  )  [inline]
 

Definition at line 62 of file webtraf.h.

References rvObjSize_.

Referenced by WebTrafPool::command(), and WebPage::expire().

00062 { return rvObjSize_; }

RandomVariable*& WebTrafSession::pageSize  )  [inline]
 

Definition at line 60 of file webtraf.h.

References rvPageSize_.

Referenced by WebTrafPool::command().

00060 { return rvPageSize_; }

void TimerHandler::resched double  delay  )  [inherited]
 

Definition at line 60 of file timer-handler.cc.

References TimerHandler::_cancel(), TimerHandler::_sched(), TimerHandler::status_, and TimerHandler::TIMER_PENDING.

Referenced by UnslottedAlohaMac::backoff(), SinkAgent::bcast_interest(), PIQueue::calculate_p(), SMAC::collision(), MIPMHAgent::command(), MIPBSAgent::command(), GAFAgent::command(), SinkAgent::command(), LmsReceiver::create_nak(), GAFAgent::duty_timeout(), PacketTypeLog::expire(), QSTimer::expire(), OmniMcastSendBufTimer::expire(), OmniMcastArpBufferTimer::expire(), QATimer::expire(), PromotionTimer::expire(), SendBufferTimer::expire(), SendBufTimer::expire(), ArpBufferTimer::expire(), EnergyTimer::expire(), DiffusionRate::GradientTimeOut(), SatLinkHandoffMgr::handoff(), TermLinkHandoffMgr::handoff(), RapAgent::IpgTimeout(), RapAgent::LossHandler(), DiffusionRate::NegReinfTimeOut(), TfrcAgent::nextpkt(), TfrcSinkAgent::nextpkt(), RBPRenoTcpAgent::paced_send_one(), RBPVegasTcpAgent::paced_send_one(), QSNewRenoTcpAgent::paced_send_one(), PacketTypeLog::PacketTypeLog(), LandmarkAgent::periodic_callback(), LandmarkAgent::ProcessHierUpdate(), LogWebTrafPool::processLog(), PushbackQueue::PushbackQueue(), QSAgent::QSAgent(), RTPAgent::rate_change(), TfrcAgent::recv(), DelAckSink::recv(), FullTcpAgent::recv(), BayFullTcpAgent::recv(), TcpAsymSink::recv(), AbsDelAckSink::recv(), TBF::recv(), SMAC::recv(), SA_Agent::recv(), FtpClientAgent::recv(), TfrcAgent::reduce_rate_on_no_feedback(), MIPMHAgent::reg(), SinkAgent::report(), LivenessTimer::resched(), HBTimer::resched(), RapAgent::RttTimeout(), SmacCounterTimer::sched(), PushbackTimer::schedule(), WebServer::schedule_next_job(), GAFAgent::schedule_wakeup(), TcpFsAgent::send_helper(), TcpAsymAgent::send_helper(), TcpAgent::send_much(), TcpSessionAgent::send_much(), Sack1TcpAgent::send_much(), SackRHTcpAgent::send_much(), IntTcpAgent::send_much(), FullTcpAgent::send_much(), BayFullTcpAgent::send_much(), FackTcpAgent::send_much(), UnslottedAlohaMac::sendDown(), UnslottedAlohaMac::sendUp(), TcpAgent::set_rtx_timer(), TcpSessionAgent::set_rtx_timer(), TcpFsAgent::set_rtx_timer(), AbsTcpAgent::set_timer(), REMQueue::set_update_timer(), TrafficGenerator::start(), TfrcAgent::start(), RTPAgent::start(), RTCPAgent::start(), FtpClientAgent::start(), Estimator::start(), SinkAgent::start(), DiffusionRate::Start(), DiffusionProb::Start(), TrafficGenerator::timeout(), TrafficTrace::timeout(), TelnetApp::timeout(), FullTcpAgent::timeout(), BayFullTcpAgent::timeout(), TBF::timeout(), SA_Agent::timeout(), RTPAgent::timeout(), RTCPAgent::timeout(), PushbackQueue::timeout(), MIPMHAgent::timeout(), MIPBSAgent::timeout(), LmsReceiver::timeout(), GAFAgent::timeout(), EXPOO_Traffic::timeout(), Estimator::timeout(), SinkAgent::timeout(), CBR_PP_Traffic::timeout(), WirelessPhy::UpdateIdleEnergy(), SMAC::updateNav(), SMAC::updateNeighNav(), and WirelessPhy::WirelessPhy().

00061 {
00062         if (status_ == TIMER_PENDING)
00063                 _cancel();
00064         _sched(delay);
00065         status_ = TIMER_PENDING;
00066 }

Here is the call graph for this function:

void TimerHandler::sched double  delay  )  [inherited]
 

Reimplemented in SmacRecvTimer, SmacNeighNavTimer, and SmacCounterTimer.

Definition at line 49 of file timer-handler.cc.

References TimerHandler::_sched(), abort(), TimerHandler::status_, TimerHandler::TIMER_IDLE, and TimerHandler::TIMER_PENDING.

Referenced by SMAC::checkToSend(), WebTrafPool::command(), EmpWebTrafPool::command(), EmpFtpTrafPool::command(), DSRAgent::command(), EmpWebPage::doneObject(), donePage(), EmpWebTrafSession::donePage(), QA::get_data(), handle(), WebPage::handle(), EmpWebTrafSession::handle(), EmpWebPage::handle(), EmpFtpTrafSession::handle(), SMAC::handleCounterTimer(), LandmarkAgent::ProcessHierUpdate(), SmacCounterTimer::sched(), SmacNeighNavTimer::sched(), SmacRecvTimer::sched(), LivenessTimer::sched(), PushTimer::sched(), HBTimer::sched(), SMAC::sentDATA(), SMAC::sentRTS(), SMAC::SMAC(), TelnetApp::start(), OmniMcastAgent::Start(), DiffusionAgent::Start(), LandmarkAgent::startUp(), and SMAC::transmit().

00050 {
00051         if (status_ != TIMER_IDLE) {
00052                 fprintf(stderr,"Couldn't schedule timer");
00053                 abort();
00054         }
00055         _sched(delay);
00056         status_ = TIMER_PENDING;
00057 }

Here is the call graph for this function:

void WebTrafSession::set_interPageOption int  option  )  [inline]
 

Definition at line 68 of file webtraf.h.

References interPageOption_.

Referenced by WebTrafPool::command().

00068 { interPageOption_ = option; }

int TimerHandler::status  )  [inline, inherited]
 

Definition at line 67 of file timer-handler.h.

References TimerHandler::status_.

Referenced by TcpSessionAgent::add_pkts(), BayFullTcpAgent::cancel_rtx_timeout(), HttpMInvalCache::command(), FullTcpAgent::foutput(), QA::get_data(), TcpAgent::output(), VegasTcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), BayFullTcpAgent::output(), DelAckSink::recv(), FullTcpAgent::recv(), BayFullTcpAgent::recv(), TcpAsymSink::recv(), AbsDelAckSink::recv(), MIPMHAgent::recv(), DelAckSink::reset(), TcpAgent::send_much(), TcpSessionAgent::send_much(), Sack1TcpAgent::send_much(), SackRHTcpAgent::send_much(), IntTcpAgent::send_much(), FullTcpAgent::send_much(), BayFullTcpAgent::send_much(), FackTcpAgent::send_much(), TcpSessionAgent::set_rtx_timer(), TcpFsAgent::set_rtx_timer(), RapAgent::stop(), QA::stop(), and QA::~QA().

00067 { return status_; };


Member Data Documentation

int WebTrafSession::curPage_ [private]
 

Definition at line 79 of file webtraf.h.

Referenced by expire(), handle(), and ~WebTrafSession().

int WebTrafSession::donePage_ [private]
 

Definition at line 79 of file webtraf.h.

Referenced by donePage(), and ~WebTrafSession().

Event TimerHandler::event_ [protected, inherited]
 

Definition at line 75 of file timer-handler.h.

Referenced by TimerHandler::_cancel(), TimerHandler::_sched(), WebPage::start(), and EmpWebPage::start().

int WebTrafSession::fulltcp_ [private]
 

Definition at line 83 of file webtraf.h.

Referenced by WebTrafSession().

int WebTrafSession::id_ [private]
 

Definition at line 80 of file webtraf.h.

Referenced by donePage(), expire(), and id().

int WebTrafSession::interPageOption_ [private]
 

Definition at line 80 of file webtraf.h.

Referenced by donePage(), handle(), and set_interPageOption().

int WebTrafSession::LASTPAGE_ = 1 [static]
 

Definition at line 114 of file webtraf.cc.

Referenced by expire().

WebTrafPool* WebTrafSession::mgr_ [private]
 

Definition at line 77 of file webtraf.h.

Referenced by donePage(), expire(), launchReq(), and mgr().

int WebTrafSession::nPage_ [private]
 

Definition at line 79 of file webtraf.h.

Referenced by donePage(), and handle().

int WebTrafSession::recycle_page_ [private]
 

Definition at line 85 of file webtraf.h.

Referenced by WebTrafSession(), and ~WebTrafSession().

RandomVariable * WebTrafSession::rvInterObj_ [private]
 

Definition at line 76 of file webtraf.h.

Referenced by interObj(), and ~WebTrafSession().

RandomVariable* WebTrafSession::rvInterPage_ [private]
 

Definition at line 76 of file webtraf.h.

Referenced by donePage(), handle(), interPage(), and ~WebTrafSession().

RandomVariable * WebTrafSession::rvObjSize_ [private]
 

Definition at line 76 of file webtraf.h.

Referenced by objSize(), and ~WebTrafSession().

RandomVariable * WebTrafSession::rvPageSize_ [private]
 

Definition at line 76 of file webtraf.h.

Referenced by expire(), pageSize(), and ~WebTrafSession().

Node* WebTrafSession::src_ [private]
 

Definition at line 78 of file webtraf.h.

Referenced by launchReq().

int TimerHandler::status_ [protected, inherited]
 

Definition at line 74 of file timer-handler.h.

Referenced by SmacTimer::busy(), TimerHandler::cancel(), SmacCsTimer::checkToCancel(), TimerHandler::force_cancel(), TimerHandler::handle(), TimerHandler::resched(), TimerHandler::sched(), SmacCounterTimer::sched(), WebPage::start(), EmpWebPage::start(), TimerHandler::status(), TimerHandler::TimerHandler(), EmpFtpTrafSession::~EmpFtpTrafSession(), EmpWebTrafSession::~EmpWebTrafSession(), and ~WebTrafSession().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 13:35:56 2004 for NS2.26SourcesOriginal by doxygen 1.3.3