IBR-DTNSuite  0.10
MutualSerializer.h
Go to the documentation of this file.
1 /*
2  * MutualSerializer.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 __MUTUAL_SERIALIZER_H__
23 #define __MUTUAL_SERIALIZER_H__
24 
25 #include "ibrdtn/data/Serializer.h"
27 #include "ibrdtn/data/Number.h"
28 #include <sys/types.h>
29 
30 namespace dtn
31 {
32  namespace security
33  {
34  class SecurityBlock;
35 
45  {
46  public:
50  static const dtn::data::Length sdnv_size = 8;
51 
57  MutualSerializer(std::ostream& stream, const dtn::data::Block *ignore = NULL);
58 
60  virtual ~MutualSerializer();
61 
69  virtual Serializer &operator<<(const dtn::data::PrimaryBlock &obj);
70 
78  virtual Serializer &operator<<(const dtn::data::Block &obj);
79 
83  virtual dtn::data::Length getLength(const dtn::data::Bundle &obj);
84 
90  virtual dtn::data::Length getLength(const dtn::data::PrimaryBlock &obj) const;
91 
97  virtual dtn::data::Length getLength(const dtn::data::Block &obj) const;
98 
105  virtual Serializer &operator<<(const uint32_t value);
106 
113  virtual Serializer &operator<<(const dtn::data::EID& value);
114 
121  virtual Serializer &operator<<(const dtn::data::Number& value);
122 
128  virtual Serializer &operator<<(const dtn::security::SecurityBlock::TLVList& list);
129 
130  private:
131  const dtn::data::Block *_ignore;
132  bool _ignore_previous_bundles;
133  };
134  }
135 }
136 
137 #endif