IBR-DTNSuite  0.10
NeighborRoutingExtension.h
Go to the documentation of this file.
1 /*
2  * NeighborRoutingExtension.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 NEIGHBORROUTINGEXTENSION_H_
23 #define NEIGHBORROUTINGEXTENSION_H_
24 
27 #include "core/Node.h"
28 
29 #include <ibrdtn/data/MetaBundle.h>
30 #include "ibrdtn/data/EID.h"
31 #include <ibrcommon/thread/Queue.h>
32 #include <list>
33 #include <map>
34 #include <queue>
35 
36 namespace dtn
37 {
38  namespace routing
39  {
41  {
42  static const std::string TAG;
43 
44  public:
46  virtual ~NeighborRoutingExtension();
47 
48  void notify(const dtn::core::Event *evt) throw ();
49  void componentUp() throw ();
50  void componentDown() throw ();
51 
52  protected:
53  void run() throw ();
54  void __cancellation() throw ();
55 
56  private:
57  class Task
58  {
59  public:
60  virtual ~Task() {};
61  virtual std::string toString() = 0;
62  };
63 
64  class SearchNextBundleTask : public Task
65  {
66  public:
67  SearchNextBundleTask(const dtn::data::EID &eid);
68  virtual ~SearchNextBundleTask();
69 
70  virtual std::string toString();
71 
72  const dtn::data::EID eid;
73  };
74 
75  class ProcessBundleTask : public Task
76  {
77  public:
78  ProcessBundleTask(const dtn::data::MetaBundle &meta, const dtn::data::EID &origin, const dtn::data::EID &nexthop);
79  virtual ~ProcessBundleTask();
80 
81  virtual std::string toString();
82 
83  const dtn::data::MetaBundle bundle;
84  const dtn::data::EID origin;
85  const dtn::data::EID nexthop;
86  };
87 
88  bool shouldRouteTo(const dtn::data::MetaBundle &meta, const NeighborDatabase::NeighborEntry &n) const;
89 
94  };
95  }
96 }
97 
98 #endif /* NEIGHBORROUTINGEXTENSION_H_ */