GREPacket.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 "GREPacket.hh"
18 //#include "GREPacket.ih"
19 
20 // Custom includes
21 #include <boost/io/ios_state.hpp>
22 #include <iomanip>
23 
24 #define prefix_
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
28 
29 prefix_ void senf::GREPacketType::dump(packet p, std::ostream & os)
30 {
31  boost::io::ios_all_saver ias(os);
32  os << "GRE Encapsulation:\n"
33  << senf::fieldName("checksum_present") << p->checksum_present() << "\n"
34  << senf::fieldName("protocol_type") << "0x" << std::hex << p->protocol_type() << "\n";
35 }
36 
38 {
39  p->protocol_type() << key(p.next(nothrow));
40  p->version_number() = 0; // as per RFC2784, 2.3.1
41  if (p->checksum_present()) {
42  // compute checksum
43  } else {
44  // ???
45  }
46 }
47 
48 //-/////////////////////////////////////////////////////////////////////////////////////////////////
49 #undef prefix_
50 
51 
52 // Local Variables:
53 // mode: c++
54 // fill-column: 100
55 // c-file-style: "senf"
56 // indent-tabs-mode: nil
57 // ispell-local-dictionary: "american"
58 // compile-command: "scons -u test"
59 // comment-column: 40
60 // End:
static optional_key_t key(Packet const &p)
Find key of packet from registry.
std::string fieldName(std::string const &s)
Definition: DumpFormat.cc:28
SENF_PACKET_REGISTRY_REGISTER(senf::IPTypes, senf::GREPacketType::ipType, senf::GREPacket)
#define prefix_
Definition: GREPacket.cc:24
static void finalize(packet p)
Definition: GREPacket.cc:37
static void dump(packet p, std::ostream &os)
Definition: GREPacket.cc:29
Protocol specific packet handle.
Definition: Packet.hh:87
Packet next() const
Get next packet in chain.
static const IPTypes::key_t ipType
Definition: GREPacket.hh:90
nothrow
IP protocol number registry.
Definition: Registries.hh:60
GREPacket public header.