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 MPESection non-inline non-template implementation */
26 #include "MPESection.hh"
27 //#include "MPESection.ih"
31 #include <boost/io/ios_state.hpp>
32 #include "../../Packets/DefaultBundle/LlcSnapPacket.hh"
33 #include "../../Packets/DefaultBundle/IPv4Packet.hh"
34 #include "../../Packets/DefaultBundle/IPv6Packet.hh"
37 ///////////////////////////////cc.p////////////////////////////////////////
39 //prefix_ boost::uint32_t senf::MPESectionParser::calcCrc()
42 // return std::for_each(
44 // boost::prior(data().end(), 4),
45 // crc32_t() ).checksum();
49 prefix_ void senf::MPESectionType::dump(packet p, std::ostream & os)
51 boost::io::ios_all_saver ias(os);
52 os << "MPE Section:\n"
54 << " table_id: 0x" << unsigned(p->table_id()) << "\n"
55 << " section_syntax_indicator: " << p->section_syntax_indicator() << "\n"
56 << " private_indicator: " << p->private_indicator() << "\n"
58 << " section_length: " << p->section_length() << "\n"
60 << " MAC_address_6: 0x" << unsigned(p->mac_addr_6()) << "\n"
61 << " MAC_address_5: 0x" << unsigned(p->mac_addr_5()) << "\n"
62 << " payload_scrambling_control: 0x" << p->payload_scrmbl_ctrl() << "\n"
63 << " address_scrambling_control: 0x" << p-> addr_scrmbl_ctrl() << "\n"
64 << " LLC_SNAP_flag: 0x" << p->llc_snap_flag() << "\n"
65 << " current_next_indicator: 0x" << p->curr_next_indicator() << "\n"
66 << " section_number: 0x" << unsigned(p->section_num()) << "\n"
67 << " last_section_number: 0x" << unsigned(p->last_section_num()) << "\n"
68 << " real_time_parameters: \n"
69 << " delta_t: 0x" << unsigned(p->real_time_parameters().delta_t()) << "\n"
70 << " table_boundary: 0x" << unsigned(p->real_time_parameters().table_boundary()) << "\n"
71 << " frame_boundary: 0x" << unsigned(p->real_time_parameters().frame_boundary()) << "\n"
72 << " address: 0x" << unsigned(p->real_time_parameters().address()) << "\n"
74 << " CRC: " << unsigned(p->crc()) << "\n";
77 prefix_ senf::PacketParserBase::size_type senf::MPESectionType::initSize()
79 return parser::fixed_bytes + 32/8;
82 prefix_ senf::PacketParserBase::size_type senf::MPESectionType::initHeadSize()
84 return parser::fixed_bytes;
87 prefix_ senf::PacketInterpreterBase::factory_t senf::MPESectionType::nextPacketType(packet p)
89 if (p.data().size() > initSize()+1) {
90 if (p->llc_snap_flag())
91 return LlcSnapPacket::factory();
92 if (p->ip_datagram_version().value() == 4)
93 return IPv4Packet::factory();
94 if (p->ip_datagram_version().value() == 6)
95 return IPv4Packet::factory();
100 prefix_ void senf::MPESectionType::finalize(packet p)
102 p->llc_snap_flag() = p.next(nothrow) && p.next().is<LlcSnapPacket>() ? 1 : 0;
103 p->section_length() = p.data().size() - 3;
104 // p->crc() = p->calcCrc();
107 ///////////////////////////////cc.e////////////////////////////////////////
114 // c-file-style: "senf"
115 // indent-tabs-mode: nil
116 // ispell-local-dictionary: "american"
117 // compile-command: "scons -u test"
118 // comment-column: 40