DTCPPacket.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 "DTCPPacket.hh"
18 //#include "DTCPPacket.ih"
19 
20 // Custom includes
21 #include <boost/io/ios_state.hpp>
22 #include <iomanip>
23 
24 #define prefix_
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
28 {
29  static char const * COMMANDS[] = { "0", "JOIN", "LEAVE", "3", "4", "5", "6", "7",
30  "8", "9", "10", "11", "12", "13", "14", "15" };
31  boost::io::ios_all_saver ias(os);
32  os << "DTCP HELLO Packet:" << std::endl
33  << senf::fieldName("version") << p->versionNumber() << "\n"
34  << senf::fieldName("command") << COMMANDS[p->command()] << "\n"
35  << senf::fieldName("interval") << unsigned(p->interval()) << "\n"
36  << senf::fieldName("sequence number") << p->sequenceNumber() << "\n"
37  << senf::fieldName("receive capable feed") << (p->receiveCapableFeed() ? "yes" : "no") << "\n"
38  << senf::fieldName("ip version") << p->ipVersion() << "\n"
39  << senf::fieldName("tunnel protocol") << unsigned(p->tunnelProtocol()) << "\n"
40  << senf::fieldName("number of BDL ips") << unsigned(p->fbipCount()) << "\n"
41  << " feed BDL ips:\n";
42 
43  switch (p->ipVersion()) {
44  case 4 : {
45  typedef DTCPHelloPacket::Parser::v4fbipList_t FBIPList;
46  FBIPList::container_type fbips (p->v4fbipList());
47  FBIPList::container_type::iterator i (fbips.begin());
48  FBIPList::container_type::iterator const i_end (fbips.end());
49  for (; i != i_end; ++i)
50  os << " " << *i << "\n";
51  break;
52  }
53  case 6 : {
54  typedef DTCPHelloPacket::Parser::v6fbipList_t FBIPList;
55  FBIPList::container_type fbips (p->v6fbipList());
56  FBIPList::container_type::iterator i (fbips.begin());
57  FBIPList::container_type::iterator const i_end (fbips.end());
58  for (; i != i_end; ++i)
59  os << " " << *i << "\n";
60  break;
61  }
62  default:
63  os << " unknown ip version\n";
64  }
65 }
66 
67 #undef prefix_
68 
69 
70 //-/////////////////////////////////////////////////////////////////////////////////////////////////
71 #undef prefix_
72 
73 
74 // Local Variables:
75 // mode: c++
76 // fill-column: 100
77 // comment-column: 40
78 // c-file-style: "senf"
79 // indent-tabs-mode: nil
80 // ispell-local-dictionary: "american"
81 // compile-command: "scons -u test"
82 // End:
#define prefix_
Definition: DTCPPacket.cc:24
std::string fieldName(std::string const &s)
Definition: DumpFormat.cc:28
Protocol specific packet handle.
Definition: Packet.hh:87
static void dump(packet p, std::ostream &os)
Definition: DTCPPacket.cc:27
raw_container::iterator iterator
Definition: PacketTypes.hh:69
DTCPPacket public header.