switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Packets / 80211Bundle / InformationElements.hh
1 // $Id$
2 //
3 // Copyright (C) 2009
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 //
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at 
9 // http://senf.berlios.de/license.html
10 //
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on, 
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
14 //
15 // Software distributed under the License is distributed on an "AS IS" basis, 
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
17 // for the specific language governing rights and limitations under the License.
18 //
19 // The Original Code is Fraunhofer FOKUS code.
20 //
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
24 //
25 // Contributor(s):
26 //   Thorsten Horstmann <tho@berlios.de>
27
28 /** \file
29     \brief WLAN Information Elements public header */
30
31 #ifndef HH_SENF_Packets_80211Bundle_InformationElements_
32 #define HH_SENF_Packets_80211Bundle_InformationElements_ 1
33
34 // Custom includes
35 #include <senf/Packets/Packets.hh>
36
37 //#include "InformationElements.mpp"
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
39
40 namespace senf {
41
42     class WLANInfoElementParser : public PacketParserBase
43     {
44     public:
45 #       include SENF_PARSER()
46         SENF_PARSER_FIELD    ( type,   UInt8Parser   );
47         SENF_PARSER_FIELD    ( length, UInt8Parser   );
48         SENF_PARSER_FINALIZE ( WLANInfoElementParser );
49
50         typedef GenericTLVParserRegistry<WLANInfoElementParser> Registry;
51     };
52
53     typedef GenericTLVParserBase<WLANInfoElementParser> WLANGenericInfoElementParser;
54
55     struct WLANSSIDInfoElementParser
56         : public WLANInfoElementParser
57     {
58     #   include SENF_PARSER()
59         SENF_PARSER_INHERIT  ( WLANInfoElementParser            );
60         // the StringParser includes the length field so we have to go back
61         SENF_PARSER_GOTO     ( length                           );
62         SENF_PARSER_FIELD    ( value, StringParser<UInt8Parser> );
63         SENF_PARSER_FINALIZE ( WLANSSIDInfoElementParser        );
64
65         SENF_PARSER_INIT() {
66             type() = typeId;
67         }
68         static const type_t::value_type typeId = 0x00u;
69
70         void dump(std::ostream & os) const;
71     };
72
73     struct WLANSupportedRatesInfoElementParser
74         : public WLANInfoElementParser
75     {
76     #   include SENF_PARSER()
77         SENF_PARSER_INHERIT  ( WLANInfoElementParser               );
78         // we just skip the value here. If somebody needs the information he has to implement
79         // this strange information element himself.
80         SENF_PARSER_SKIP     ( length(), 0                         );
81         SENF_PARSER_FINALIZE ( WLANSupportedRatesInfoElementParser );
82
83         SENF_PARSER_INIT() {
84             type() = typeId;
85         }
86         static const type_t::value_type typeId = 0x01u;
87
88         void dump(std::ostream & os) const;
89     };
90
91     struct WLANPowerConstraintInfoElementParser
92         : public WLANInfoElementParser
93     {
94     #   include SENF_PARSER()
95         SENF_PARSER_INHERIT  ( WLANInfoElementParser                );
96         SENF_PARSER_FIELD    ( value,   UInt8Parser                 );
97         SENF_PARSER_FINALIZE ( WLANPowerConstraintInfoElementParser );
98
99         SENF_PARSER_INIT() {
100             type() = typeId;
101             length() = 1;
102         }
103         static const type_t::value_type typeId = 0x20u;
104
105         void dump(std::ostream & os) const;
106     };
107 }
108
109 //-/////////////////////////////////////////////////////////////////////////////////////////////////
110 //#include "InformationElements.cci"
111 //#include "InformationElements.ct"
112 //#include "InformationElements.cti"
113 #endif
114
115 \f
116 // Local Variables:
117 // mode: c++
118 // fill-column: 100
119 // comment-column: 40
120 // c-file-style: "senf"
121 // indent-tabs-mode: nil
122 // ispell-local-dictionary: "american"
123 // compile-command: "scons -u test"
124 // End: