00001 // $Id: TransportPacket.cc 1742 2010-11-04 14:51:56Z g0dil $ 00002 // 00003 // Copyright (C) 2007 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Thorsten Horstmann <tho@berlios.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the 00020 // Free Software Foundation, Inc., 00021 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00026 #include "TransportPacket.hh" 00027 //#include "TransportPacket.ih" 00028 00029 // Custom includes 00030 #include <iomanip> 00031 #include <boost/io/ios_state.hpp> 00032 00033 #define prefix_ 00034 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00035 00036 prefix_ void senf::TransportPacketParser::init_fields() 00037 const 00038 { 00039 sync_byte() = TransportPacketType::SYNC_BYTE; 00040 transport_error_indicator() = 0; 00041 transport_scrmbl_ctrl() = 0; 00042 adaptation_field_ctrl() = 0x1u; 00043 } 00044 00045 prefix_ senf::UInt8Parser senf::TransportPacketParser::pointer_field() 00046 const 00047 { 00048 return pointer_field_().get<1>(); 00049 } 00050 00051 prefix_ void senf::TransportPacketParser::setPUSI(bool pusi) 00052 const 00053 { 00054 if (pusi) pointer_field_().init<1>(); 00055 else pointer_field_().init<0>(); 00056 } 00057 00058 prefix_ void senf::TransportPacketType::dump(packet p, std::ostream & os) 00059 { 00060 boost::io::ios_all_saver ias(os); 00061 os << "TransportPacket:\n" 00062 << std::hex 00063 << senf::fieldName("syncByte") << "0x" << unsigned(p->sync_byte()) << "\n" 00064 << senf::fieldName("transport error ind.") << "0x" << unsigned(p->transport_error_indicator()) << "\n" 00065 << senf::fieldName("payload unit start ind.") << "0x" << unsigned(p->pusi()) << "\n" 00066 << senf::fieldName("transport priority") << "0x" << unsigned(p->transport_priority()) << "\n" 00067 << std::dec 00068 << senf::fieldName("pid") << unsigned(p->pid()) << "\n" 00069 << std::hex 00070 << senf::fieldName("transport scrambling c.") << "0x" << unsigned(p->transport_scrmbl_ctrl()) << "\n" 00071 << senf::fieldName("adaptation field ctrl") << "0x" << unsigned(p->adaptation_field_ctrl()) << "\n" 00072 << senf::fieldName("continuity counter") << "0x" << unsigned(p->continuity_counter()) << "\n"; 00073 if (p->pusi()) 00074 os << senf::fieldName("pointer field") << "0x" << unsigned(p->pointer_field()) << "\n"; 00075 } 00076 00077 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00078 #undef prefix_ 00079 00080 00081 // Local Variables: 00082 // mode: c++ 00083 // fill-column: 100 00084 // c-file-style: "senf" 00085 // indent-tabs-mode: nil 00086 // ispell-local-dictionary: "american" 00087 // compile-command: "scons -u test" 00088 // comment-column: 40 00089 // End: