IBR-DTNSuite
0.10
Main Page
Namespaces
Classes
Files
File List
File Members
StaticRoutingExtension.h
Go to the documentation of this file.
1
/*
2
* StaticRoutingExension.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 STATICROUTINGEXTENSION_H_
23
#define STATICROUTINGEXTENSION_H_
24
25
#include "
routing/StaticRoute.h
"
26
#include "
routing/RoutingExtension.h
"
27
#include <
ibrdtn/data/MetaBundle.h
>
28
#include <
ibrcommon/thread/Queue.h
>
29
#include <
ibrcommon/thread/Mutex.h
>
30
31
namespace
dtn
32
{
33
namespace
routing
34
{
35
class
StaticRoutingExtension
:
public
RoutingExtension
,
public
ibrcommon::JoinableThread
36
{
37
static
const
std::string TAG;
38
39
public
:
40
StaticRoutingExtension
();
41
virtual
~StaticRoutingExtension
();
42
43
void
notify
(
const
dtn::core::Event
*evt)
throw
();
44
void
componentUp
()
throw
();
45
void
componentDown
()
throw
();
46
47
protected
:
48
void
run
()
throw
();
49
void
__cancellation
()
throw
();
50
51
private
:
52
class
EIDRoute :
public
StaticRoute
53
{
54
public
:
55
EIDRoute(
const
dtn::data::EID
&match,
const
dtn::data::EID
&nexthop,
const
dtn::data::Timestamp
&expiretime = 0);
56
virtual
~EIDRoute();
57
58
bool
match(
const
dtn::data::EID
&eid)
const
;
59
const
dtn::data::EID
& getDestination()
const
;
60
65
const
std::string toString()
const
;
66
67
const
dtn::data::Timestamp
& getExpiration()
const
;
68
69
private
:
70
const
dtn::data::EID
_nexthop;
71
const
dtn::data::EID
_match;
72
const
dtn::data::Timestamp
expiretime;
73
};
74
75
class
Task
76
{
77
public
:
78
virtual
~Task() {};
79
virtual
std::string toString() = 0;
80
};
81
82
class
SearchNextBundleTask :
public
Task
83
{
84
public
:
85
SearchNextBundleTask(
const
dtn::data::EID
&eid);
86
virtual
~SearchNextBundleTask();
87
88
virtual
std::string toString();
89
90
const
dtn::data::EID
eid;
91
};
92
93
class
ProcessBundleTask :
public
Task
94
{
95
public
:
96
ProcessBundleTask(
const
dtn::data::MetaBundle
&meta,
const
dtn::data::EID
&origin);
97
virtual
~ProcessBundleTask();
98
99
virtual
std::string toString();
100
101
const
dtn::data::MetaBundle
bundle;
102
const
dtn::data::EID
origin;
103
};
104
105
class
ClearRoutesTask :
public
Task
106
{
107
public
:
108
ClearRoutesTask();
109
virtual
~ClearRoutesTask();
110
virtual
std::string toString();
111
};
112
113
class
RouteChangeTask :
public
Task
114
{
115
public
:
116
enum
CHANGE_TYPE
117
{
118
ROUTE_ADD = 0,
119
ROUTE_DEL = 1
120
};
121
122
RouteChangeTask(CHANGE_TYPE type,
StaticRoute
*route);
123
virtual
~RouteChangeTask();
124
125
virtual
std::string toString();
126
127
CHANGE_TYPE type;
128
StaticRoute
*route;
129
};
130
131
class
ExpireTask :
public
Task
132
{
133
public
:
134
ExpireTask(
dtn::data::Timestamp
timestamp);
135
virtual
~ExpireTask();
136
137
virtual
std::string toString();
138
139
dtn::data::Timestamp
timestamp;
140
};
141
145
ibrcommon::Queue<StaticRoutingExtension::Task* >
_taskqueue;
146
150
std::list<StaticRoute*> _routes;
151
ibrcommon::Mutex
_expire_lock;
152
dtn::data::Timestamp
next_expire;
153
};
154
}
155
}
156
157
#endif
/* STATICROUTINGEXTENSION_H_ */
daemon
src
routing
StaticRoutingExtension.h
Generated on Mon Jul 22 2013 15:16:00 for IBR-DTNSuite by
1.8.3.1