4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief AuxParser public header */
27 #define HH_AuxParser_ 1
30 #error "Don't include 'AuxParser.hh' directly, include 'Packets.hh'"
34 #include "PacketParser.hh"
35 #include "SafeIterator.hh"
37 //#include "AuxParser.mpp"
38 ///////////////////////////////hh.p////////////////////////////////////////
44 struct PrefixAuxParserPolicy
46 typedef PrefixAuxParserPolicy WrapperPolicy;
47 typedef PrefixAuxParserPolicy ParserPolicy;
49 static PacketParserBase::size_type const aux_bytes = P::fixed_bytes;
51 typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
52 void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
53 PacketParserBase::data_iterator adjust(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
56 template <class P, unsigned Dist>
57 struct FixedAuxParserPolicy
59 typedef FixedAuxParserPolicy WrapperPolicy;
60 typedef FixedAuxParserPolicy ParserPolicy;
62 static PacketParserBase::size_type const aux_bytes = 0;
64 typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
65 void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
66 PacketParserBase::data_iterator adjust(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
69 template <class P> struct DynamicWrapperAuxParserPolicy;
72 struct DynamicAuxParserPolicy
74 typedef DynamicWrapperAuxParserPolicy<P> WrapperPolicy;
75 typedef DynamicAuxParserPolicy<P> ParserPolicy;
77 static PacketParserBase::size_type const aux_bytes = 0;
79 DynamicAuxParserPolicy(P p);
80 DynamicAuxParserPolicy(WrapperPolicy const & other);
82 typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
83 void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
84 PacketParserBase::data_iterator adjust(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
90 struct DynamicWrapperAuxParserPolicy
92 typedef DynamicWrapperAuxParserPolicy<P> WrapperPolicy;
93 typedef DynamicAuxParserPolicy<P> ParserPolicy;
95 static PacketParserBase::size_type const aux_bytes = 0;
97 DynamicWrapperAuxParserPolicy(ParserPolicy const & other);
99 typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
100 void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
101 PacketParserBase::data_iterator adjust(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
103 mutable SafePacketParserWrapper<P> p_;
106 template <class Policy, class Transform>
107 struct TransformAuxParserPolicy
110 typedef TransformAuxParserPolicy<typename Policy::WrapperPolicy, Transform> WrapperPolicy;
111 typedef TransformAuxParserPolicy<typename Policy::ParserPolicy, Transform> ParserPolicy;
113 static PacketParserBase::size_type const aux_bytes = Policy::aux_bytes;
115 TransformAuxParserPolicy();
116 template <class Arg> TransformAuxParserPolicy(Arg const & arg);
118 typename Transform::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
119 void aux(typename Transform::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const;
123 ///////////////////////////////hh.e////////////////////////////////////////
125 #if !defined(HH_Packets__decls_) && !defined(HH_AuxParser_i_)
126 #define HH_AuxParser_i_
127 //#include "AuxParser.cci"
128 //#include "AuxParser.ct"
129 #include "AuxParser.cti"
136 // comment-column: 40
137 // c-file-style: "senf"
138 // indent-tabs-mode: nil
139 // ispell-local-dictionary: "american"
140 // compile-command: "scons -u test"