4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Christian Niephaus <cni@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.
23 // Definition of non-inline non-template functions
26 #include "WLANPacket.hh"
27 #include "../../Packets/Packets.hh"
28 #include <boost/io/ios_state.hpp>
34 void dumpBase(senf::WLANPacketParser const & p, std::ostream & os)
36 os << " version : " << unsigned(p.version()) <<"\n"
37 << " type : " << unsigned(p.type()) << "\n"
38 << " subtype : " << unsigned(p.subtype()) << "\n"
40 if ( p.toDS() ) os << " toDS";
41 if ( p.fromDS() ) os << " fromDS";
42 if ( p.moreFrag() ) os << " moreFrag";
43 if ( p.retry() ) os << " retry";
44 if ( p.pwrMgt() ) os << " pwrMgt";
45 if ( p.moreData() ) os << " moreData";
46 if ( p.protectedFrame() ) os << " protected";
47 if ( p.order() ) os << " order";
49 if ( !(p.toDS() || p.fromDS() || p.moreFrag() || p.retry() || p.pwrMgt() ||
50 p.moreData() || p.protectedFrame() || p.order()) )
53 << " duration : " << unsigned(p.duration()) << "\n";
57 prefix_ void senf::WLANPacket_MgtFrameType::dump(packet p, std::ostream &os)
59 boost::io::ios_all_saver ias(os);
60 os << "802.11 MAC Mangement Frame:\n";
61 dumpBase(p.parser(), os);
62 os << " destination : " << p->destinationAddress() << "\n"
63 << " source : " << p->sourceAddress() << "\n"
64 << " bss id : " << p->bssid() << "\n"
65 << " sequence number : " << p->sequenceNumber() << "\n"
66 << " fragment number : " << p->fragmentNumber() << "\n";
69 prefix_ void senf::WLANPacket_CtrlFrameType::dump(packet p, std::ostream &os)
71 boost::io::ios_all_saver ias(os);
72 os << "802.11 MAC Control Frame:\n";
73 dumpBase(p.parser(), os);
74 os << " receiver : " << p->receiverAddress() << "\n";
76 os << " source : " << p->sourceAddress() << "\n";
79 prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::destinationAddress()
84 case 2 : return addr1();
85 default: return addr3();
89 prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::sourceAddress()
95 case 1 : return addr2();
97 // case 3 : return addr4();
98 default: return addr3();
102 prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::bssid()
107 case 0 : return addr3();
108 case 1 : return addr1();
109 default: return addr2();
113 prefix_ void senf::WLANPacket_DataFrameType::dump(packet p, std::ostream &os)
115 boost::io::ios_all_saver ias(os);
116 os << "802.11 MAC Data Frame:\n";
117 dumpBase(p.parser(), os);
118 os << " destination : " << p->destinationAddress();
119 if (p->dsBits()==0 || p->dsBits()==2) os << " (receiver)";
121 << " source : " << p->sourceAddress();
122 if (p->dsBits()==0 || p->dsBits()==1) os << " (transmitter)";
124 << " bss id : " << p->bssid();
125 if (p->dsBits()==1) os << " (receiver)";
126 else if (p->dsBits()!=0) os << " (transmitter)";
128 << " sequence number : " << p->sequenceNumber() << "\n"
129 << " fragment number : " << p->fragmentNumber() << "\n";
130 if (p->has_qosField())
131 os << " QOS data : " << p->qosField() << "\n";
140 // c-file-style: "senf"
141 // indent-tabs-mode: nil
142 // ispell-local-dictionary: "american"
143 // compile-command: "scons -u test"
144 // comment-column: 40