File: flood-agent.h

package info (click to toggle)
ns2 2.35%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 78,780 kB
  • ctags: 27,490
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 816; awk: 525; csh: 355
file content (89 lines) | stat: -rw-r--r-- 1,921 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Author: Satish Kumar, kkumar@isi.edu

#ifndef flood_agent_h_
#define flood_agent_h_

#include <agent.h>
#include <ip.h>
#include <delay.h>
#include <scheduler.h>
#include <queue.h>
#include <trace.h>
#include <arp.h>
#include <ll.h>
#include <mac.h>
#include <priqueue.h>
#include <mobilenode.h>
#include "tags.h"
#include "landmark.h"

typedef double Time;


class QueryList {
public:
  QueryList() {
    next_ = NULL;
  }
  nsaddr_t src_;
  int obj_name_;
  int origin_time_;
  int num_hops_;
  nsaddr_t last_hop_id_;
  QueryList *next_;
};




class FloodAgent : public Agent {
public:
  FloodAgent();
  virtual int command(int argc, const char * const * argv);
  
protected:
  //  RoutingTable *table_;     // Routing Table

  void startUp();           // Starts off the hierarchy construction protocol
  int seqno_;               // Sequence number to advertise with...
  int myaddr_;              // My address...

  // Periodic advertisements stuff				

  void periodic_callback(Event *e, int level); // method to send periodic advts
  
  PriQueue *ll_queue;       // link level output queue

  void recv(Packet *p, Handler *);

  // Tracing stuff
  void trace(char* fmt,...);       
  Trace *tracetarget_;  // Trace target

  // Pointer to global tag database
  tags_database *tag_dbase_;
  // Local tag list
  compr_taglist *tag_list_;

  // Method returns 1 if query seen before. Otherwise returns 0
  // and adds query info to the list
  QueryList *query_list_;
  int search_queries_list(nsaddr_t src, int obj_name, int origin_time, int num_hops, nsaddr_t last_hop_id);

  nsaddr_t get_next_hop(nsaddr_t src, int obj_name, int origin_time);

  // Mobile node to which agent is attached; Used to get position information
  MobileNode *node_;

  // Debug flag
  int debug_;	  

  // Tag cache info
  int cache_;      // set to 1 to enable caching
  TagCache *tag_cache_;
  int num_cached_items_;
};



#endif