IBR-DTNSuite  0.12
Debugger.cpp
Go to the documentation of this file.
1 /*
2  * Debugger.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 #include "Debugger.h"
23 #include <ibrcommon/Logger.h>
24 #include <sstream>
25 
26 namespace dtn
27 {
28  namespace daemon
29  {
31  {
32  // do not print anything if debugging is disabled
33  if (ibrcommon::Logger::getVerbosity() < 1) return;
34 
35  std::stringstream ss_blocks;
36 
37  for (dtn::data::Bundle::const_iterator iter = b.begin(); iter != b.end(); ++iter)
38  {
39  const dtn::data::Block &block = (**iter);
40  ss_blocks << "[T=" << (unsigned int)block.getType() << ";F=" << block.getProcessingFlags().get<size_t>() << ";LEN=" << block.getLength() << ";]";
41  }
42 
43  IBRCOMMON_LOGGER_DEBUG_TAG("Debugger", 1) << "F=" << b.procflags.get<size_t>() <<
44  ";SRC=" << b.source.getString() <<
45  ";DST=" << b.destination.getString() <<
46  ";RPT=" << b.reportto.getString() <<
47  ";CSD=" << b.custodian.getString() <<
48  ";TS=" << b.timestamp.get<size_t>() <<
49  ";SQ=" << b.sequencenumber.get<size_t>() <<
50  ";LT=" << b.lifetime.get<size_t>() <<
51  ";FO=" << b.fragmentoffset.get<size_t>() <<
52  ";AL=" << b.appdatalength.get<size_t>() <<
53  ";" << ss_blocks.str() <<
55  }
56  }
57 }