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.
24 #define HH_UDPPacket_ 1
28 #include "ParseInt.hh"
29 #include "ParseArray.hh"
30 #include "PacketRegistry.hh"
32 //#include "UDPPacket.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
38 template <class Iterator=nil, class IPacket=nil>
39 struct Parse_UDP : public ParserBase<Iterator,IPacket>
41 template <class I, class P=nil>
42 struct rebind { typedef Parse_UDP<I,P> parser; };
43 typedef Iterator byte_iterator;
46 Parse_UDP(Iterator const & i) : ParserBase<Iterator,IPacket>(i) {}
48 static unsigned bytes() { return 8; }
50 ///////////////////////////////////////////////////////////////////////////
52 typedef Parse_UInt16 < Iterator > Parse_16bit;
54 Parse_16bit source() const { return Parse_16bit (this->i() ); }
55 Parse_16bit destination() const { return Parse_16bit (this->i() + 2 ); }
56 Parse_16bit length() const { return Parse_16bit (this->i() + 4 ); }
57 Parse_16bit crc() const { return Parse_16bit (this->i() + 6 ); }
63 public Parse_UDP<Packet::iterator, UDPPacket>
66 ///////////////////////////////////////////////////////////////////////////
69 typedef ptr_t<UDPPacket>::ptr ptr;
71 ///////////////////////////////////////////////////////////////////////////
75 UDPPacket(Arg const & arg);
77 virtual void v_nextInterpreter() const;
78 virtual void v_finalize();
79 virtual void v_dump(std::ostream & os) const;
86 ///////////////////////////////hh.e////////////////////////////////////////
87 //#include UDPPacket.cci"
88 //#include "UDPPacket.ct"
89 #include "UDPPacket.cti"
95 // c-file-style: "satcom"