4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Thorsten Horstmann <tho@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.
24 \brief LlcSnapPacket non-inline non-template implementation */
26 #include "LlcSnapPacket.hh"
27 //#include "LlcSnapPacket.ih"
31 #include <boost/io/ios_state.hpp>
34 ///////////////////////////////cc.p////////////////////////////////////////
36 prefix_ void senf::LlcSnapPacketType::dump(packet p, std::ostream & os)
38 boost::io::ios_all_saver ias(os);
40 << std::hex << std::setfill('0')
42 << senf::fieldName(" dsap") << "0x" << unsigned(p->dsap()) << "\n"
43 << senf::fieldName(" ssap") << "0x" << unsigned(p->ssap()) << "\n"
44 << senf::fieldName(" control id") << "0x" << unsigned(p->ctrl()) << "\n"
46 << senf::fieldName(" protocol id") << "0x" << std::setw(6) << unsigned(p->protocolId()) << "\n"
47 << senf::fieldName(" type/length") << "0x" << std::setw(4) << unsigned(p->type_length()) << "\n";
50 prefix_ senf::PacketInterpreterBase::factory_t senf::LlcSnapPacketType::nextPacketType(packet p)
52 if (p->type_length() >= 1536) {
53 PacketRegistry<senf::EtherTypes>::Entry const * e (
54 PacketRegistry<senf::EtherTypes>::lookup( p->type_length(), nothrow ));
55 return e ? e->factory() : no_factory();
57 if (p->type_length() <= 1500)
58 return EthernetPacket::factory();
62 prefix_ void senf::LlcSnapPacketType::finalize(packet p)
64 optional_key_t k (key(p.next(nothrow)));
66 p->type_length() << k;
67 else if (p.next().is<EthernetPacket>())
68 p->type_length() << p.next().data().size();
72 ///////////////////////////////cc.e////////////////////////////////////////
79 // c-file-style: "senf"
80 // indent-tabs-mode: nil
81 // ispell-local-dictionary: "american"
82 // compile-command: "scons -u test"