12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

not want to be bothered with the burden of tra<strong>ns</strong>mitting HTTP headers, etc. It has the following two major d<strong>at</strong>a structures.Details can be found in <strong>ns</strong>/webcache/webtraf.cc <strong>and</strong> <strong>ns</strong>/webcache/webtraf.h, the architecture WebTraf model is also looselydescribed in [10], Section 2.4, paragraph 3-4 <strong>and</strong> the appendix A.1.• WebTrafSession - a class th<strong>at</strong> models Web user session. It is defined as follows:class WebTrafSession : public TimerH<strong>and</strong>ler {public:WebTrafSession(WebTrafPool *mgr, Node *src, int np, int id) : rvInterPage_(NULL),rvPageSize_(NULL), rvInterObj_(NULL), rvObjSize_(NULL), mgr_(mgr), src_(src),nPage_(np), curPage_(0), donePage_(0), id_(id), interPageOption_(1) {}virtual ~WebTrafSession();// Queried by individual pages/objectsinline R<strong>and</strong>omVariable*& interPage() { return rvInterPage_; }inline R<strong>and</strong>omVariable*& pageSize() { return rvPageSize_; }inline R<strong>and</strong>omVariable*& interObj() { return rvInterObj_; }inline R<strong>and</strong>omVariable*& objSize() { return rvObjSize_; }void donePage(void* ClntD<strong>at</strong>a); // all the pages within this// session have been sentvoid launchReq(void* ClntD<strong>at</strong>a, int obj, int size);inline int id() co<strong>ns</strong>t { return id_; }inline WebTrafPool* mgr() { return mgr_; }priv<strong>at</strong>e:virtual void expire(Event *e = 0); // Lanuch request for a pagevirtual void h<strong>and</strong>le(Event *e); // schedule the timer for next page}R<strong>and</strong>omVariable *rvInterPage_, *rvPageSize_, *rvInterObj_, *rvObjSize_;WebTrafPool* mgr_;Node* src_; // One Web client (source of request) per sessionnt nPage_; // number of pages per sessionint curPage_; // number of pages th<strong>at</strong> have been sentint id_; // page IDint interPageOption_;• WebPage - a class th<strong>at</strong> models Web Page. It is defined as follows:class WebPage : public TimerH<strong>and</strong>ler {public:WebPage(int id, WebTrafSession* sess, int nObj, Node* dst) :id_(id), sess_(sess), nObj_(nObj), curObj_(0),doneObj_(0), dst_(dst) {}virtual ~WebPage() {}inline void start() { // Call expire() <strong>and</strong> schedule the next one if neededvoid doneObject() { // All the objects within this page have been sentinline int id() co<strong>ns</strong>t { return id_; }Node* dst() { return dst_; }inline int curObj() co<strong>ns</strong>t { return curObj_; }inline int doneObj() co<strong>ns</strong>t { return doneObj_; }priv<strong>at</strong>e:virtual void expire(Event* = 0) { // Launch request for an objectvirtual void h<strong>and</strong>le(Event *e) { // schedule the timer for the next object351

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!