IBR-DTNSuite
0.10
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
src
api
core
net
BundleReceivedEvent.cpp
BundleReceivedEvent.h
BundleReceiver.h
BundleTransfer.cpp
BundleTransfer.h
ConnectionEvent.cpp
ConnectionEvent.h
ConnectionManager.cpp
ConnectionManager.h
ConvergenceLayer.cpp
ConvergenceLayer.h
DatagramConnection.cpp
DatagramConnection.h
DatagramConvergenceLayer.cpp
DatagramConvergenceLayer.h
DatagramService.cpp
DatagramService.h
DHTNameService.cpp
DHTNameService.h
DiscoveryAgent.cpp
DiscoveryAgent.h
DiscoveryAnnouncement.cpp
DiscoveryAnnouncement.h
DiscoveryService.cpp
DiscoveryService.h
DiscoveryServiceProvider.h
FileConvergenceLayer.cpp
FileConvergenceLayer.h
FileMonitor.cpp
FileMonitor.h
HTTPConvergenceLayer.cpp
HTTPConvergenceLayer.h
IPNDAgent.cpp
IPNDAgent.h
LOWPANConnection.cpp
LOWPANConnection.h
LOWPANConvergenceLayer.cpp
LOWPANConvergenceLayer.h
LOWPANDatagramService.cpp
LOWPANDatagramService.h
NativeP2pManager.cpp
NativeP2pManager.h
Neighbor.cpp
Neighbor.h
P2PDialupEvent.cpp
P2PDialupEvent.h
P2PDialupExtension.cpp
P2PDialupExtension.h
TCPConnection.cpp
TCPConnection.h
TCPConvergenceLayer.cpp
TCPConvergenceLayer.h
TransferAbortedEvent.cpp
TransferAbortedEvent.h
TransferCompletedEvent.cpp
TransferCompletedEvent.h
UDPConvergenceLayer.cpp
UDPConvergenceLayer.h
UDPDatagramService.cpp
UDPDatagramService.h
WifiP2PManager.cpp
WifiP2PManager.h
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
ibrcommon
ibrdtn
tools
File Members
FileMonitor.h
Go to the documentation of this file.
1
/*
2
* FileMonitor.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 "
core/Node.h
"
24
#include <
ibrcommon/data/File.h
>
25
#include <
ibrcommon/net/vsocket.h
>
26
#include <
ibrcommon/net/socket.h
>
27
#include <map>
28
29
#ifndef FILEMONITOR_H_
30
#define FILEMONITOR_H_
31
32
namespace
dtn
33
{
34
namespace
net
35
{
36
class
inotifysocket
:
ibrcommon::basesocket
37
{
38
public
:
39
inotifysocket
();
40
virtual
~inotifysocket
();
41
42
virtual
void
up
()
throw
(
ibrcommon::socket_exception
);
43
virtual
void
down
()
throw
(
ibrcommon::socket_exception
);
44
45
void
watch
(
const
ibrcommon::File
&path,
int
opts)
throw
(
ibrcommon::socket_exception
);
46
47
ssize_t
read
(
char
*data,
size_t
len)
throw
(
ibrcommon::socket_exception
);
48
49
private
:
50
51
typedef
std::map<int, ibrcommon::File> watch_map;
52
watch_map _watch_map;
53
};
54
55
class
FileMonitor
:
public
dtn::daemon::IndependentComponent
56
{
57
public
:
58
FileMonitor
();
59
virtual
~FileMonitor
();
60
61
void
watch
(
const
ibrcommon::File
&
watch
);
62
63
const
std::string
getName
()
const
;
64
65
protected
:
66
void
componentUp
()
throw
();
67
void
componentRun
()
throw
();
68
void
componentDown
()
throw
();
69
70
void
__cancellation
()
throw
();
71
72
private
:
73
void
scan();
74
bool
isActive(
const
ibrcommon::File
&path)
const
;
75
76
void
adopt(
const
ibrcommon::File
&path);
77
78
ibrcommon::File
_watch;
79
ibrcommon::vsocket
_socket;
80
81
typedef
std::set<ibrcommon::File> watch_set;
82
watch_set _watchset;
83
84
bool
_running;
85
86
std::map<ibrcommon::File, dtn::core::Node> _active_paths;
87
88
};
89
}
90
}
/* namespace ibrcommon */
91
#endif
/* FILEMONITOR_H_ */
daemon
src
net
FileMonitor.h
Generated on Mon Jul 22 2013 15:15:59 for IBR-DTNSuite by
1.8.3.1