• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/sensor-nets/flood-agent.h

00001 // Author: Satish Kumar, kkumar@isi.edu
00002 
00003 #ifndef flood_agent_h_
00004 #define flood_agent_h_
00005 
00006 #include <agent.h>
00007 #include <ip.h>
00008 #include <delay.h>
00009 #include <scheduler.h>
00010 #include <queue.h>
00011 #include <trace.h>
00012 #include <arp.h>
00013 #include <ll.h>
00014 #include <mac.h>
00015 #include <priqueue.h>
00016 #include <mobilenode.h>
00017 #include "tags.h"
00018 #include "landmark.h"
00019 
00020 typedef double Time;
00021 
00022 
00023 class QueryList {
00024 public:
00025   QueryList() {
00026     next_ = NULL;
00027   }
00028   nsaddr_t src_;
00029   int obj_name_;
00030   int origin_time_;
00031   int num_hops_;
00032   nsaddr_t last_hop_id_;
00033   QueryList *next_;
00034 };
00035 
00036 
00037 
00038 
00039 class FloodAgent : public Agent {
00040 public:
00041   FloodAgent();
00042   virtual int command(int argc, const char * const * argv);
00043   
00044 protected:
00045   //  RoutingTable *table_;     // Routing Table
00046 
00047   void startUp();           // Starts off the hierarchy construction protocol
00048   int seqno_;               // Sequence number to advertise with...
00049   int myaddr_;              // My address...
00050 
00051   // Periodic advertisements stuff                              
00052 
00053   void periodic_callback(Event *e, int level); // method to send periodic advts
00054   
00055   PriQueue *ll_queue;       // link level output queue
00056 
00057   void recv(Packet *p, Handler *);
00058 
00059   // Tracing stuff
00060   void trace(char* fmt,...);       
00061   Trace *tracetarget_;  // Trace target
00062 
00063   // Pointer to global tag database
00064   tags_database *tag_dbase_;
00065   // Local tag list
00066   compr_taglist *tag_list_;
00067 
00068   // Method returns 1 if query seen before. Otherwise returns 0
00069   // and adds query info to the list
00070   QueryList *query_list_;
00071   int search_queries_list(nsaddr_t src, int obj_name, int origin_time, int num_hops, nsaddr_t last_hop_id);
00072 
00073   nsaddr_t get_next_hop(nsaddr_t src, int obj_name, int origin_time);
00074 
00075   // Mobile node to which agent is attached; Used to get position information
00076   MobileNode *node_;
00077 
00078   // Debug flag
00079   int debug_;     
00080 
00081   // Tag cache info
00082   int cache_;      // set to 1 to enable caching
00083   TagCache *tag_cache_;
00084   int num_cached_items_;
00085 };
00086 
00087 
00088 
00089 #endif

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