IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
src
api
ApiP2PExtensionHandler.cpp
ApiP2PExtensionHandler.h
ApiServer.cpp
ApiServer.h
BinaryStreamClient.cpp
BinaryStreamClient.h
BundleStreamBuf.cpp
BundleStreamBuf.h
ClientHandler.cpp
ClientHandler.h
EventConnection.cpp
EventConnection.h
ExtendedApiHandler.cpp
ExtendedApiHandler.h
ManagementConnection.cpp
ManagementConnection.h
NativeSerializer.cpp
NativeSerializer.h
NativeSerializerCallback.cpp
NativeSerializerCallback.h
NativeSession.cpp
NativeSession.h
OrderedStreamHandler.cpp
OrderedStreamHandler.h
Registration.cpp
Registration.h
core
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
ApiServer.h
Go to the documentation of this file.
1
/*
2
* ApiServer.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 APISERVER_H_
23
#define APISERVER_H_
24
25
#include "
Component.h
"
26
#include "
api/Registration.h
"
27
#include "
api/ClientHandler.h
"
28
#include "
core/EventReceiver.h
"
29
#include "
storage/BundleSeeker.h
"
30
#include <
ibrcommon/net/vinterface.h
>
31
#include <
ibrcommon/net/socket.h
>
32
#include <
ibrcommon/thread/Mutex.h
>
33
#include <
ibrcommon/thread/Timer.h
>
34
35
#include <set>
36
#include <list>
37
38
namespace
dtn
39
{
40
namespace
api
41
{
42
class
ApiServer
:
public
dtn::daemon::IndependentComponent
,
public
dtn::core::EventReceiver
,
public
ApiServerInterface
,
public
ibrcommon::TimerCallback
43
{
44
static
const
std::string TAG;
45
46
public
:
47
ApiServer
(
const
ibrcommon::File
&socket);
48
ApiServer
(
const
ibrcommon::vinterface
&net,
int
port = 4550);
49
virtual
~ApiServer
();
50
54
virtual
const
std::string
getName
()
const
;
55
56
void
freeRegistration
(
Registration
®);
57
58
void
raiseEvent
(
const
dtn::core::Event
*evt)
throw
();
59
68
Registration
&
getRegistration
(
const
std::string &handle);
69
76
virtual
size_t
timeout
(
ibrcommon::Timer
*);
77
78
protected
:
79
void
__cancellation
()
throw
();
80
81
virtual
void
connectionUp
(
ClientHandler
*conn);
82
virtual
void
connectionDown
(
ClientHandler
*conn);
83
84
void
componentUp
()
throw
();
85
void
componentRun
()
throw
();
86
void
componentDown
()
throw
();
87
88
private
:
89
93
void
startGarbageCollector();
99
size_t
nextRegistrationExpiry();
100
101
ibrcommon::vsocket
_sockets;
102
bool
_shutdown;
103
104
typedef
std::list<Registration*> registration_list;
105
registration_list _registrations;
106
107
typedef
std::list<ClientHandler*> client_list;
108
client_list _connections;
109
110
ibrcommon::Mutex
_connection_lock;
111
ibrcommon::Mutex
_registration_lock;
112
ibrcommon::Timer
_garbage_collector;
113
};
114
}
115
}
116
117
#endif
/* APISERVER_H_ */
daemon
src
api
ApiServer.h
Generated on Thu Mar 27 2014 09:26:19 for IBR-DTNSuite by
1.8.4