IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
FileConvergenceLayer.h
Go to the documentation of this file.
1
/*
2
* FileConvergenceLayer.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
#include "
Component.h
"
23
#include "
net/ConvergenceLayer.h
"
24
#include "
core/Node.h
"
25
#include "
core/EventReceiver.h
"
26
#include <
ibrdtn/data/BundleList.h
>
27
#include <
ibrcommon/thread/Mutex.h
>
28
#include <
ibrcommon/thread/Queue.h
>
29
30
#ifndef FILECONVERGENCELAYER_H_
31
#define FILECONVERGENCELAYER_H_
32
33
namespace
dtn
34
{
35
namespace
net
36
{
37
38
class
FileConvergenceLayer
:
public
dtn::net::ConvergenceLayer
,
public
dtn::daemon::IndependentComponent
,
public
dtn::core::EventReceiver
39
{
40
public
:
41
FileConvergenceLayer
();
42
virtual
~FileConvergenceLayer
();
43
44
void
raiseEvent
(
const
dtn::core::Event
*evt)
throw
();
45
46
dtn::core::Node::Protocol
getDiscoveryProtocol
()
const
;
47
48
void
open
(
const
dtn::core::Node
&);
49
void
queue
(
const
dtn::core::Node
&n,
const
dtn::net::BundleTransfer
&job);
50
51
const
std::string
getName
()
const
;
52
53
protected
:
54
void
componentUp
()
throw
();
55
void
componentRun
()
throw
();
56
void
componentDown
()
throw
();
57
58
void
__cancellation
()
throw
();
59
60
private
:
61
class
Task
62
{
63
public
:
64
enum
Action
65
{
66
TASK_LOAD,
67
TASK_STORE
68
};
69
70
Task(Action a,
const
dtn::core::Node
&n);
71
virtual
~Task();
72
73
const
Action action;
74
const
dtn::core::Node
node;
75
};
76
77
class
StoreBundleTask :
public
Task
78
{
79
public
:
80
StoreBundleTask(
const
dtn::core::Node
&n,
const
dtn::net::BundleTransfer
&j);
81
virtual
~StoreBundleTask();
82
83
dtn::net::BundleTransfer
job;
84
};
85
86
void
replyHandshake(
const
dtn::data::Bundle
&bundle, std::list<dtn::data::MetaBundle>&);
87
88
ibrcommon::Mutex
_blacklist_mutex;
89
dtn::data::BundleList
_blacklist;
90
ibrcommon::Queue<Task*>
_tasks;
91
92
static
ibrcommon::File
getPath(
const
dtn::core::Node
&);
93
static
std::list<dtn::data::MetaBundle> scan(
const
ibrcommon::File
&path);
94
static
void
load(
const
dtn::core::Node
&);
95
96
};
97
98
}
/* namespace net */
99
}
/* namespace dtn */
100
#endif
/* FILECONVERGENCELAYER_H_ */
daemon
src
net
FileConvergenceLayer.h
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4