4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.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.
23 #ifndef HH_GenericPacket_
24 #define HH_GenericPacket_ 1
29 ///////////////////////////////hh.p////////////////////////////////////////
34 /** \brief General packet comprised of header, trailer and payload
36 This class implements a generic packet with three sections: a
37 header, a trailer and a payload section. The header and
38 trailer are not interpreted in any way. The payload can be
39 manually chained to any packet interpreter.
41 template <unsigned HEADER, unsigned TRAILER=0>
42 class GenericPacket : public Packet
45 ///////////////////////////////////////////////////////////////////////////
48 typedef typename Packet::ptr_t<GenericPacket>::ptr ptr;
49 typedef iterator byte_iterator;
51 ///////////////////////////////////////////////////////////////////////////
55 iterator begin_header() const;
56 iterator end_header() const;
57 static size_type header_len();
59 iterator begin_trailer() const;
60 iterator end_trailer() const;
61 static size_type trailer_len();
63 static bool check(iterator const & b, iterator const & e)
64 { return unsigned(e - b) >= HEADER + TRAILER; }
70 GenericPacket(Arg const & arg);
72 virtual void v_nextInterpreter() const;
73 virtual void v_finalize();
74 virtual void v_dump(std::ostream & os) const;
81 ///////////////////////////////hh.e////////////////////////////////////////
82 //#include "GenericPacket.cci"
83 #include "GenericPacket.ct"
84 #include "GenericPacket.cti"
91 // c-file-style: "senf"
92 // indent-tabs-mode: nil
93 // ispell-local-dictionary: "american"