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 DSMCCSection non-inline non-template implementation */
26 #include "SNDUPacket.hh"
27 //#include "SNDUPacket.ih"
31 #include "../../Utils/hexdump.hh"
32 #include "../../Packets/DefaultBundle/EthernetPacket.hh"
36 ///////////////////////////////cc.p////////////////////////////////////////
39 // senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::EthVLanPacketType>
40 // registerEthVLanPacket(0x8100);
44 prefix_ boost::uint32_t senf::SNDUPacketParser::calcCrc()
49 boost::prior(data().end(), 4),
50 ule_crc32() ).checksum();
53 //prefix_ senf::SNDUPacketType::key_t senf::SNDUPacketType::nextPacketKey(packet p)
58 prefix_ void senf::SNDUPacketType::init(packet p)
63 prefix_ senf::PacketInterpreterBase::factory_t senf::SNDUPacketType::nextPacketType(packet p)
65 if (p.data().size() < 8)
67 PkReg_Entry const * e;
69 e = PacketRegistry<senf::ULEExtHeaderTypes>::lookup( p->type(), nothrow );
71 e = PacketRegistry<senf::EtherTypes>::lookup( p->type(), nothrow );
72 return e ? e->factory() : no_factory();
75 prefix_ senf::PacketInterpreterBase::optional_range
76 senf::SNDUPacketType::nextPacketRange(packet p)
78 if (p.data().size() < 8)
81 size_type sz = 2 + 2; // D-Bit + 15 bits length + 16 bits type field
83 sz += 6; // + 6 Byte NPA destination address
85 boost::next(p.data().begin(), sz),
86 boost::prior(p.data().end(), 4)); // - 32 bits crc
89 prefix_ void senf::SNDUPacketType::dump(packet p, std::ostream & os)
93 << " d_bit : " << p->d_bit() << "\n"
94 << " length : " << unsigned(p->length()) << "\n"
96 << " type : 0x" << unsigned(p->type()) << "\n"
98 << " crc : " << unsigned(p->crc()) << "\n";
101 prefix_ senf::PacketParserBase::size_type senf::SNDUPacketType::initSize()
103 return 2 + 2 + 4; // D-Bit + 15 bits length + 16 bits type field + 32 bits crc
106 prefix_ senf::PacketParserBase::size_type senf::SNDUPacketType::initHeadSize()
108 return 2 + 2; // D-Bit + 15 bits length + 16 bits type field
111 ///////////////////////////////cc.e////////////////////////////////////////
118 // c-file-style: "senf"
119 // indent-tabs-mode: nil
120 // ispell-local-dictionary: "american"
121 // compile-command: "scons -u test"
122 // comment-column: 40