TransportPacket.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 "TransportPacket.hh"
18 //#include "TransportPacket.ih"
19 
20 // Custom includes
21 #include <iomanip>
22 #include <boost/io/ios_state.hpp>
23 
24 #define prefix_
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
28 
30  const
31 {
35  adaptation_field_ctrl() = 0x1u;
36 }
37 
39  const
40 {
41  return pointer_field_().get<1>();
42 }
43 
45  const
46 {
47  if (pusi) pointer_field_().init<1>();
48  else pointer_field_().init<0>();
49 }
50 
52 {
53  boost::io::ios_all_saver ias(os);
54  os << "TransportPacket:\n"
55  << std::hex
56  << senf::fieldName("syncByte") << "0x" << unsigned(p->sync_byte()) << "\n"
57  << senf::fieldName("transport error ind.") << "0x" << unsigned(p->transport_error_indicator()) << "\n"
58  << senf::fieldName("payload unit start ind.") << "0x" << unsigned(p->pusi()) << "\n"
59  << senf::fieldName("transport priority") << "0x" << unsigned(p->transport_priority()) << "\n"
60  << std::dec
61  << senf::fieldName("pid") << unsigned(p->pid()) << "\n"
62  << std::hex
63  << senf::fieldName("transport scrambling c.") << "0x" << unsigned(p->transport_scrmbl_ctrl()) << "\n"
64  << senf::fieldName("adaptation field ctrl") << "0x" << unsigned(p->adaptation_field_ctrl()) << "\n"
65  << senf::fieldName("continuity counter") << "0x" << unsigned(p->continuity_counter()) << "\n";
66  if (p->pusi())
67  os << senf::fieldName("pointer field") << "0x" << unsigned(p->pointer_field()) << "\n";
68 }
69 
70 //-/////////////////////////////////////////////////////////////////////////////////////////////////
71 #undef prefix_
72 
73 
74 // Local Variables:
75 // mode: c++
76 // fill-column: 100
77 // c-file-style: "senf"
78 // indent-tabs-mode: nil
79 // ispell-local-dictionary: "american"
80 // compile-command: "scons -u test"
81 // comment-column: 40
82 // End:
senf::Parse_Variant_Direct< pusi_t,?,(VoidPacketParser)(UInt8Parser) >::parser pointer_field_() const
static void dump(packet p, std::ostream &os)
Dump given Transport packet in readable form to given output stream.
senf::UIntFieldParser<?,?+2 > transport_scrmbl_ctrl() const
Parse 8bit unsigned byte aligned integer.
Definition: IntParser.hh:91
std::string fieldName(std::string const &s)
Definition: DumpFormat.cc:28
static const byte SYNC_BYTE
void setPUSI(bool pusi) const
senf::FlagParser<?> transport_error_indicator() const
senf::FlagParser<?>::value_type pusi() const
Protocol specific packet handle.
Definition: Packet.hh:87
UInt8Parser pointer_field() const
UInt8Parser sync_byte() const
#define prefix_
SENF_PACKET_INSTANTIATE_TEMPLATE(senf::TransportPacket)
TransportPacket public header.
senf::UIntFieldParser<?,?+2 > adaptation_field_ctrl() const