• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/diffusion3/ns/diffagent.h

00001 
00002 /*
00003  * Copyright (C) 2004-2005 by the University of Southern California
00004  * $Id: diffagent.h,v 1.12 2005/09/13 20:47:34 johnh Exp $
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License,
00008  * version 2, as published by the Free Software Foundation.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along
00016  * with this program; if not, write to the Free Software Foundation, Inc.,
00017  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00018  *
00019  *
00020  * The copyright of this module includes the following
00021  * linking-with-specific-other-licenses addition:
00022  *
00023  * In addition, as a special exception, the copyright holders of
00024  * this module give you permission to combine (via static or
00025  * dynamic linking) this module with free software programs or
00026  * libraries that are released under the GNU LGPL and with code
00027  * included in the standard release of ns-2 under the Apache 2.0
00028  * license or under otherwise-compatible licenses with advertising
00029  * requirements (or modified versions of such code, with unchanged
00030  * license).  You may copy and distribute such a system following the
00031  * terms of the GNU GPL for this module and the licenses of the
00032  * other code concerned, provided that you include the source code of
00033  * that other code when and as the GNU GPL requires distribution of
00034  * source code.
00035  *
00036  * Note that people who make modified versions of this module
00037  * are not obligated to grant this special exception for their
00038  * modified versions; it is their choice whether to do so.  The GNU
00039  * General Public License gives permission to release a modified
00040  * version without this exception; this exception also makes it
00041  * possible to release a modified version which carries forward this
00042  * exception.
00043  *
00044  */
00045 
00046 // DiffAppAgent - Wrapper Class for diffusion transport agent DR, ported from SCADDS's directed diffusion software. --Padma, nov 2001.  
00047 
00048 #ifdef NS_DIFFUSION
00049 
00050 #ifndef NS_DIFFAGENT
00051 #define NS_DIFFAGENT
00052 
00053 #include <stdlib.h>
00054 #include <tclcl.h>
00055 #include <agent.h>
00056 #include <flags.h>
00057 #include <mobilenode.h>
00058 #include <dr.hh>
00059 
00060 class DiffAppAgent;
00061 
00062 class NsLocal : public DiffusionIO {
00063 public:
00064         NsLocal(DiffAppAgent *agent) { agent_ = agent;}
00065         ~NsLocal() {};
00066         DiffPacket recvPacket(int fd);
00067         void sendPacket(DiffPacket p, int len, int dst);
00068 protected:
00069         DiffAppAgent *agent_;
00070 };
00071 
00072 class DiffAppAgent : public Agent {
00073 public:
00074   
00075         DiffAppAgent();
00076         int command(int argc, const char*const* argv);
00077         void initpkt(Packet *p, Message* msg, int len);
00078         Packet* createNsPkt(Message *msg, int len);     
00079         void recv(Packet*, Handler*);
00080         void sendPacket(DiffPacket msg, int len, int dst);
00081         
00082         NR *dr() {return dr_; }
00083   
00084 protected:
00085         
00086         // diffusion transport agent or DR
00087         NR *dr_;
00088         
00089 };
00090 
00091 #endif //diffagent
00092 #endif // NS

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