IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
OrderedStreamHandler.h
Go to the documentation of this file.
1
/*
2
* OrderedStreamHandler.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 ORDEREDSTREAMHANDLER_H_
23
#define ORDEREDSTREAMHANDLER_H_
24
25
#include "
api/Registration.h
"
26
#include "
api/ClientHandler.h
"
27
#include "
api/BundleStreamBuf.h
"
28
29
#include <iostream>
30
31
namespace
dtn
32
{
33
namespace
api
34
{
35
class
OrderedStreamHandler
:
public
ProtocolHandler
,
public
BundleStreamBufCallback
36
{
37
public
:
38
OrderedStreamHandler
(
ClientHandler
&client,
ibrcommon::socketstream
&stream);
39
virtual
~OrderedStreamHandler
();
40
41
virtual
void
run
();
42
virtual
void
finally
();
43
virtual
void
__cancellation
()
throw
();
44
45
virtual
void
put
(
dtn::data::Bundle
&b);
46
virtual
dtn::data::MetaBundle
get
(
const
dtn::data::Timeout
timeout = 0);
47
virtual
void
delivered
(
const
dtn::data::MetaBundle
&m);
48
49
private
:
50
class
Sender :
public
ibrcommon::JoinableThread
51
{
52
public
:
53
Sender(
OrderedStreamHandler
&conn);
54
virtual
~Sender();
55
56
protected
:
57
void
run
()
throw
();
58
void
finally
()
throw
();
59
void
__cancellation
()
throw
();
60
61
private
:
62
OrderedStreamHandler
&_handler;
63
} _sender;
64
65
BundleStreamBuf
_streambuf;
66
std::iostream _bundlestream;
67
68
dtn::data::EID
_peer;
69
dtn::data::EID
_endpoint;
70
bool
_group;
71
dtn::data::Number
_lifetime;
72
};
73
}
/* namespace api */
74
}
/* namespace dtn */
75
#endif
/* ORDEREDSTREAMHANDLER_H_ */
daemon
src
api
OrderedStreamHandler.h
Generated on Thu Mar 27 2014 09:26:19 for IBR-DTNSuite by
1.8.4