src/wscout_gui_pcap_header.hxx

00001 /*
00002  * WScout - Lightweight PCAP visualizer.
00003  * Copyright (C) 2007  Universite Pierre et Marie Curie - Paris 6
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00018  * MA  02110-1301  USA
00019  *
00020  * Author: Thomas Claveirole <thomas.claveirole@lip6.fr>
00021  */
00022 
00023 #ifndef WSCOUT_GUI_PCAP_HEADER_HXX_
00024 # define WSCOUT_GUI_PCAP_HEADER_HXX_
00025 
00026 # include "wscout_gui_pcap_header.hh"
00027 
00028 namespace wscout
00029 {
00030 
00031   namespace gui
00032   {
00033 
00034     inline
00035     PcapHeader::PcapHeader(QWidget* parent):
00036       HeaderBase<PcapHeader, protocol::PCAP> (parent)
00037     {
00038       {
00039         QFont bold;
00040 
00041         bold.setBold(true);
00042         id_.setFont(bold);
00043       }
00044       {
00045         QBoxLayout* const l = layout();
00046 
00047         l->addWidget(&id_);
00048         l->addWidget(&date_);
00049         l->addStretch();
00050         l->addWidget(&len_);
00051       }
00052     }
00053 
00054     inline
00055     PcapHeader::next_header
00056     PcapHeader::nextHeader(const Trace&                         trace,
00057                            const pcapxx::frame_descriptor&      desc)
00058     {
00059       const pcapxx::descriptor<>*       d = trace.trace();
00060       protocol::id                      i;
00061 
00062       assert(d);
00063 
00064       switch (d->linktype())
00065         {
00066         case pcapxx::descriptor<>::IEEE802_11:
00067           i = protocol::IEEE802_11;
00068           break;
00069         case pcapxx::descriptor<>::PRISM_HEADER:
00070           i = protocol::PRISM_HEADER;
00071           break;
00072         default:
00073           i = protocol::UNKNOWN;
00074           break;
00075         }
00076       return next_header (i, desc.bytes().get());
00077     }
00078 
00079   } // End of namespace gui.
00080 
00081 } // End of namespace wscout.
00082 
00083 #endif // ! WSCOUT_GUI_PCAP_HEADER_HXX_

Generated on Wed Jan 30 19:02:27 2008 for WScout by  doxygen 1.5.4