IBR-DTNSuite  0.10
MetaBundle.cpp
Go to the documentation of this file.
1 /*
2  * MetaBundle.cpp
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 METABUNDLE_CPP_
23 #define METABUNDLE_CPP_
24 
25 #include "ibrdtn/data/MetaBundle.h"
26 #include "ibrdtn/utils/Clock.h"
29 
30 namespace dtn
31 {
32  namespace data
33  {
35  {
36  return MetaBundle(id);
37  }
38 
40  : BundleID(), received(), lifetime(0), destination(), reportto(),
41  custodian(), appdatalength(0), expiretime(0), hopcount(Number::max()), payloadlength(0), net_priority(0)
42  {
43  }
44 
46  : BundleID(id), received(), lifetime(0), destination(), reportto(),
47  custodian(), appdatalength(0), expiretime(0), hopcount(Number::max()), payloadlength(0), net_priority(0)
48  {
49  }
50 
52  : BundleID(b), lifetime(b.lifetime), destination(b.destination), reportto(b.reportto),
53  custodian(b.custodian), appdatalength(b.appdatalength), procflags(b.procflags), expiretime(0), hopcount(Number::max()), payloadlength(0), net_priority(0)
54  {
56 
60  try {
62  hopcount = schl.getHopsToLive();
64 
68  try {
70  net_priority = sblock.getPriority();
72 
76  try {
77  const dtn::data::PayloadBlock &pblock = b.find<const dtn::data::PayloadBlock>();
78  payloadlength = pblock.getLength();
80  }
81 
83  {}
84 
86  {
87  // read priority
89  {
90  return 0;
91  }
92 
94  {
95  return 1;
96  }
97 
98  return -1;
99  }
100 
102  {
103  return procflags.getBit(flag);
104  }
105  }
106 }
107 
108 #endif /* METABUNDLE_CPP_ */