IBR-DTNSuite  0.12
EpidemicRoutingExtension.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 EPIDEMICROUTINGEXTENSION_H_
23 #define EPIDEMICROUTINGEXTENSION_H_
24 
25 #include "core/Node.h"
26 #include "core/AbstractWorker.h"
27 #include "core/EventReceiver.h"
28 
31 
32 #include <ibrdtn/data/Block.h>
33 #include <ibrdtn/data/SDNV.h>
36 
37 #include <ibrcommon/thread/Queue.h>
39 
40 #include <list>
41 #include <queue>
42 
43 namespace dtn
44 {
45  namespace routing
46  {
48  {
49  static const std::string TAG;
50 
51  public:
53  virtual ~EpidemicRoutingExtension();
54 
55  virtual void eventDataChanged(const dtn::data::EID &peer) throw ();
56 
57  virtual void eventBundleQueued(const dtn::data::EID &peer, const dtn::data::MetaBundle &meta) throw ();
58 
59  void raiseEvent(const dtn::core::Event *evt) throw ();
60  void componentUp() throw ();
61  void componentDown() throw ();
62 
66  virtual void requestHandshake(const dtn::data::EID&, NodeHandshake&) const;
67 
68  protected:
69  void run() throw ();
70  void __cancellation() throw ();
71 
72  private:
73  class Task
74  {
75  public:
76  virtual ~Task() {};
77  virtual std::string toString() = 0;
78  };
79 
80  class SearchNextBundleTask : public Task
81  {
82  public:
83  SearchNextBundleTask(const dtn::data::EID &eid);
84  virtual ~SearchNextBundleTask();
85 
86  virtual std::string toString();
87 
88  const dtn::data::EID eid;
89  };
90 
95  };
96  }
97 }
98 
99 #endif /* EPIDEMICROUTINGEXTENSION_H_ */