AuxParser.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_Packets_AuxParser_
18 #define HH_SENF_Packets_AuxParser_ 1
19 
20 #ifndef HH_SENF_Packets_Packets_
21 #error "Don't include 'AuxParser.hh' directly, include 'Packets.hh'"
22 #endif
23 
24 // Custom includes
25 #include "PacketParser.hh"
26 #include "SafeIterator.hh"
27 
28 //#include "AuxParser.mpp"
29 //-/////////////////////////////////////////////////////////////////////////////////////////////////
30 
31 namespace senf {
32 namespace detail {
33 
38  template <class P>
40  {
43 
44  static PacketParserBase::size_type const aux_bytes = P::fixed_bytes;
45 
46  typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
47  void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
49  };
50 
55  template <class P, unsigned Dist>
57  {
60 
62 
63  typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
64  void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
66  };
67 
68  template <class P> struct DynamicWrapperAuxParserPolicy;
69 
74  template <class P>
76  {
79 
81 
83  DynamicAuxParserPolicy(WrapperPolicy const & other);
84 
85  typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
86  void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
88 
89  mutable P p_;
90  };
91 
97  template <class P>
99  {
102 
104 
105  DynamicWrapperAuxParserPolicy(ParserPolicy const & other);
106 
107  typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
108  void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
110 
112  };
113 
126  template <class Policy, class Transform>
128  : public Policy
129  {
132 
133  static PacketParserBase::size_type const aux_bytes = Policy::aux_bytes;
134 
136  template <class Arg> TransformAuxParserPolicy(Arg const & arg);
137 
138  typename Transform::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
139  void aux(typename Transform::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
140  };
141 
143  {
146 
148 
152  };
153 }}
154 
155 //-/////////////////////////////////////////////////////////////////////////////////////////////////
156 #endif
157 #if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_AuxParser_i_)
158 #define HH_SENF_Packets_AuxParser_i_
159 #include "AuxParser.cci"
160 //#include "AuxParser.ct"
161 #include "AuxParser.cti"
162 #endif
163 
164 
165 // Local Variables:
166 // mode: c++
167 // fill-column: 100
168 // comment-column: 40
169 // c-file-style: "senf"
170 // indent-tabs-mode: nil
171 // ispell-local-dictionary: "american"
172 // compile-command: "scons -u test"
173 // End:
P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const
PacketParser public header.
DynamicAuxParserPolicy< P > ParserPolicy
Definition: AuxParser.hh:78
FixedAuxParserPolicy WrapperPolicy
Definition: AuxParser.hh:58
PacketParserBase::data_iterator adjust(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const
TransformAuxParserPolicy< typename Policy::WrapperPolicy, Transform > WrapperPolicy
Definition: AuxParser.hh:130
Internal: Dynamic aux-parser policy (container wrapper)
Definition: AuxParser.hh:68
SafeIterator public header.
SafePacketParserWrapper< P > p_
Definition: AuxParser.hh:111
PacketSizeAuxParserPolicy WrapperPolicy
Definition: AuxParser.hh:144
Internal: Apply transformation to arbitrary aux-parser policy.
Definition: AuxParser.hh:127
DynamicWrapperAuxParserPolicy< P > WrapperPolicy
Definition: AuxParser.hh:100
DynamicAuxParserPolicy< P > ParserPolicy
Definition: AuxParser.hh:101
static PacketParserBase::size_type const aux_bytes
Definition: AuxParser.hh:44
Packet data STL-sequence view.
Definition: PacketData.hh:61
PrefixAuxParserPolicy ParserPolicy
Definition: AuxParser.hh:42
DynamicWrapperAuxParserPolicy< P > WrapperPolicy
Definition: AuxParser.hh:77
Internal: Prefix aux-parser policy.
Definition: AuxParser.hh:39
PrefixAuxParserPolicy WrapperPolicy
Definition: AuxParser.hh:41
detail::packet::size_type size_type
Unsigned integral type.
TransformAuxParserPolicy< typename Policy::ParserPolicy, Transform > ParserPolicy
Definition: AuxParser.hh:131
Internal: Fixed distance aux-parser policy.
Definition: AuxParser.hh:56
FixedAuxParserPolicy ParserPolicy
Definition: AuxParser.hh:59
detail::packet::iterator data_iterator
Raw data iterator type.
Internal: Dynamic aux-parser policy.
Definition: AuxParser.hh:75
PacketSizeAuxParserPolicy ParserPolicy
Definition: AuxParser.hh:145