IBR-DTNSuite
0.10
Main Page
Namespaces
Classes
Files
File List
File Members
PrimaryBlock.h
Go to the documentation of this file.
1
/*
2
* PrimaryBlock.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 PRIMARYBLOCK_H_
23
#define PRIMARYBLOCK_H_
24
25
#include "
ibrdtn/data/Number.h
"
26
#include "
ibrdtn/data/EID.h
"
27
#include "
ibrdtn/data/Dictionary.h
"
28
#include "
ibrdtn/data/Serializer.h
"
29
#include <
ibrcommon/thread/Mutex.h
>
30
#include <string>
31
#include <iostream>
32
#include <stdint.h>
33
34
#ifdef SWIG
35
# define DEPRECATED
36
#else
37
# define DEPRECATED __attribute__ ((deprecated))
38
#endif
39
40
namespace
dtn
41
{
42
namespace
data
43
{
44
static
const
unsigned
char
BUNDLE_VERSION = 0x06;
45
46
class
PrimaryBlock
47
{
48
public
:
55
enum
PRIORITY
56
{
57
PRIO_LOW
= 0,
58
PRIO_MEDIUM
= 1,
59
PRIO_HIGH
= 2
60
};
61
62
enum
FLAGS
63
{
64
FRAGMENT
= 1 << 0x00,
65
APPDATA_IS_ADMRECORD
= 1 << 0x01,
66
DONT_FRAGMENT
= 1 << 0x02,
67
CUSTODY_REQUESTED
= 1 << 0x03,
68
DESTINATION_IS_SINGLETON
= 1 << 0x04,
69
ACKOFAPP_REQUESTED
= 1 << 0x05,
70
RESERVED_6
= 1 << 0x06,
71
PRIORITY_BIT1
= 1 << 0x07,
72
PRIORITY_BIT2
= 1 << 0x08,
73
CLASSOFSERVICE_9
= 1 << 0x09,
74
CLASSOFSERVICE_10
= 1 << 0x0A,
75
CLASSOFSERVICE_11
= 1 << 0x0B,
76
CLASSOFSERVICE_12
= 1 << 0x0C,
77
CLASSOFSERVICE_13
= 1 << 0x0D,
78
REQUEST_REPORT_OF_BUNDLE_RECEPTION
= 1 << 0x0E,
79
REQUEST_REPORT_OF_CUSTODY_ACCEPTANCE
= 1 << 0x0F,
80
REQUEST_REPORT_OF_BUNDLE_FORWARDING
= 1 << 0x10,
81
REQUEST_REPORT_OF_BUNDLE_DELIVERY
= 1 << 0x11,
82
REQUEST_REPORT_OF_BUNDLE_DELETION
= 1 << 0x12,
83
STATUS_REPORT_REQUEST_19
= 1 << 0x13,
84
STATUS_REPORT_REQUEST_20
= 1 << 0x14,
85
86
// DTNSEC FLAGS (these are customized flags and not written down in any draft)
87
DTNSEC_REQUEST_SIGN
= 1 << 0x1A,
88
DTNSEC_REQUEST_ENCRYPT
= 1 << 0x1B,
89
DTNSEC_STATUS_VERIFIED
= 1 << 0x1C,
90
DTNSEC_STATUS_CONFIDENTIAL
= 1 << 0x1D,
91
DTNSEC_STATUS_AUTHENTICATED
= 1 << 0x1E,
92
IBRDTN_REQUEST_COMPRESSION
= 1 << 0x1F
93
};
94
95
PrimaryBlock
();
96
virtual
~PrimaryBlock
();
97
102
bool
isExpired
() const
DEPRECATED
;
103
104
std::
string
toString
() const;
105
106
void
set
(
FLAGS
flag,
bool
value);
107
bool
get
(
FLAGS
flag) const;
108
109
PRIORITY
getPriority
() const;
110
void
setPriority
(
PRIORITY
p);
111
115
void
relabel
();
116
117
bool
operator==(const
PrimaryBlock
& other) const;
118
bool
operator!=(const
PrimaryBlock
& other) const;
119
bool
operator<(const
PrimaryBlock
& other) const;
120
bool
operator>(const
PrimaryBlock
& other) const;
121
122
Bitset
<
FLAGS
>
procflags
;
123
Timestamp
timestamp
;
124
Number
sequencenumber
;
125
Number
lifetime
;
126
Number
fragmentoffset
;
127
Number
appdatalength
;
128
129
EID
source
;
130
EID
destination
;
131
EID
reportto
;
132
EID
custodian
;
133
134
private:
135
static ibrcommon::Mutex __sequence_lock;
136
static
Number
__sequencenumber;
137
static
Timestamp
__last_timestamp;
138
};
139
}
140
}
141
142
#endif
/* PRIMARYBLOCK_H_ */
ibrdtn
ibrdtn
data
PrimaryBlock.h
Generated on Mon Jul 22 2013 15:16:00 for IBR-DTNSuite by
1.8.3.1