TIMPacket.hh
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 
14 #ifndef TIMPacket_
15 #define TIMPacket_ 1
16 
17 // Custom includes
18 #include <senf/Packets/Packets.hh>
21 
23 namespace senf {
24 
26  {
27 # include SENF_FIXED_PARSER()
28 
29  SENF_PARSER_BITFIELD( syn, 1, bool );
30  SENF_PARSER_BITFIELD( oddSize, 1, bool );
31  SENF_PARSER_BITFIELD( padding, 4, unsigned );
32  SENF_PARSER_BITFIELD( timestamp, 14, unsigned );
33  SENF_PARSER_BITFIELD( sequenceNumber, 22, unsigned );
34  SENF_PARSER_BITFIELD( linkLocalSeqNo, 22, unsigned );
35 
37  };
38 
40  : public senf::PacketTypeBase,
41  public senf::PacketTypeMixin<TIMPacketType>
42  {
46 
47  using mixin::initSize;
48  using mixin::init;
49 
50  static factory_t nextPacketType(packet p);
51  static optional_range nextPacketRange(packet const & p);
53  static void dump(packet p, std::ostream & os);
54  static void finalize(packet p);
55  // computes the difference between our timestamps and seqNos
56  static std::int32_t timeStampDiff(std::uint32_t tstamp2, std::uint32_t tstamp1);
57  static std::int32_t seqNoDiff(std::uint32_t current, std::uint32_t last);
58  };
59 
61 
62  //
63  // TIM SeqNo Stats Analyzer
64  //
67  {
68  public:
69  TIMSeqNoStats();
70  TIMSeqNoStats(TIMPacket const & tim, bool llSeq = false);
71 
72  bool processSeqNo(TIMPacket const & tim);
73  bool processLLSeqNo(TIMPacket const & tim);
74  };
75 
78  {
79  public:
81 
82  void process(TIMPacket const & tim);
83  };
84 }
85 
87 
89 #include "TIMPacket.cci"
90 //#include "TIMPacket.ct"
91 //#include "TIMPacket.cti"
92 #endif
senf::ConcretePacket< TIMPacketType > TIMPacket
Definition: TIMPacket.hh:60
#define SENF_PARSER_BITFIELD(name, bits, type)
PacketInterpreterBase::optional_range optional_range
SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION(AnnotationsPacket)
Annotations public header.
senf::FlagParser<?> oddSize() const
void process()
senf::UIntFieldParser<?,?+22 > linkLocalSeqNo() const
#define SENF_PARSER_FINALIZE(name)
void dump(std::ostream &os, DirectoryNode &dir=root())
TIMPacketParser parser
Definition: TIMPacket.hh:45
senf::UIntFieldParser<?,?+14 > timestamp() const
senf::UIntFieldParser<?,?+4 > padding() const
senf::PacketTypeMixin< TIMPacketType > mixin
Definition: TIMPacket.hh:43
PacketInterpreterBase::factory_t factory_t
senf::FlagParser<?> syn() const
senf::ConcretePacket< TIMPacketType > packet
Definition: TIMPacket.hh:44
senf::UIntFieldParser<?,?+22 > sequenceNumber() const