00001 // $Id: Packet.cc 1762 2011-01-13 12:20:09Z tho $ 00002 // 00003 // Copyright (C) 2007 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Stefan Bund <g0dil@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 "Packet.ih" 00027 00028 // Custom includes 00029 #include "Packets.hh" 00030 00031 //#include "Packet.mpp" 00032 #define prefix_ 00033 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00034 00035 prefix_ senf::Packet senf::Packet::getNext() 00036 const 00037 { 00038 factory_t factory (ptr()->nextPacketType()); 00039 if (factory) 00040 return parseNextAs(factory); 00041 else 00042 return parseNextAs<DataPacket>(); 00043 } 00044 00045 prefix_ senf::Packet senf::Packet::getLast() 00046 const 00047 { 00048 Packet p (*this); 00049 Packet n (p.next(nothrow)); 00050 while (n) { 00051 p = n; 00052 n = p.next(nothrow); 00053 } 00054 return p; 00055 } 00056 00057 prefix_ void senf::Packet::dump(std::ostream & os) 00058 const 00059 { 00060 last(); // Make sure the packet is complete 00061 ptr()->dump(os); 00062 } 00063 00064 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00065 #undef prefix_ 00066 //#include "Packet.mpp" 00067 00068 00069 // Local Variables: 00070 // mode: c++ 00071 // fill-column: 100 00072 // c-file-style: "senf" 00073 // indent-tabs-mode: nil 00074 // ispell-local-dictionary: "american" 00075 // compile-command: "scons -u test" 00076 // comment-column: 40 00077 // End: