• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/empweb/persconn.h

00001 #ifndef ns_conpers_h
00002 #define ns_conpers_h
00003 
00004 #include <stdio.h>
00005 #include <limits.h>
00006 #include <tcl.h>
00007 #include <ranvar.h>
00008 #include <tclcl.h>
00009 #include "config.h"
00010 
00011 #define IDLE 0
00012 #define INUSE 1
00013 #define NONPERSIST 0
00014 #define PERSIST 1
00015 
00016 
00017 // Abstract page pool, used for interface only
00018 class PagePool : public TclObject {
00019 public: 
00020         PagePool() : num_pages_(0), start_time_(INT_MAX), end_time_(INT_MIN) {}
00021         int num_pages() const { return num_pages_; }
00022 protected:
00023         virtual int command(int argc, const char*const* argv);
00024         int num_pages_;
00025         double start_time_;
00026         double end_time_;
00027         int duration_;
00028 
00029         // Helper functions
00030         TclObject* lookup_obj(const char* name) {
00031                 TclObject* obj = Tcl::instance().lookup(name);
00032                 if (obj == NULL) 
00033                         fprintf(stderr, "Bad object name %s\n", name);
00034                 return obj;
00035         }
00036 };
00037 
00038 class PersConn : public TclObject {
00039 public: 
00040 //      PersConn() : status_(IDLE), pendingReqByte_(0), pendingReplyByte_(0), ctcp_(NULL), csnk_(NULL), client_(NULL), server_(NULL) {}
00041         PersConn() :  ctcp_(NULL), csnk_(NULL), client_(NULL), server_(NULL) {}
00042 //      inline int getStatus() { return status_ ;}
00043 //      inline void setStatus(int s) { status_ = s ;}
00044         inline void setDst(int d) { dst_ = d ;}
00045         inline void setSrc(int s) { src_ = s ;}
00046         inline int getDst() { return dst_ ;}
00047         inline int getSrc() { return src_ ;}
00048         inline TcpAgent* getCTcpAgent() { return ctcp_ ;}
00049         inline TcpSink* getCTcpSink() { return csnk_ ;}
00050         inline TcpAgent* getSTcpAgent() { return stcp_ ;}
00051         inline TcpSink* getSTcpSink() { return ssnk_ ;}
00052         inline Node* getCNode() { return client_ ;}
00053         inline Node* getSNode() { return server_ ;}
00054         inline void setCTcpAgent(TcpAgent* c) { ctcp_ = c;}
00055         inline void setCTcpSink(TcpSink* c) { csnk_ = c;}
00056         inline void setSTcpAgent(TcpAgent* s) { stcp_ = s;}
00057         inline void setSTcpSink(TcpSink* s) { ssnk_ = s;}
00058         inline void setCNode(Node* c) { client_ = c;}
00059         inline void setSNode(Node* s) { server_ = s;}
00060 
00061 //        int pendingReqByte_ ;
00062 //        int pendingReplyByte_ ;
00063 
00064 protected:
00065 //      int status_ ;
00066         int src_ ;
00067         int dst_ ;
00068         TcpAgent* ctcp_ ;
00069         TcpSink* csnk_ ;
00070         TcpAgent* stcp_ ;
00071         TcpSink* ssnk_ ;
00072         Node* client_ ;
00073         Node* server_ ;
00074 
00075 };
00076 
00077 #endif //ns_conpers_h

Generated on Tue Aug 10 2010 16:16:07 for ns-2.33 by  doxygen 1.7.1