IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
ibrcommon
ibrdtn
ibrdtn
api
data
security
streams
StreamBuffer.cpp
StreamConnection.cpp
StreamConnection.h
StreamContactHeader.cpp
StreamContactHeader.h
StreamDataSegment.cpp
StreamDataSegment.h
utils
config.h
dummy.cpp
ibrdtn.h
tools
File Members
StreamDataSegment.h
Go to the documentation of this file.
1
/*
2
* StreamDataSegment.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
23
#ifndef STREAMDATASEGMENT_H_
24
#define STREAMDATASEGMENT_H_
25
26
#include <
ibrdtn/data/Number.h
>
27
#include <stdlib.h>
28
#include <iostream>
29
#include <stdint.h>
30
31
namespace
dtn
32
{
33
namespace
streams
34
{
35
class
StreamDataSegment
36
{
37
public
:
38
enum
SegmentType
39
{
40
MSG_DATA_SEGMENT
= 0x1,
41
MSG_ACK_SEGMENT
= 0x2,
42
MSG_REFUSE_BUNDLE
= 0x3,
43
MSG_KEEPALIVE
= 0x4,
44
MSG_SHUTDOWN
= 0x5
45
};
46
47
enum
SegmentMark
48
{
49
MSG_MARK_BEGINN
= 0x02,
50
MSG_MARK_END
= 0x01
51
};
52
53
enum
ShutdownReason
54
{
55
MSG_SHUTDOWN_NONE
= 0xff,
56
MSG_SHUTDOWN_IDLE_TIMEOUT
= 0x00,
57
MSG_SHUTDOWN_VERSION_MISSMATCH
= 0x01,
58
MSG_SHUTDOWN_BUSY
= 0x02
59
};
60
61
StreamDataSegment
(
SegmentType
type,
const
dtn::data::Number
&size);
// creates a ACK or DATA segment
62
StreamDataSegment
(
SegmentType
type =
MSG_KEEPALIVE
);
// Creates a Keep-Alive Message
63
StreamDataSegment
(
ShutdownReason
reason,
const
dtn::data::Number
&reconnect = 0);
// Creates a Shutdown Message
64
65
virtual
~StreamDataSegment
();
66
67
dtn::data::Number
_value
;
68
SegmentType
_type
;
69
ShutdownReason
_reason
;
70
uint8_t
_flags
;
71
72
friend
std::ostream &
operator<<
(std::ostream &stream,
const
StreamDataSegment
&seg);
73
friend
std::istream &
operator>>
(std::istream &stream,
StreamDataSegment
&seg);
74
};
75
}
76
}
77
78
#endif
/* STREAMDATASEGMENT_H_ */
ibrdtn
ibrdtn
streams
StreamDataSegment.h
Generated on Thu Mar 27 2014 09:26:21 for IBR-DTNSuite by
1.8.4