switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Packets / 80211Bundle / WLANBeaconPacket.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 //   Christian Niephaus <cni@berlios.de>
28
29 /** \file
30     \brief 802.11 WLAN Beacon Packet public header */
31
32 #ifndef HH_SENF_Packets_80211Bundle_WLANBeaconPacket_
33 #define HH_SENF_Packets_80211Bundle_WLANBeaconPacket_ 1
34
35 // Custom includes
36 #include "InformationElements.hh"
37
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
39 namespace senf {
40
41     struct WLANBeaconPacketParser : public PacketParserBase
42     {
43     #   include SENF_PARSER()
44
45         SENF_PARSER_FIELD( timestamp,      UInt64LSBParser   );
46         SENF_PARSER_FIELD( beaconInterval, UInt16LSBParser   );
47         SENF_PARSER_SKIP ( 2,2); //capability flags
48
49         SENF_PARSER_FIELD( ssidIE, WLANSSIDInfoElementParser );
50         WLANSSIDInfoElementParser::value_t ssid() const { return ssidIE().value(); }
51
52         SENF_PARSER_FIELD( supportedRatesIE, WLANSupportedRatesInfoElementParser );
53
54         SENF_PARSER_LIST ( ieList, packetSize(), WLANGenericInfoElementParser );
55
56         SENF_PARSER_FINALIZE( WLANBeaconPacketParser );
57     };
58
59
60     /** \brief WLAN Beacon frame packet
61
62         \par Packet type (typedef):
63             \ref WLANBeaconPacket
64
65         \par Fields:
66
67         \ingroup protocolbundle_80211
68      */
69     struct WLANBeaconPacketType
70         : public PacketTypeBase,
71           public PacketTypeMixin<WLANBeaconPacketType>
72     {
73         typedef PacketTypeMixin<WLANBeaconPacketType> mixin;
74         typedef ConcretePacket<WLANBeaconPacketType> packet;
75         typedef WLANBeaconPacketParser parser;
76
77         using mixin::init;
78         using mixin::initSize;
79         using PacketTypeBase::nextPacketRange;
80
81         static void dump(packet p, std::ostream & os);
82     };
83
84     /** \brief WLAN Beacon frame packet typedef
85         \ingroup protocolbundle_80211
86      */
87     typedef ConcretePacket<WLANBeaconPacketType> WLANBeaconPacket;
88
89 }
90
91 //-/////////////////////////////////////////////////////////////////////////////////////////////////
92 //#include "WLANBeaconPacket.cci"
93 //#include "WLANBeaconPacket.ct"
94 //#include "WLANBeaconPacket.cti"
95 #endif
96
97 \f
98 // Local Variables:
99 // mode: c++
100 // fill-column: 100
101 // c-file-style: "senf"
102 // indent-tabs-mode: nil
103 // ispell-local-dictionary: "american"
104 // compile-command: "scons -u test"
105 // comment-column: 40
106 // End: