• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/common/tpm.h

00001 /* -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
00002 
00003 /*
00004  * tpm.h
00005  * Copyright (C) 2001 by the University of Southern California
00006  * $Id: tpm.h,v 1.2 2005/08/25 18:58:03 johnh Exp $
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License,
00010  * version 2, as published by the Free Software Foundation.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License along
00018  * with this program; if not, write to the Free Software Foundation, Inc.,
00019  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00020  *
00021  *
00022  * The copyright of this module includes the following
00023  * linking-with-specific-other-licenses addition:
00024  *
00025  * In addition, as a special exception, the copyright holders of
00026  * this module give you permission to combine (via static or
00027  * dynamic linking) this module with free software programs or
00028  * libraries that are released under the GNU LGPL and with code
00029  * included in the standard release of ns-2 under the Apache 2.0
00030  * license or under otherwise-compatible licenses with advertising
00031  * requirements (or modified versions of such code, with unchanged
00032  * license).  You may copy and distribute such a system following the
00033  * terms of the GNU GPL for this module and the licenses of the
00034  * other code concerned, provided that you include the source code of
00035  * that other code when and as the GNU GPL requires distribution of
00036  * source code.
00037  *
00038  * Note that people who make modified versions of this module
00039  * are not obligated to grant this special exception for their
00040  * modified versions; it is their choice whether to do so.  The GNU
00041  * General Public License gives permission to release a modified
00042  * version without this exception; this exception also makes it
00043  * possible to release a modified version which carries forward this
00044  * exception.
00045  *
00046  */
00047 
00048 // Management function to playback TCPDump trace file (after post precssing)
00049 // Xuan Chen (xuanc@isi.edu)
00050 //
00051 #ifndef ns_tpm_h
00052 #define ns_tpm_h
00053 
00054 #include "tp.h"
00055 
00056 // Data structure for next packet
00057 struct nextp_s {
00058         int time;
00059         unsigned int saddr, daddr; 
00060         int sport, dport;
00061         int len;
00062 };
00063 
00064 class TPM;
00065 
00066 // Data structure for the timer to send requests
00067 class TPMTimer : public TimerHandler{
00068 public:
00069         TPMTimer(TPM*);
00070         
00071         virtual void expire(Event *e);
00072 
00073 private:
00074         TPM *tpm;
00075 };
00076 
00077 class TPM  : public TclObject {
00078 public: 
00079         TPM(); 
00080         virtual ~TPM(); 
00081 
00082         int run();
00083 protected:
00084         virtual int command(int argc, const char*const* argv);
00085 
00086 private:
00087         // handler to the http log file
00088         FILE* fp;
00089 
00090         double start_t;
00091         TPMTimer *timer;
00092         nextp_s next_p;
00093 
00094         int loadLog(const char*);
00095         int start();
00096         int genPkt(unsigned int, int, unsigned int, int, int);
00097         int processLog();
00098 
00099         TPAgent** tp;
00100         int tp_num_;
00101         int tp_default_;
00102 };
00103 
00104 
00105 #endif // ns_tpm_h

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