Annotations.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 
17 #ifndef HH_SENF_Ext_NetEmu_Annotations_
18 #define HH_SENF_Ext_NetEmu_Annotations_ 1
19 
20 // Custom includes
24 
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
27 namespace senf {
28 namespace emu {
29 
34 namespace annotations {
35 
37  struct Interface
38  {
39  mutable MACAddress value;
40  // Very nice: senf::MACAddress is based on boost::array which has a trivial default
41  // constructor and such can be used in a simple annotation
42 
43  Interface();
44  Interface(MACAddress const & v);
45  bool operator<(Interface const & other) const;
46  bool operator==(Interface const & other) const;
47  };
48 
52  std::ostream & operator<<(std::ostream & os, Interface const & annotation);
53 
54  std::size_t hash_value(Interface const & mac) noexcept;
55 
56  struct FrameRxFlags{
57  unsigned frameCorrupt:1;
58  unsigned frameRetransmitted:1;
59  unsigned frameDuplicate:1;
60  unsigned frameReordered:1;
61  unsigned frameAggregated:1;
63  unsigned frameLength:12;
64  };
65 
67  struct Quality
68  {
69  mutable short snr;
70  mutable short rssi;
71  mutable short noise;
72  mutable unsigned short airTime;
74 
75  Quality();
76 // bool operator<(Quality const & other) const;
77  void setLoss(unsigned loss);
78  };
79 
83  std::ostream & operator<<(std::ostream & os, Quality const & annotation);
84 
86  struct Timestamp
87  {
88  mutable std::uint32_t timestamp[2];
89 
90  Timestamp();
91  bool operator<(Timestamp const & other) const;
92  Timestamp &operator=(Timestamp const & other);
93 
94  void fromScheduler() const;
95  void fromSocketProtocol(senf::DatagramSocketProtocol const & protocol) const;
96  void fromWallClock() const;
97  void fromQueueBuffer(senf::SocketQueueBuffer const & buffer) const;
98  senf::ClockService::clock_type as_clock_type() const;
99  std::uint32_t as_milli_seconds(std::uint32_t modulo = 0xffffffff) const;
100  };
101 
105  std::ostream & operator<<(std::ostream & os, Timestamp const & annotation);
106 
109  {
110  mutable boost::uint32_t id;
111 
113  bool operator<(WirelessModulation const & other) const;
114  };
115 
119  std::ostream & operator<<(std::ostream & os, WirelessModulation const & annotation);
120 
121 }}}
122 
123 //-/////////////////////////////////////////////////////////////////////////////////////////////////
124 #include "Annotations.cci"
125 //#include "Annotations.ct"
126 //#include "Annotations.cti"
127 #endif
128 
129 
130 // Local Variables:
131 // mode: c++
132 // fill-column: 100
133 // comment-column: 40
134 // c-file-style: "senf"
135 // indent-tabs-mode: nil
136 // ispell-local-dictionary: "american"
137 // compile-command: "scons -u test"
138 // End:
config::time_type clock_type
std::uint8_t mac[6]
Incoming or outgoing interface.
Definition: Annotations.hh:37
std::size_t hash_value(Interface const &mac) noexcept
bool operator==(Interface const &other) const
std::ostream & operator<<(std::ostream &os, Interface const &annotation)
Output Interface annotation instance as it&#39;s string representation.
Incoming packet timestamp.
Definition: Annotations.hh:86
bool operator<(Interface const &other) const