IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
src
api
core
AbstractWorker.cpp
AbstractWorker.h
BundleCore.cpp
BundleCore.h
BundleEvent.cpp
BundleEvent.h
BundleExpiredEvent.cpp
BundleExpiredEvent.h
BundleGeneratedEvent.cpp
BundleGeneratedEvent.h
BundlePurgeEvent.cpp
BundlePurgeEvent.h
CustodyEvent.cpp
CustodyEvent.h
Event.cpp
Event.h
EventDebugger.cpp
EventDebugger.h
EventDispatcher.h
EventReceiver.cpp
EventReceiver.h
EventSwitch.cpp
EventSwitch.h
FragmentManager.cpp
FragmentManager.h
GlobalEvent.cpp
GlobalEvent.h
Node.cpp
Node.h
NodeEvent.cpp
NodeEvent.h
StatusReportGenerator.cpp
StatusReportGenerator.h
TimeAdjustmentEvent.cpp
TimeAdjustmentEvent.h
TimeEvent.cpp
TimeEvent.h
WallClock.cpp
WallClock.h
net
routing
security
storage
CapsuleWorker.cpp
CapsuleWorker.h
Component.cpp
Component.h
config.h
Configuration.cpp
Configuration.h
Debugger.cpp
Debugger.h
DevNull.cpp
DevNull.h
DTNTPWorker.cpp
DTNTPWorker.h
EchoWorker.cpp
EchoWorker.h
Main.cpp
NativeDaemon.cpp
NativeDaemon.h
NTService.cpp
ibrcommon
ibrdtn
tools
File Members
FragmentManager.h
Go to the documentation of this file.
1
/*
2
* FragmentManager.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 FRAGMENTMANAGER_H_
23
#define FRAGMENTMANAGER_H_
24
25
#include "
Component.h
"
26
#include "
core/EventReceiver.h
"
27
#include "
storage/BundleResult.h
"
28
#include <
ibrdtn/data/MetaBundle.h
>
29
#include <
ibrcommon/thread/Queue.h
>
30
#include <
ibrcommon/thread/Mutex.h
>
31
#include <list>
32
#include <set>
33
34
namespace
dtn
35
{
36
namespace
core
37
{
38
class
FragmentationAbortedException
:
public
ibrcommon::Exception
39
{
40
public
:
41
FragmentationAbortedException
(
string
what
=
"Fragmentation aborted."
) throw() : ibrcommon::
Exception
(
what
)
42
{
43
}
44
};
45
46
class
FragmentationProhibitedException
:
public
FragmentationAbortedException
47
{
48
public
:
49
FragmentationProhibitedException
(
string
what
=
"Fragmentation is prohibited."
) throw() :
FragmentationAbortedException
(
what
)
50
{
51
}
52
};
53
54
class
FragmentationNotNecessaryException
:
public
FragmentationAbortedException
55
{
56
public
:
57
FragmentationNotNecessaryException
(
string
what
=
"Fragmentation is not necessary."
) throw() :
FragmentationAbortedException
(
what
)
58
{
59
}
60
};
61
62
class
FragmentManager
:
public
dtn::daemon::IndependentComponent
,
public
dtn::core::EventReceiver
63
{
64
static
const
std::string TAG;
65
66
public
:
67
FragmentManager
();
68
virtual
~FragmentManager
();
69
70
void
signal
(
const
dtn::data::MetaBundle
&meta);
71
72
void
__cancellation
()
throw
();
73
74
void
componentUp
()
throw
();
75
void
componentRun
()
throw
();
76
void
componentDown
()
throw
();
77
78
void
raiseEvent
(
const
dtn::core::Event
*evt)
throw
();
79
80
const
std::string
getName
()
const
;
81
88
static
void
setOffset
(
const
dtn::data::EID
&peer,
const
dtn::data::BundleID
&
id
,
const
dtn::data::Length
&abs_offset,
const
dtn::data::Length
&frag_offset)
throw
();
89
96
static
dtn::data::Length
getOffset
(
const
dtn::data::EID
&peer,
const
dtn::data::BundleID
&
id
)
throw
();
97
104
static
void
split
(
const
dtn::data::Bundle
&bundle,
const
dtn::data::Length
&maxPayloadLength, std::list<dtn::data::Bundle> &fragments)
throw
(
FragmentationAbortedException
);
105
106
private
:
107
class
Transmission
108
{
109
public
:
110
Transmission();
111
virtual
~Transmission();
112
113
bool
operator<(
const
Transmission &other)
const
;
114
bool
operator==
(
const
Transmission &other)
const
;
115
116
dtn::data::EID
peer;
117
dtn::data::BundleID
id;
118
dtn::data::Length
offset;
119
dtn::data::Timestamp
expires;
120
};
121
122
static
void
expire_offsets(
const
dtn::data::Timestamp
×tamp);
123
static
dtn::data::Length
get_payload_offset(
const
dtn::data::Bundle
&bundle,
const
dtn::data::Length
&abs_offset,
const
dtn::data::Length
&frag_offset)
throw
();
124
133
static
void
addBlocksFromBundleToFragment(
const
dtn::data::Bundle
&bundle,
dtn::data::Bundle
&fragment,
dtn::data::PayloadBlock
&fragment_payloadBlock,
bool
isFirstFragment,
bool
isLastFragment);
134
135
// search for similar bundles in the storage
136
void
search(
const
dtn::data::MetaBundle
&meta,
dtn::storage::BundleResult
&list);
137
138
ibrcommon::Queue<dtn::data::MetaBundle>
_incoming;
139
bool
_running;
140
141
static
ibrcommon::Mutex
_offsets_mutex;
142
static
std::set<Transmission> _offsets;
143
};
144
}
/* namespace core */
145
}
/* namespace dtn */
146
#endif
/* FRAGMENTMANAGER_H_ */
daemon
src
core
FragmentManager.h
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4