PacketParser.cc
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #include "Packets.hh"
18 #include "PacketParser.ih"
19 
20 // Custom includes
21 
22 //#include "PacketParser.mpp"
23 #define prefix_
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
27 {
28  safe_data_iterator safe_i (*this);
29  if (oldSize > newSize)
30  data().erase(i()+newSize, i()+oldSize);
31  else if (oldSize < newSize)
32  data().insert(i()+oldSize, newSize-oldSize, 0u);
33  i_ = safe_i;
34 }
35 
36 //-/////////////////////////////////////////////////////////////////////////////////////////////////
37 #undef prefix_
38 //#include "PacketParser.mpp"
39 
40 
41 // Local Variables:
42 // mode: c++
43 // fill-column: 100
44 // comment-column: 40
45 // c-file-style: "senf"
46 // indent-tabs-mode: nil
47 // ispell-local-dictionary: "american"
48 // compile-command: "scons -u test"
49 // End:
Packets public header.
#define prefix_
Definition: PacketParser.cc:23
data_iterator i() const
Return beginning of data to parse.
Re-validating data iterator.
Definition: SafeIterator.hh:47
detail::packet::size_type size_type
Unsigned integral type.
void resize(size_type oldSize, size_type newSize)
Resize data container.
Definition: PacketParser.cc:26
PacketData & data() const
Access the packets raw data container.
void erase(iterator pos)
void insert(iterator pos, byte v)