IBR-DTNSuite  0.10
RoutingExtension.h
Go to the documentation of this file.
1 /*
2  * RoutingExtension.h
3  *
4  * Copyright (C) 2013 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 ROUTINGEXTENSION_H_
23 #define ROUTINGEXTENSION_H_
24 
26 #include "routing/NodeHandshake.h"
27 #include "core/Event.h"
28 #include <ibrdtn/data/BundleID.h>
29 #include <ibrdtn/data/EID.h>
30 
31 namespace dtn
32 {
33  namespace routing
34  {
35  class BaseRouter;
36 
38  {
39  static const std::string TAG;
40 
41  public:
43  virtual ~RoutingExtension() = 0;
44 
45  virtual void notify(const dtn::core::Event *evt) throw () = 0;
46  virtual void componentUp() throw () = 0;
47  virtual void componentDown() throw () = 0;
48 
50  {
55  };
56 
63  virtual void requestHandshake(const dtn::data::EID&, NodeHandshake&) const { };
64 
72  virtual void responseHandshake(const dtn::data::EID&, const NodeHandshake&, NodeHandshake&) { };
73 
79  virtual void processHandshake(const dtn::data::EID&, NodeHandshake&) { };
80 
87  void transferTo(const dtn::data::EID &destination, const dtn::data::MetaBundle &meta);
88 
94  static bool isRouting(const dtn::data::EID &eid);
95 
96  protected:
98 
99  private:
100  friend class BaseRouter;
101  static BaseRouter *_router;
102  };
103  } /* namespace routing */
104 } /* namespace dtn */
105 #endif /* ROUTINGEXTENSION_H_ */