IBR-DTN  1.0.0
FloodRoutingExtension.h
Go to the documentation of this file.
1 /*
2  * EpidemicRoutingExtension.h
3  *
4  * Copyright (C) 2011 IBR, TU Braunschweig
5  *
6  * Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 
22 #ifndef FLOODROUTINGEXTENSION_H_
23 #define FLOODROUTINGEXTENSION_H_
24 
25 #include "core/Node.h"
26 
29 
30 #include <ibrdtn/data/Block.h>
31 #include <ibrdtn/data/SDNV.h>
33 
34 #include <ibrcommon/thread/Queue.h>
35 
36 #include <list>
37 #include <queue>
38 
39 namespace dtn
40 {
41  namespace routing
42  {
43  class FloodRoutingExtension : public RoutingExtension, public ibrcommon::JoinableThread
44  {
45  static const std::string TAG;
46 
47  public:
49  virtual ~FloodRoutingExtension();
50 
51  virtual const std::string getTag() const throw ();
52 
53  virtual void eventDataChanged(const dtn::data::EID &peer) throw ();
54 
55  virtual void eventBundleQueued(const dtn::data::EID &peer, const dtn::data::MetaBundle &meta) throw ();
56 
57  void componentUp() throw ();
58  void componentDown() throw ();
59 
60  protected:
61  void run() throw ();
62  void __cancellation() throw ();
63 
64  private:
65  class Task
66  {
67  public:
68  virtual ~Task() {};
69  virtual std::string toString() = 0;
70  };
71 
72  class SearchNextBundleTask : public Task
73  {
74  public:
75  SearchNextBundleTask(const dtn::data::EID &eid);
76  virtual ~SearchNextBundleTask();
77 
78  virtual std::string toString();
79 
80  const dtn::data::EID eid;
81  };
82 
86  ibrcommon::Queue<FloodRoutingExtension::Task* > _taskqueue;
87  };
88  }
89 }
90 
91 #endif /* EPIDEMICROUTINGEXTENSION_H_ */
virtual void eventDataChanged(const dtn::data::EID &peer)
virtual const std::string getTag() const
virtual void eventBundleQueued(const dtn::data::EID &peer, const dtn::data::MetaBundle &meta)