IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
BinaryStreamClient.h
Go to the documentation of this file.
1
/*
2
* BinaryStreamClient.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 BINARYSTREAMCLIENT_H_
23
#define BINARYSTREAMCLIENT_H_
24
25
#include "
api/ClientHandler.h
"
26
#include <
ibrdtn/streams/StreamConnection.h
>
27
#include <
ibrdtn/streams/StreamContactHeader.h
>
28
29
namespace
dtn
30
{
31
namespace
api
32
{
33
class
BinaryStreamClient
:
public
dtn::streams::StreamConnection::Callback
,
public
ProtocolHandler
34
{
35
public
:
36
BinaryStreamClient
(
ClientHandler
&client,
ibrcommon::socketstream
&stream);
37
virtual
~BinaryStreamClient
();
38
39
virtual
void
eventShutdown
(
dtn::streams::StreamConnection::ConnectionShutdownCases
csc)
throw
();
40
virtual
void
eventTimeout
()
throw
();
41
virtual
void
eventError
()
throw
();
42
virtual
void
eventConnectionDown
()
throw
();
43
virtual
void
eventConnectionUp
(
const
dtn::streams::StreamContactHeader
&header)
throw
();
44
45
virtual
void
eventBundleRefused
()
throw
();
46
virtual
void
eventBundleForwarded
()
throw
();
47
virtual
void
eventBundleAck
(
const
dtn::data::Length
&ack)
throw
();
48
49
const
dtn::data::EID
&
getPeer
()
const
;
50
51
void
queue
(
const
dtn::data::Bundle
&bundle);
52
53
void
received
(
const
dtn::streams::StreamContactHeader
&
h
);
54
void
run
();
55
void
finally
();
56
void
__cancellation
()
throw
();
57
bool
good
()
const
;
58
59
private
:
60
class
Sender
:
public
ibrcommon::JoinableThread
,
public
ibrcommon::Queue
<dtn::data::Bundle>
61
{
62
public
:
63
Sender
(
BinaryStreamClient
&client);
64
virtual
~
Sender
();
65
66
protected
:
67
void
run
()
throw
();
68
void
__cancellation
()
throw
();
69
70
void
received
(
const
dtn::streams::StreamContactHeader
&h);
71
bool
good
()
const
;
72
73
private
:
74
BinaryStreamClient
&
_client
;
75
};
76
77
friend
class
Sender
;
78
79
BinaryStreamClient::Sender
_sender;
80
81
dtn::streams::StreamConnection
_connection;
82
dtn::streams::StreamContactHeader
_contact;
83
84
ibrcommon::Queue<dtn::data::Bundle>
_sentqueue;
85
uint64_t _lastack;
86
87
dtn::data::EID
_eid;
88
};
89
}
90
}
91
92
#endif
/* BINARYSTREAMCLIENT_H_ */
daemon
src
api
BinaryStreamClient.h
Generated on Thu Mar 27 2014 09:26:19 for IBR-DTNSuite by
1.8.4