72158a31a203bc60187c456ae28c40cbd13ffc87
[senf.git] / senf / Packets / 80211Bundle / WLANBeaconPacket.hh
1 // $Id$
2 //
3 // Copyright (C) 2009
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Christian Niephaus <cni@berlios.de>
7 //     Thorsten Horstmann <tho@berlios.de>
8 //
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the
21 // Free Software Foundation, Inc.,
22 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23
24 /** \file
25     \brief 802.11 WLAN Beacon Packet public header */
26
27 #ifndef HH_SENF_Packets_80211Bundle_WLANBeaconPacket_
28 #define HH_SENF_Packets_80211Bundle_WLANBeaconPacket_ 1
29
30 // Custom includes
31 #include "InformationElements.hh"
32
33 ///////////////////////////////hh.p////////////////////////////////////////
34 namespace senf {
35
36     struct WLANBeaconPacketParser : public PacketParserBase
37     {
38     #   include SENF_PARSER()
39
40         SENF_PARSER_FIELD( timestamp,      UInt64LSBParser   );
41         SENF_PARSER_FIELD( beaconInterval, UInt16LSBParser   );
42         SENF_PARSER_SKIP ( 2,2); //capability flags
43
44         SENF_PARSER_FIELD( ssidIE, WLANSSIDInfoElementParser );
45         WLANSSIDInfoElementParser::value_t ssid() const { return ssidIE().value(); }
46
47         SENF_PARSER_FIELD( supportedRatesIE, WLANSupportedRatesInfoElementParser );
48
49         SENF_PARSER_LIST ( ieList, packetSize(), WLANGenericInfoElementParser );
50
51         SENF_PARSER_FINALIZE( WLANBeaconPacketParser );
52     };
53
54
55     /** \brief WLAN Beacon frame packet
56
57         \par Packet type (typedef):
58             \ref WLANBeaconPacket
59
60         \par Fields:
61
62         \ingroup protocolbundle_80211
63      */
64     struct WLANBeaconPacketType
65         : public PacketTypeBase,
66           public PacketTypeMixin<WLANBeaconPacketType>
67     {
68         typedef PacketTypeMixin<WLANBeaconPacketType> mixin;
69         typedef ConcretePacket<WLANBeaconPacketType> packet;
70         typedef WLANBeaconPacketParser parser;
71
72         using mixin::init;
73         using mixin::initSize;
74         using PacketTypeBase::nextPacketRange;
75
76         static void dump(packet p, std::ostream &os);
77     };
78
79     /** \brief WLAN Beacon frame packet typedef
80         \ingroup protocolbundle_80211
81      */
82     typedef ConcretePacket<WLANBeaconPacketType> WLANBeaconPacket;
83
84 }
85
86 ///////////////////////////////hh.e////////////////////////////////////////
87 //#include "WLANBeaconPacket.cci"
88 //#include "WLANBeaconPacket.ct"
89 //#include "WLANBeaconPacket.cti"
90 #endif
91
92 \f
93 // Local Variables:
94 // mode: c++
95 // fill-column: 100
96 // c-file-style: "senf"
97 // indent-tabs-mode: nil
98 // ispell-local-dictionary: "american"
99 // compile-command: "scons -u test"
100 // comment-column: 40
101 // End: