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
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
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
00041 PersConn() : ctcp_(NULL), csnk_(NULL), client_(NULL), server_(NULL) {}
00042
00043
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
00062
00063
00064 protected:
00065
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